bayesline.api.AsyncInMemorySettingsRegistry#
- class bayesline.api.AsyncInMemorySettingsRegistry(model_type: type[SettingsType], settings_menu: Callable[[str | None], Awaitable[SettingsMenuType]] | SettingsMenuType, resolver: AsyncSettingsResolver)#
Bases:
AsyncSettingsRegistry
[SettingsType
,SettingsMenuType
]Methods
__init__
(model_type, settings_menu, resolver)available_settings
([dataset_name])Parameters dataset_name str | None The name of the dataset to use when retrieving the settings menu. If not provided, the settings menu will be retrieved for the default dataset.
delete
(name)Parameters name str | int The unique name or int identifier of the settings to delete.
get
(name)Parameters name str | int The unique name or int identifier of the item to retrieve.
get_all
()Returns A dictionary of all valid available settings.
Returns A dictionary of all available settings metadata, valid or invalid.
Returns A dictionary of all valid available settings with metadata.
get_metadata
(name)Parameters name str | int The unique name or int identifier of the item to retrieve.
get_raw
(name_or_id)Parameters name_or_id list[str | int] The unique names or int identifiers of the items to retrieve.
ids
([mode])Parameters mode Mode The mode to use when retrieving the ids.
names
([mode])Parameters mode Mode The mode to use when retrieving the ids.
save
(name, settings)Parameters name str The unique name of the item to save. The name cannot be all numbers. settings T The item to save.
update
(name, settings)Parameters name str | int The unique name or int identifier of the item to update. settings T The item to update.
- __init__(model_type: type[SettingsType], settings_menu: Callable[[str | None], Awaitable[SettingsMenuType]] | SettingsMenuType, resolver: AsyncSettingsResolver)#
- async ids(mode: Literal['All', 'Valid', 'Invalid'] = 'Valid') dict[int, str] #
Parameters#
- modeMode
The mode to use when retrieving the ids.
Returns#
A dictionary of the unique identifiers to the unique names.
- async names(mode: Literal['All', 'Valid', 'Invalid'] = 'Valid') dict[str, int] #
Parameters#
- modeMode
The mode to use when retrieving the ids.
Returns#
A dictionary of the unique names to the unique identifiers.
- async available_settings(dataset_name: str | None = None) SettingsMenuType #
Parameters#
- dataset_namestr | None
The name of the dataset to use when retrieving the settings menu. If not provided, the settings menu will be retrieved for the default dataset.
Returns#
A description of valid settings for this registry.
- async get_raw(name_or_id: list[str | int]) list[RawSettings] #
Parameters#
- name_or_idlist[str | int]
The unique names or int identifiers of the items to retrieve.
Returns#
A list of RawSettings in the same order as input.
- async get(name: str | int) SettingsType #
Parameters#
- namestr | int
The unique name or int identifier of the item to retrieve.
Raises#
- KeyError
If the item does not exist.
- InvalidSettingsError:
If the item exists but is invalid.
Returns#
The item for the given name.