require decorator

This commit is contained in:
Damien Elmes 2017-07-17 13:18:56 +10:00
parent dffab1376f
commit 9df1947e41

View file

@ -13,13 +13,7 @@ If you call wrap() with pos='around', the original function will not be called
automatically but can be called with _old(). automatically but can be called with _old().
""" """
import functools import decorator
try:
# optional: like functools.wraps, but signature-preserving
import decorator
except ImportError:
decorator = None
# Hooks # Hooks
############################################################################## ##############################################################################
@ -68,9 +62,6 @@ def wrap(old, new, pos="after"):
else: else:
return new(_old=old, *args, **kwargs) return new(_old=old, *args, **kwargs)
if decorator is None:
return functools.wraps(repl)
def decorator_wrapper(f, *args, **kwargs): def decorator_wrapper(f, *args, **kwargs):
return repl(*args, **kwargs) return repl(*args, **kwargs)