Registry Module

Registry module.

class pepperpy.registry.Registry(config=None)[source]

Bases: BaseModule[RegistryConfig], Generic[T]

Registry implementation.

Parameters:

config (RegistryConfig | None)

__init__(config=None)[source]

Initialize registry.

Parameters:

config (Optional[RegistryConfig]) – Registry configuration.

Return type:

None

register(name, implementation)[source]

Register implementation.

Parameters:
  • name (str) – Implementation name.

  • implementation (TypeVar(T, bound= RegistryProtocol)) – Implementation instance.

Raises:

RegistryError – If implementation already exists.

Return type:

None

get(name)[source]

Get implementation.

Parameters:

name (str) – Implementation name.

Return type:

TypeVar(T, bound= RegistryProtocol)

Returns:

Implementation instance.

Raises:

RegistryError – If implementation does not exist.

list()[source]

List implementations.

Return type:

Dict[str, TypeVar(T, bound= RegistryProtocol)]

Returns:

Dictionary of implementation names and instances.

class pepperpy.registry.RegistryConfig(name='registry', metadata=<factory>)[source]

Bases: ModuleConfig

Registry configuration.

Parameters:
name: str = 'registry'
metadata: Dict[str, Any]
exception pepperpy.registry.RegistryError(message, details=None)[source]

Bases: Exception

Registry error.

Parameters:
Return type:

None

__init__(message, details=None)[source]

Initialize error.

Parameters:
Return type:

None

class pepperpy.registry.RegistryProtocol[source]

Bases: ABC

Registry protocol.

abstract register(name, implementation)[source]

Register implementation.

Parameters:
  • name (str) – Implementation name.

  • implementation (Any) – Implementation instance.

Return type:

None

abstract get(name)[source]

Get implementation.

Parameters:

name (str) – Implementation name.

Return type:

Any

Returns:

Implementation instance.

abstract list()[source]

List implementations.

Return type:

Dict[str, Any]

Returns:

Dictionary of implementation names and instances.