detect_settings
Identifies the configuration format used in the provided settings and returns a Settings object, ensuring compatibility between old and new setting names. It validates that configuration keys are not inconsistently mixed and applies necessary transformations or defaults based on the detected format.
def detect_settings(
conf: dict,
preconf: dict = None,
ignore_keys: set = None,
prefix: str = None,
all_keys: set = None,
old_keys: set = None
) - > Settings
Identifies and normalizes configuration settings by detecting whether the input uses legacy or modern naming conventions. It validates that settings are not inconsistently mixed and returns a unified Settings object with appropriate mappings and defaults.
Parameters
| Name | Type | Description |
|---|---|---|
| conf | dict | The primary configuration dictionary containing user-defined settings. |
| preconf | dict = None | An optional dictionary of initial configuration values to be merged and normalized. |
| ignore_keys | set = None | A collection of keys to exclude from the detection and validation process. |
| prefix | str = None | A string prefix used to filter settings; if provided, the function defaults to modern naming conventions. |
| all_keys | set = None | The set of valid modern setting keys to check against. |
| old_keys | set = None | The set of legacy setting keys used for backward compatibility detection. |
Returns
| Type | Description |
|---|---|
Settings | A Settings object containing the merged configuration, default values, and bidirectional translation maps between old and new setting keys. |