Skip to content

Registry¤

The registry component of Scrubber maintains a catalogue of registered functions that can be imported individually as needed. The registry enables the functions to be referenced by name using string values. The code registry is created and accessed using the catalogue library by Explosion.

get_component(s: str) -> Callable ¤

Get a single component from a string.

Parameters:

Name Type Description Default
s str

The name of the function.

required

Returns:

Name Type Description
Callable Callable

The function.

Source code in lexos/scrubber/registry.py
@validate_call
def get_component(s: str) -> Callable:
    """Get a single component from a string.

    Args:
        s: The name of the function.

    Returns:
        Callable: The function.
    """
    return scrubber_components.get(s)

get_components(t: tuple[str, ...]) -> Generator ¤

Get components from a tuple.

Parameters:

Name Type Description Default
t tuple[str, ...]

A tuple containing string names of functions.

required

Yields:

Name Type Description
Generator Generator

A generator containing the functions.

Source code in lexos/scrubber/registry.py
@validate_call
def get_components(t: tuple[str, ...]) -> Generator:
    """Get components from a tuple.

    Args:
        t (tuple[str, ...]): A tuple containing string names of functions.

    Yields:
        Generator: A generator containing the functions.
    """
    for item in t:
        yield scrubber_components.get(item)