bayesline.api.Settings#
- pydantic model bayesline.api.Settings#
Base class for all settings objects.
Show JSON schema
{ "title": "Settings", "description": "Base class for all settings objects.", "type": "object", "properties": {}, "additionalProperties": false }
- Config:
frozen: bool = True
extra: str = forbid
- Validators:
_strip_unknown_on_load»all fields
Get the menu type for this settings object.
Returns#
- type[M]
The menu type for this settings object.
- get_references() Sequence[str | int]#
Get references for this settings object.
Returns#
- Sequence[str | int]
A sequence of references (strings or integers) for this settings object.
- map_references(fn: Callable[[str | int], str | int]) Self#
Return a copy with every reference rewritten by
fn.The structural dual of
get_references(): it appliesfnto each reference this settings object holds — recursing into nested settings — and returns a rewritten copy, leaving all non-reference fields untouched. The base implementation has no references and returnsselfunchanged, mirroringget_references()(whose default is[]); a subclass that overrides one must override the other in lockstep so the two stay consistent (a parity test enforces this).fnis applied purely structurally — this object knows where its references live, not what a rewrite means. Any resolution context (e.g. a current user or a user directory) must be captured by the caller in thefnclosure; the settings layer never learns of it.Parameters#
- fnCallable[[str | int], str | int]
Applied to each reference leaf. Must preserve a reference’s kind (a name stays a name, an id stays an id).
Returns#
- Self
A copy with references rewritten.
- validate_settings(menu: M | None) None#
Validate the settings against the given menu.
Parameters#
- menuM | None
The menu to validate against. If None, the settings are validated against without having the menu context. This means that less validation is done.
Raises#
- AttributeError
If the menu type does not match the settings type.
- describe(menu: M) str#
Describe the settings.
Parameters#
- menuM
The menu to use to describe the settings.
Returns#
- str
A description of the settings.
- with_dataset(dataset: str) DatasetAwareSettings[Self]#
Bind this settings object to a dataset.
Parameters#
- datasetstr
The dataset to scope the settings to.
Returns#
- DatasetAwareSettings[Self]
A wrapper carrying both the dataset and this settings.