Skip to content

registry

Registry module for storing volatile objects

Attributes

T module-attribute

T = TypeVar('T')

Classes

Registry

Registry()

Bases: Generic[T]

A simple key/value registry for storing volatile objects

This class is thread-safe and should be ok to use via the API as long as it is wrapped with eleanor.backend.api.run_async

Functions

__contains__
__contains__(key: str) -> bool

Check if a key is present in the registry.

Parameters:

  • key (str) –

    The key to check.

Returns:

  • bool ( bool ) –

    True if the key is present, False otherwise.

__getitem__
__getitem__(key: str) -> T

Retrieve the value associated with the given key.

Parameters:

  • key (str) –

    The key to retrieve the value for.

Returns:

  • T ( T ) –

    The value associated with the key.

__setitem__
__setitem__(key: str, value: T) -> None

Set the value associated with the given key in the registry.

Parameters:

  • key (str) –

    The key to set the value for.

  • value (T) –

    The value to be set.

Returns:

  • None

    None

get
get(key: str) -> T

Retrieve the value associated with the given key from the registry.

Parameters:

  • key (str) –

    The key to retrieve the value for.

Returns:

  • T ( T ) –

    The value associated with the given key.

Raises:

  • KeyError

    If the key is not found in the registry.

remove
remove(key: str) -> None

Remove the specified key from the registry.

Parameters:

  • key (str) –

    The key to be removed.

Returns:

  • None

    None

set
set(key: str, value: T) -> None

Sets a key-value pair in the registry.

Parameters:

  • key (str) –

    The key to register.

  • value (T) –

    The value to associate with the key.

Returns:

  • None

    None