gradslam.config

class CfgNode(init_dict: Optional[dict] = None, key_list: Optional[list] = None, new_allowed: Optional[bool] = False)[source]

CfgNode is a node in the configuration tree. It’s a simple wrapper around a dict and supports access to attributes via keys.

clone()[source]

Recursively copy this CfgNode.

defrost()[source]

Make this CfgNode and all of its children mutable.

dump(**kwargs)[source]

Dump CfgNode to a string.

freeze()[source]

Make this CfgNode and all of its children immutable.

is_frozen()[source]

Return mutability.

key_is_deprecated(full_key: str)[source]

Test if a key is deprecated.

key_is_renamed(full_key: str)[source]

Test if a key is renamed.

classmethod load_cfg(cfg_file_obj_or_str)[source]

Load a configuration into the CfgNode.

Parameters

cfg_file_obj_or_str (str or cfg compatible object) – Supports loading from: - A file object backed by a YAML file. - A file object backed by a Python source file that exports an sttribute “cfg” (dict or CfgNode). - A string that can be parsed as valid YAML.

merge_from_file(cfg_filename: str)[source]

Load a yaml config file and merge it with this CfgNode.

Parameters

cfg_filename (str) – Config file path.

merge_from_list(cfg_list: list)[source]

Merge config (keys, values) in a list (eg. from commandline) into this CfgNode.

Eg. cfg_list = [‘FOO.BAR’, 0.5].

merge_from_other_cfg(cfg_other)[source]

Merge cfg_other into the current CfgNode.

Parameters

cfg_other

register_deprecated_key(key: str)[source]

Register key (eg. FOO.BAR) a deprecated option. When merging deprecated keys, a warning is generated and the key is ignored.

register_renamed_key(old_name: str, new_name: str, message: Optional[str] = None)[source]

Register a key as having been renamed from old_name to new_name. When merging a renamed key, an exception is thrown alerting the user to the fact that the key has been renamed.