Skip to content

Commit

Permalink
Update externalConfig.py
Browse files Browse the repository at this point in the history
  • Loading branch information
jeanlassere authored Mar 29, 2024
1 parent 3add99a commit f6bbab5
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions afc/externalConfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,18 @@
root = os.getcwd()

def read_json_config(config_path, json_conly=False):
"""Utility function to parse a json configuration file."""
"""Utility function to parse a json configuration file.
Args:
config_path (str): path to the json configuration file
json_conly (bool): boolean determining whether to return only the json configuration data or use it to update the AFC parameters.
Returns:
if json_conly == TRUE:
dic: dictionary containing the json file data
else:
dic: dictionary containing AFC parameters updated using to the json configuration
"""

# Import and read the new configuration from the json file
with open(config_path, encoding='utf8') as f:
Expand All @@ -36,7 +47,14 @@ def read_json_config(config_path, json_conly=False):
DEFAULT_DICT = read_json_config(DEFAULT_JSON_PATH, json_conly=True)

def config_from_dict(config):
"""Utility function to make configuration from a dictionary."""
"""Utility function to make configuration from a dictionary.
Arg:
config (dic): dictionary containing the json file data
Returns:
dic: dictionary containing AFC parameters updated using to the json configuration
"""

for k in read_json_config(DEFAULT_JSON_PATH, json_conly=True):
if k not in config:
Expand Down

0 comments on commit f6bbab5

Please sign in to comment.