Settings
settings
Info
pydantic-model
Bases: SettingMixin, BaseModel
Info for a KCell.
validate_assignment is intentionally off: combined with a
model_validator(mode="before") it would re-run validation against the
entire extras dict on every per-field write, which historically silently
coerced previously-stored values via clean_value() (see #944). Per-write
validation is handled in __setattr__ and only inspects the new value.
Validators:
Source code in kfactory/settings.py
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | |
__add__
__add__(other: Info) -> Self
Update the settings.
Source code in kfactory/settings.py
131 132 133 | |
__iadd__
__iadd__(other: Info) -> Self
Update the settings.
Source code in kfactory/settings.py
125 126 127 128 129 | |
__init__
__init__(**kwargs: Any) -> None
Initialize the settings.
Source code in kfactory/settings.py
85 86 87 | |
__setattr__
__setattr__(name: str, value: Any) -> None
Validate the assigned value, then store it.
Source code in kfactory/settings.py
108 109 110 111 112 113 | |
__setitem__
__setitem__(key: str, value: MetaData) -> None
Set the value of a setting.
Source code in kfactory/settings.py
121 122 123 | |
restrict_types
pydantic-validator
restrict_types(
data: dict[str, MetaData],
) -> dict[str, MetaData]
Restrict the types of the settings (runs at construction only).
Source code in kfactory/settings.py
89 90 91 92 93 94 95 | |
update
update(data: dict[str, MetaData]) -> None
Update the settings.
Source code in kfactory/settings.py
115 116 117 118 119 | |
KCellSettings
pydantic-model
Bases: SettingMixin, BaseModel
Settings for a BaseKCell.
Validators:
Source code in kfactory/settings.py
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | |
__init__
__init__(**kwargs: Any) -> None
Initialize the settings.
Source code in kfactory/settings.py
44 45 46 | |
restrict_types
pydantic-validator
restrict_types(data: dict[str, Any]) -> dict[str, MetaData]
Restrict the types of the settings.
Source code in kfactory/settings.py
48 49 50 51 52 53 54 | |
KCellSettingsUnits
pydantic-model
Bases: SettingMixin, BaseModel
Settings for the units of a KCell.
Validators:
Source code in kfactory/settings.py
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | |
__init__
__init__(**kwargs: Any) -> None
Initialize the settings.
Source code in kfactory/settings.py
62 63 64 | |
restrict_types
pydantic-validator
restrict_types(data: dict[str, str]) -> dict[str, str]
Restrict the types of the settings.
Source code in kfactory/settings.py
66 67 68 69 70 71 72 | |
SettingMixin
Mixin class for shared settings functionality.
Source code in kfactory/settings.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | |
__contains__
__contains__(__key: str) -> bool
Check if a setting exists.
Source code in kfactory/settings.py
30 31 32 | |
__getattr__
__getattr__(key: str) -> Any
Get the value of a setting.
Source code in kfactory/settings.py
18 19 20 | |
__getitem__
__getitem__(key: str) -> Any
Get the value of a setting.
Source code in kfactory/settings.py
22 23 24 | |
__str__
__str__() -> str
Return the representation of the settings.
Source code in kfactory/settings.py
34 35 36 | |
get
get(__key: str, /, default: Any = None) -> Any
Get the value of a setting.
Source code in kfactory/settings.py
26 27 28 | |