Skip to content

decorators module

Class and function decorators.


attach_nb_methods function

attach_nb_methods(
    config
)

Class decorator to add Numba methods.

config should contain target method names (keys) and dictionaries (values) with the following keys:

  • func: Function that should be wrapped. The first argument should expect a 2-dim array.
  • is_reducing: Whether the function is reducing. Defaults to False.
  • path: Path to the function for documentation. Defaults to func.__name__.
  • replace_signature: Whether to replace the target signature with the source signature. Defaults to True.
  • wrap_kwargs: Default keyword arguments for wrapping. Will be merged with the dict supplied by the user. Defaults to dict(name_or_index=target_name) for reducing functions.

The class should be a subclass of Wrapping.


attach_transform_methods function

attach_transform_methods(
    config
)

Class decorator to add transformation methods.

config should contain target method names (keys) and dictionaries (values) with the following keys:

  • transformer: Transformer class/object.
  • docstring: Method docstring. Defaults to "See {transformer}.__name__.".
  • replace_signature: Whether to replace the target signature. Defaults to True.

The class should be a subclass of GenericAccessor.