OptionalArgDecorator

class odl.util.vectorization.OptionalArgDecorator(*args, **kwargs)[source]

Bases: object

Abstract class to create decorators with optional arguments.

This class implements the functionality of a decorator that can be used with and without arguments, i.e. the following patterns both work:

@decorator
def myfunc(x, *args, **kwargs):
    pass

@decorator(param, **dec_kwargs)
def myfunc(x, *args, **kwargs):
    pass

The arguments to the decorator are passed on to the underlying wrapper.

To use this class, subclass it and implement the static _wrapper method.

__init__(self, /, \*args, \*\*kwargs)

Initialize self. See help(type(self)) for accurate signature.