data_juicer.utils.config_utils module#
Configuration utilities for handling both dict and object-style configs.
- class data_juicer.utils.config_utils.ConfigAccessor[source]#
Bases:
objectUtility for accessing configuration values that may be dicts or objects.
- static get(config: Any, key: str, default: Any = None) Any[source]#
Get a configuration value from either a dict or object.
- Parameters:
config – Configuration object (dict or object with attributes)
key – Key/attribute name to retrieve
default – Default value if key not found
- Returns:
Configuration value or default
- static get_nested(config: Any, *keys: str, default: Any = None) Any[source]#
Get a nested configuration value.
Example
get_nested(cfg, ‘partition’, ‘mode’, default=’auto’)
- Parameters:
config – Configuration object
keys – Series of keys to traverse
default – Default value if path not found
- Returns:
Configuration value or default