yaloader.YAMLBaseConfig#
- class yaloader.YAMLBaseConfig[source]#
Bases:
BaseModelThe base class for all config objects which are loaded from or dumped to yaml files.
Each config from which an actual object can be created has to implement the
YAMLBaseConfig.load()method.- load(*args, **kwargs)[source]#
Create the object the yaml config object is for.
This basic constructor uses all attributes of the config as kwargs for the loaded class.
- model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}#
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'validate_assignment': True}#
Since yaml configs are used to create instances extra fields are forbidden.
- model_fields: ClassVar[dict[str, FieldInfo]] = {}#
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
- model_post_init(__context: Any) None#
This function is meant to behave like a BaseModel method to initialise private attributes.
It takes context as an argument since that’s what pydantic-core passes when calling it.
- Parameters:
self – The BaseModel instance.
__context – The context.