ard.utils.io#

Functions

check_create_folder(filepath)

load_yaml(filename[, loader, return_path])

replace_key_value(target_dict, target_key, ...)

Recursively replace the value of a target key in a dictionary.

write_yaml(filename, data)

Classes

Loader(stream)

class ard.utils.io.Loader(stream)[source]#
include(node)[source]#
yaml_constructors = {'!include': <function Loader.include>, 'tag:yaml.org,2002:binary': <function SafeConstructor.construct_yaml_binary>, 'tag:yaml.org,2002:bool': <function SafeConstructor.construct_yaml_bool>, 'tag:yaml.org,2002:float': <function SafeConstructor.construct_yaml_float>, 'tag:yaml.org,2002:int': <function SafeConstructor.construct_yaml_int>, 'tag:yaml.org,2002:map': <function SafeConstructor.construct_yaml_map>, 'tag:yaml.org,2002:null': <function SafeConstructor.construct_yaml_null>, 'tag:yaml.org,2002:omap': <function SafeConstructor.construct_yaml_omap>, 'tag:yaml.org,2002:pairs': <function SafeConstructor.construct_yaml_pairs>, 'tag:yaml.org,2002:seq': <function SafeConstructor.construct_yaml_seq>, 'tag:yaml.org,2002:set': <function SafeConstructor.construct_yaml_set>, 'tag:yaml.org,2002:str': <function SafeConstructor.construct_yaml_str>, 'tag:yaml.org,2002:timestamp': <function SafeConstructor.construct_yaml_timestamp>, None: <function SafeConstructor.construct_undefined>}#
ard.utils.io.load_yaml(filename, loader=<class 'ard.utils.io.Loader'>, return_path=False)[source]#
Return type:

dict

ard.utils.io.check_create_folder(filepath)[source]#
ard.utils.io.write_yaml(filename, data)[source]#
ard.utils.io.replace_key_value(target_dict, target_key, new_value, replace_none_only=True)[source]#

Recursively replace the value of a target key in a dictionary.

Parameters: - target_dict (dict): The dictionary to process. - target_key (str): The key whose value needs to be replaced. - new_value: The new value to assign to the target key. - replace_none_only (bool): if True, only 'None' values will be replaced.

Returns: - dict: The updated dictionary.

Return type:

dict

Parameters:
  • target_dict (dict)

  • target_key (str)