bayesline.api.ReadOnlyRegistry#
- class bayesline.api.ReadOnlyRegistry#
Abstract base class for read-only registries.
- __init__()#
Methods
__init__()get(name)Get an item by name or ID.
get_all()Get all valid available settings.
Get all available settings metadata.
Get all valid available settings with metadata.
get_metadata(name)Get metadata for an item by name or ID.
get_raw(name_or_id)Get raw settings by names or IDs.
ids([mode])Get mapping of IDs to names.
names([mode])Get mapping of names to IDs.
- abstract ids(mode: Literal['All', 'Valid', 'Invalid'] = 'Valid') dict[int, str]#
Get mapping of IDs to names.
Parameters#
- modeMode, default=”Valid”
The mode to use when retrieving the ids.
Returns#
- dict[int, str]
A dictionary of the unique identifiers to the unique names.
- abstract names(mode: Literal['All', 'Valid', 'Invalid'] = 'Valid') dict[str, int]#
Get mapping of names to IDs.
Parameters#
- modeMode, default=”Valid”
The mode to use when retrieving the names.
Returns#
- dict[str, int]
A dictionary of the unique names to the unique identifiers.
- abstract get_raw(name_or_id: list[str | int]) list[RawSettings]#
Get raw settings by names or IDs.
Parameters#
- name_or_idlist[str | int]
The unique names or int identifiers of the items to retrieve.
Returns#
- list[RawSettings]
A list of RawSettings in the same order as input.
- abstract get(name: str | int) T#
Get an item by name or ID.
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#
- T
The item for the given name.
- abstract get_metadata(name: str | int) SettingsMetaData#
Get metadata for an item by name or ID.
Parameters#
- namestr | int
The unique name or int identifier of the item to retrieve.
Raises#
- KeyError
If the item does not exist.
Returns#
- SettingsMetaData
The metadata for the given name.
- get_all() dict[str, T]#
Get all valid available settings.
Returns#
- dict[str, T]
A dictionary of all valid available settings.
- get_all_with_metadata() dict[str, tuple[T, SettingsMetaData]]#
Get all valid available settings with metadata.
Returns#
- dict[str, tuple[T, SettingsMetaData]]
A dictionary of all valid available settings with metadata.
- get_all_metadata() dict[str, SettingsMetaData]#
Get all available settings metadata.
Returns#
- dict[str, SettingsMetaData]
A dictionary of all available settings metadata (valid or invalid).