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.Hook¶
- class brainprep.decorators.Hook[source]¶
Bases:
objectBase class for decorator hooks.
Hooks used with the decorator must inherit from this class and and optionally override
before_callandafter_callmethods. These methods act as hooks that run before and after the wrapped function is executed.By default, both methods implement pass-through behavior:
before_callreturns the inputs unchanged, andafter_callreturns the outputs unchanged.Methods
before_call(func, inputs)
Hook executed before the wrapped function is called. Must return a dictionary of (possibly modified) inputs.
after_call(func, outputs)
Hook executed after the wrapped function returns. Must return the (possibly modified) output value.
Notes
Subclasses may override one or both methods. If a method is not overridden, the default implementation simply returns its argument unchanged.