bayesline.api.AsyncSettingsResolver#
- class bayesline.api.AsyncSettingsResolver#
Abstract base class for async settings resolvers.
- __init__()#
Methods
__init__()errors_against_settings_menu(settings)Get errors that the given settings have against the settings menu.
has_all_references(raw_settings)Check if the given settings have all their references.
is_corrupted(raw_setting)Check if the given raw settings are corrupted.
is_valid(raw_setting)Check if the given raw settings are valid.
Get model types mapping.
resolve_references(references)Resolve the given settings references.
resolve_settings(settings)Resolve the given references.
to_settings_model(raw_settings[, resolve])Convert the given raw settings to a settings model.
validation_messages(raw_settings)Get validation messages for raw settings.
- abstract classmethod model_types() dict[str, type[Settings]]#
Get model types mapping.
Returns#
- dict[ModelType, type[Settings]]
A dictionary of the model types (str) to their type instance. Typically this is e.g. {UniverseSettings.__name__: UniverseSettings}.
- abstract async resolve_settings(settings: list[Settings]) list[RawSettings]#
Resolve the given references.
Parameters#
- settingslist[Settings]
The settings to resolve.
Returns#
- list[RawSettings]
List of raw settings exactly in the same order as the input.
- abstract async resolve_references(references: list[tuple[str, str | int]]) list[RawSettings]#
Resolve the given settings references.
Parameters#
- referenceslist[tuple[ModelType, str | int]]
The settings references to resolve.
Returns#
- list[RawSettings]
List of raw settings exactly in the same order as the input.
- async to_settings_model(raw_settings: RawSettings, resolve: bool = False) Settings#
Convert the given raw settings to a settings model.
Parameters#
- raw_settingsRawSettings
The raw settings to convert.
- resolvebool, default=False
If True, the references are resolved.
Returns#
- Settings
The settings model.
Raises#
- InvalidSettingsError
If the raw settings are invalid.
- NotImplementedError
If resolve=True is not implemented.
- async is_valid(raw_setting: RawSettings) bool#
Check if the given raw settings are valid.
Parameters#
- raw_settingRawSettings
The raw settings to check.
Returns#
- bool
True if the raw setting is valid, False otherwise.
- is_corrupted(raw_setting: RawSettings) bool#
Check if the given raw settings are corrupted.
Parameters#
- raw_settingRawSettings
The raw settings to check.
Returns#
- bool
True if the raw setting is corrupted, False otherwise.
- async has_all_references(raw_settings: RawSettings) bool#
Check if the given settings have all their references.
Parameters#
- raw_settingsRawSettings
The raw settings to check.
Returns#
- bool
True if the settings have all their references, False otherwise.