mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 22:12:21 -04:00
require decorator
This commit is contained in:
parent
dffab1376f
commit
9df1947e41
1 changed files with 1 additions and 10 deletions
|
@ -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
|
|
||||||
|
|
||||||
try:
|
|
||||||
# optional: like functools.wraps, but signature-preserving
|
|
||||||
import decorator
|
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)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue