base
Class info¶
Classes¶
Name | Children | Inherits |
---|---|---|
ConfigFile mkdocs_mknodes.appconfig.base Base class for config files. |
🛈 DocStrings¶
ConfigFile
¶
Bases: BaseModel
Base class for config files.
A class for loading and managing configuration files in YAML format. Supports inheritance between config files and provides methods for loading from files or YAML text.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config_file_path
|
str | None
|
|
None
|
inherit
|
str | None
|
|
None
|
Source code in mkdocs_mknodes/appconfig/base.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
|
inherit
class-attribute
instance-attribute
¶
inherit: str | None = Field(None, exclude=True, alias='INHERIT')
Define the parent for a configuration file.
The path must be relative to the location of the primary file.
from_yaml
classmethod
¶
Create a ConfigFile instance from YAML text.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
text
|
YAMLInput
|
YAML content as text or file-like object |
required |
**overrides
|
Any
|
Additional key-value pairs to override values from the YAML |
{}
|
Returns:
Type | Description |
---|---|
Self
|
A new instance of the ConfigFile class initialized with the YAML data |
Source code in mkdocs_mknodes/appconfig/base.py
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
|
from_yaml_file
classmethod
¶
Create a ConfigFile instance from a YAML file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
yaml_path
|
str | PathLike[str]
|
Path to the YAML configuration file |
required |
**overrides
|
Any
|
Additional key-value pairs to override values from the file |
{}
|
Returns:
Type | Description |
---|---|
Self
|
A new instance of the ConfigFile class initialized with the YAML data |
Source code in mkdocs_mknodes/appconfig/base.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
|
to_yaml
¶
to_yaml() -> str
Convert the configuration to YAML format.
Returns:
Type | Description |
---|---|
str
|
A string containing the YAML representation of the configuration |
Source code in mkdocs_mknodes/appconfig/base.py
57 58 59 60 61 62 63 64 |
|