bayesline.api.AsyncSettingsResolver#
- class bayesline.api.AsyncSettingsResolver#
Bases:
ABC
Methods
__init__
()errors_against_settings_menu
(settings)Validate and return any errors that the given settings have against the settings menu.
has_all_references
(raw_settings)Checks if the given settings have all their references.
is_corrupted
(raw_setting)Checks if the given raw settings are corrupted.
is_valid
(raw_setting)Checks if the given raw settings are valid.
Returns A dictionary of the model types (str) to their type instance. Typically this is e.g. {UniverseSettings.__name__: UniverseSettings}.
resolve_references
(references)Resolves the given settings references.
resolve_settings
(settings)Resolves the given references.
to_settings_model
(raw_settings[, resolve])Converts the given raw settings to a settings model.
validation_messages
(raw_settings)- abstract classmethod model_types() dict[str, type[Settings]] #
Returns#
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] #
Resolves the given references.
Parameters#
- settings: Settings
The settings to resolve.
Returns#
List of raw settings exactly in the same order as the input.
- abstract async resolve_references(references: list[tuple[str, str | int]]) list[RawSettings] #
Resolves the given settings references.
Parameters#
- references: list[tuple[ModelType, str | int]]
The settings references to resolve.
Returns#
List of raw settings exactly in the same order as the input.
- async to_settings_model(raw_settings: RawSettings, resolve: bool = False) Settings #
Converts the given raw settings to a settings model.
Parameters#
- raw_settings: RawSettings
The raw settings to convert.
- resolve: bool
If True, the references are resolved.
Returns#
The settings model.
- async is_valid(raw_setting: RawSettings) bool #
Checks if the given raw settings are valid.
Parameters#
- raw_setting: RawSettings
The raw settings to check.
Returns#
True if the raw setting is valid, False otherwise.
- is_corrupted(raw_setting: RawSettings) bool #
Checks if the given raw settings are corrupted.
Parameters#
- raw_setting: RawSettings
The raw settings to check.
Returns#
True if the raw setting is corrupted, False otherwise.
- async has_all_references(raw_settings: RawSettings) bool #
Checks if the given settings have all their references.
Parameters#
- settings: Settings
The raw_settings to check.
Returns#
True if the settings have all their references, False otherwise.
Validate and return any errors that the given settings have against the settings menu.
Parameters#
- settings: Settings
The settings to validate.
Returns#
A list of error messages if the settings are invalid against the settings menu.
- async validation_messages(raw_settings: RawSettings) list[str] #