ObjectRegistry
Provides a simple interface to global object registries so that pieces of code don’t need to pass things like loggers or parallelizers through every step of the code
__init__(self, default='raise'):
LLM Docstring
Create a weak-value registry with configurable behavior for missing keys.
default:objectthe fallback returned when a key is absent
:returns:NoneNo explicit value; the method mutates state or performs I/O.
temp_default(self, val):
LLM Docstring
Create a context manager that temporarily replaces the registry fallback value.
val:objectthe value being stored, converted, or installed
:returns:objectThe resolved or newly constructed helper object.
__contains__(self, item):
LLM Docstring
Test whether a live weakly referenced object is registered under a key.
item:objectthe lookup key or index
:returns:boolWhether the tested condition is satisfied.
lookup(self, key):
LLM Docstring
Return the registered object, or the configured default when missing-key lookup is non-raising.
key:objectthe storage or lookup key
:returns:objectThe reconstructed, loaded, or selected Python value.
__getitem__(self, item):
LLM Docstring
Look up a registry key using the configured missing-key policy.
item:objectthe lookup key or index
:returns:objectThe reconstructed, loaded, or selected Python value.
register(self, key, val):
LLM Docstring
Store a weak reference to val under key.
key:objectthe storage or lookup key
val:objectthe value being stored, converted, or installed
:returns:NoneNo explicit value; the method mutates state or performs I/O.
__setitem__(self, key, value):
LLM Docstring
Register a value using dictionary assignment syntax.
key:objectthe storage or lookup key
value:objectthe value to store
:returns:NoneNo explicit value; the method mutates state or performs I/O.
keys(self):
LLM Docstring
Return the live registry keys.
:returns:collections.abc.KeysView | collections.abc.ItemsView | collections.abc.ValuesView | listA view or list of the requested registry, cache, checkpoint, or mapping entries.
items(self):
LLM Docstring
Return the live registry key/value pairs.
:returns:collections.abc.KeysView | collections.abc.ItemsView | collections.abc.ValuesView | listA view or list of the requested registry, cache, checkpoint, or mapping entries.
values(self):
LLM Docstring
Return the live registered objects.
:returns:collections.abc.KeysView | collections.abc.ItemsView | collections.abc.ValuesView | listA view or list of the requested registry, cache, checkpoint, or mapping entries.