data_juicer.utils.config_utils module#
Configuration utilities for handling both dict and object-style configs.
- class data_juicer.utils.config_utils.ConfigAccessor[源代码]#
基类:
objectUtility for accessing configuration values that may be dicts or objects.
- static get(config: Any, key: str, default: Any = None) Any[源代码]#
Get a configuration value from either a dict or object.
- 参数:
config -- Configuration object (dict or object with attributes)
key -- Key/attribute name to retrieve
default -- Default value if key not found
- 返回:
Configuration value or default
- static get_nested(config: Any, *keys: str, default: Any = None) Any[源代码]#
Get a nested configuration value.
示例
get_nested(cfg, 'partition', 'mode', default='auto')
- 参数:
config -- Configuration object
keys -- Series of keys to traverse
default -- Default value if path not found
- 返回:
Configuration value or default