eyconf.config.extra_fields.EYConfExtraFields¶
- class eyconf.config.extra_fields.EYConfExtraFields(data: dict | D, schema: type[D] | None = None)¶
Configuration class that supports extra fields explicitly.
This class extends the base configuration functionality to allow for additional fields that are not defined in the original schema.
This additional field is accessible via the extra_data_as_dict property.
Attributes
Get the configuration data wrapped in a dynamic accessor.
Get the extra data as an AttributeDict.
Methods
__init__(data[, schema])Return the configs' defaults (inferred from schema) as yaml.
overwrite(data)Overwrite the configuration with provided data.
reset()Reset the configuration data to the default values.
to_dict([include_additional])Get the full configuration data as a dictionary, including extra fields.
to_yaml()Convert the configuration data to a yaml string.
update(data)Update the configuration with provided data.
validate()Validate the current data against the schema.
- property data: D¶
Get the configuration data wrapped in a dynamic accessor.
Care: Instance checks will not work as expected on this property.
- default_yaml() str¶
Return the configs’ defaults (inferred from schema) as yaml.
You may overwrite this method to customize the default configuration generation.
- property extra_data: AttributeDict¶
Get the extra data as an AttributeDict.
- overwrite(data: dict | D)¶
Overwrite the configuration with provided data.
If the provided data is missing required fields, an error will be raised.
- reset()¶
Reset the configuration data to the default values.
- to_dict(include_additional: bool = True) dict¶
Get the full configuration data as a dictionary, including extra fields.
- update(data: dict)¶
Update the configuration with provided data.
This applies an partial update to the existing configuration data. Only the provided keys will be updated, others will remain unchanged.
- validate()¶
Validate the current data against the schema.