Note

This page is a reference documentation. It only explains the class signature, and not how to use it. Please refer to the user guide for the big picture.

brainprep.decorators.SignatureHook

class brainprep.decorators.SignatureHook[source]

Bases: Hook

Decorator that prints which function is called, its arguments and execution time.

Examples

>>> from brainprep.decorators import step, SignatureHook
>>> @step(
...     hooks=[SignatureHook()]
... )
... def add(a, b):
...     '''Adds two numbers.'''
...     return a + b
>>> result = add(3, 5) 
after_call(outputs)[source]

Display end information.

before_call(func, inputs)[source]

Display start information.

Parameters:
funcCallable

The function to be decorated.

inputsdict[str, Any]

Positional and keyword arguments passed to func.

Returns:
inputsdict[str, Any]

Unchanged positional and keyword arguments passed to func.