config
util.config
read_yml
load config dictionary
Parameters:
-
config(str) –file path
Returns:
-
Dict[str, Any]–Dict[str, Any]: result config dict
_load_yml
load config dictionary from *.yml file
Source code in SaigeToolkit/util/config.py
update_import
recursively import and override base config, and there is two conditions of importing:
- if dict has
importkey and its value pointing another config file (*.yml) - if dict value is pointing another config file (*.yml)
Parameters:
-
cfg(Dict[str, Any]) –base config
Returns:
-
Dict[str, Any]–Dict[str, Any]: result config (import conditions updated)
Source code in SaigeToolkit/util/config.py
save_yml
Source code in SaigeToolkit/util/config.py
override_dict
recursively override dictionaries
Source code in SaigeToolkit/util/config.py
convert_keys_string_to_list
keys 입력값이 str인 경우 . 으로 분할해 함수에 전달해줍니다.
Source code in SaigeToolkit/util/config.py
check_key_exists
get_tree_node
tree-like obj에 대해 keys의 값을 순서대로 각 레벨에서 탐색해 최종 노드의 값을 리턴, 최종 노드가 존재하지 않으면 error 발생
Source code in SaigeToolkit/util/config.py
set_tree_node
tree-like obj에 대해 keys의 값을 순서대로 각 레벨에서 탐색해 최종 노드의 값을 수정, 최종 노드가 존재하지 않으면 error 발생
Source code in SaigeToolkit/util/config.py
get_tree_node_with_default
get_tree_node_with_default(obj: Any, keys: List, value: Optional[Any] = None, ignore_type_error: bool = False) -> Any
tree-like obj에 대해 keys의 값을 순서대로 각 레벨에서 탐색해 최종 노드의 값을 리턴, 최종 노드가 존재하지 않으면 value 리턴, ignore_type_error=True 일 경우 최종 value가 더이상 탐색하지 못할 때에도 error 대신 default value를 리턴.
Source code in SaigeToolkit/util/config.py
flatten_tree
tree-like obj를 1 레벨 dictionary로 변환