Currently, it can only be
@timer()
def my_func():
pass
But, the following code is expected to run but fail:
@timer
def my_func():
pass
An fix can be easily done to decorator definition by
def example2(_func=None, *, kw1=val1, kw2=val2):
if _func is None:
return functools.partials(example2, kw1=val1, kw2=kw2)
@functools.wraps(func)
def wrapper(*args, **kwargs):
# do things with kw1
return func(*args, **kwargs)
return wrapper
I am willing to make a PR if it is needed.
Currently, it can only be
But, the following code is expected to run but fail:
An fix can be easily done to decorator definition by
I am willing to make a PR if it is needed.