This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def optional_arg_decorator(fn): | |
""" | |
wrap a decorator so that it can optionally take args/kwargs | |
when decorating a func | |
""" | |
# http://stackoverflow.com/a/32292739/2156113 | |
@wraps(fn) | |
def wrapped_decorator(*args, **kwargs): | |
is_bound_method = args and hasattr(args[0], fn.__name__) |
OlderNewer