class documentation

A Registry that can store one or multiple instances of a single class on the basis of a "scope" function. The object implements ``__call__`` as the "getter", so by calling ``myregistry()`` the contained object is returned for the current scope. :param createfunc: a callable that returns a new object to be placed in the registry :param scopefunc: a callable that will return a key to store/retrieve an object.

Method __call__ Undocumented
Method __init__ Construct a new :class:`.ScopedRegistry`.
Method clear Clear the current scope, if any.
Method has Return True if an object is present in the current scope.
Method set Set the value for the current scope.
Class Variable __slots__ Undocumented
Instance Variable createfunc Undocumented
Instance Variable registry Undocumented
Instance Variable scopefunc Undocumented
def __call__(self) -> _T: (source)
def __init__(self, createfunc: Callable[[], _T], scopefunc: Callable[[], Any]): (source)

Construct a new :class:`.ScopedRegistry`. :param createfunc: A creation function that will generate a new value for the current scope, if none is present. :param scopefunc: A function that returns a hashable token representing the current scope (such as, current thread identifier).

def clear(self): (source)

Clear the current scope, if any.

def has(self) -> bool: (source)

Return True if an object is present in the current scope.

def set(self, obj: _T): (source)

Set the value for the current scope.

__slots__: tuple[str, ...] = (source)

Undocumented

scopefunc = (source)

Undocumented