From b8d6fcebe6b2567788526794b2389c505fe24855 Mon Sep 17 00:00:00 2001 From: Jk40git <125589910+Jk40git@users.noreply.github.com> Date: Mon, 12 Feb 2024 02:11:43 +0000 Subject: [PATCH] Update utils.py change the docstring _find to _load_json docstring --- src/scribe_data/utils.py | 32 ++++++++++++-------------------- 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/src/scribe_data/utils.py b/src/scribe_data/utils.py index b93422ebd..7b924c6cc 100644 --- a/src/scribe_data/utils.py +++ b/src/scribe_data/utils.py @@ -76,30 +76,22 @@ def _load_json(package_path: str, file_name: str, root: str): def _find(source_key: str, source_value: str, target_key: str, error_msg: str): - """ - Each 'language', (english, german,..., etc) is a dictionary of key/value pairs: - - entry = { - "language": "english", - "iso": "en", - "qid": "Q1860", - "remove-words": [...], - "ignore-words": [...] - } + """Loads a JSON resource from a package into a python entity. - Given a key/value pair, the 'source', and the 'target' key, get the 'target' value. + Parameters + ---------- + package_path : str + The fully qualified package that contains the resource. - 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. + file_name : str + The name of the file (resource) that contains the JSON data. - Raises: - ValueError: when a source_value is not supported. + root : str + The root node of the JSON document. - Returns: - The 'target' value given the passed arguments. + Returns + ------- + A python entity starting at 'root'. """ norm_source_value = source_value.lower()