diff --git a/src/scribe_data/utils.py b/src/scribe_data/utils.py index b93422eb..e52b753e 100644 --- a/src/scribe_data/utils.py +++ b/src/scribe_data/utils.py @@ -5,6 +5,8 @@ Utility functions for data extraction, formatting and loading. Contents: + _load_json, + _find, get_scribe_languages, get_language_qid, get_language_iso, @@ -87,18 +89,28 @@ def _find(source_key: str, source_value: str, target_key: str, error_msg: str): "ignore-words": [...] } - Given a key/value pair, the 'source', and the 'target' key, get the 'target' value. + Given a key/value pair, the 'source' and the 'target' key get the 'target' value. - Args: - source_value (str): e.g. 'english'. - source_key (str): e.g. 'language'. - target_key (str): e.g. 'iso'. - error_msg (str): for when a value cannot be found. + Parameters + ---------- + source_value : str + The source value to find equivalents for (e.g. 'english'). + + source_key : str + The source key to reference (e.g. 'language'). + + target_key : str + The key to target (e.g. 'iso'). - Raises: - ValueError: when a source_value is not supported. + error_msg : str + The message displayed when a value cannot be found. - Returns: + Raises + ------ + ValueError : when a source_value is not supported. + + Returns + ------- The 'target' value given the passed arguments. """ norm_source_value = source_value.lower()