Instance Registry

Module: ppc_robot_lib.utils.registry

class AbstractRegistry[source]

Base class for instance registries. This class stores instances in a dictionary under given keys. When an instance is first requested, it will be created using the _create() method and stored in the internal dictionary with the given key.

On subsequent requests with the same key, the same instance will be returned.

create_registry_getter(type_, registry_factory)[source]

Registry factory. Creates a separate registry for each thread.

Parameters:
  • type – Type of the registry.

  • registry_factory (Callable[[], AbstractRegistry[TypeVar(T)]]) – Factory function that will be called to create a registry for each thread.

Return type:

Callable[[str], TypeVar(T)]

Returns:

Registry of given type.