Skip to content

Commit

Permalink
Install decorator version 5.0.9
Browse files Browse the repository at this point in the history
  • Loading branch information
h3llrais3r committed Jul 28, 2021
1 parent fd982c1 commit 918097b
Showing 1 changed file with 24 additions and 7 deletions.
31 changes: 24 additions & 7 deletions lib/decorator.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
from contextlib import _GeneratorContextManager
from inspect import getfullargspec, iscoroutinefunction, isgeneratorfunction

__version__ = '5.0.6'
__version__ = '5.0.9'

DEF = re.compile(r'\s*def\s*([_\w][_\w\d]*)\s*\(')
POS = inspect.Parameter.POSITIONAL_OR_KEYWORD
Expand Down Expand Up @@ -201,6 +201,7 @@ def fix(args, kwargs, sig):
Fix args and kwargs to be consistent with the signature
"""
ba = sig.bind(*args, **kwargs)
ba.apply_defaults() # needed for test_dan_schult
return ba.args, ba.kwargs


Expand Down Expand Up @@ -231,14 +232,30 @@ def fun(*args, **kw):
return caller(func, *(extras + args), **kw)
fun.__name__ = func.__name__
fun.__doc__ = func.__doc__
fun.__defaults__ = func.__defaults__
fun.__kwdefaults__ = func.__kwdefaults__
fun.__annotations__ = func.__annotations__
fun.__module__ = func.__module__
fun.__signature__ = sig
fun.__wrapped__ = func
fun.__signature__ = sig
fun.__qualname__ = func.__qualname__
fun.__dict__.update(func.__dict__)
# builtin functions like defaultdict.__setitem__ lack many attributes
try:
fun.__defaults__ = func.__defaults__
except AttributeError:
pass
try:
fun.__kwdefaults__ = func.__kwdefaults__
except AttributeError:
pass
try:
fun.__annotations__ = func.__annotations__
except AttributeError:
pass
try:
fun.__module__ = func.__module__
except AttributeError:
pass
try:
fun.__dict__.update(func.__dict__)
except AttributeError:
pass
return fun


Expand Down

0 comments on commit 918097b

Please sign in to comment.