Skip to content

Registry API

oeis_code.registry

register(seq_id)

Decorator to register a sequence function in the registry.

Parameters:

Name Type Description Default
seq_id str

The OEIS sequence identifier (e.g., 'A000045').

required

Returns:

Type Description
Callable[[Callable[..., Any]], Callable[..., Any]]

The decorator function.

Source code in src/oeis_code/registry.py
def register(seq_id: str) -> Callable[[Callable[..., Any]], Callable[..., Any]]:
    """
    Decorator to register a sequence function in the registry.

    Args:
        seq_id: The OEIS sequence identifier (e.g., 'A000045').

    Returns:
        The decorator function.
    """

    def decorator(func: Callable[..., Any]) -> Callable[..., Any]:
        registry[seq_id] = func
        return func

    return decorator