Skip to content

Commit

Permalink
Add support for decorative partial functions
Browse files Browse the repository at this point in the history
  • Loading branch information
dafu-wu committed Nov 24, 2022
1 parent b496c55 commit f2afbe8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/decorator.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import inspect
import operator
import itertools
import functools
from contextlib import _GeneratorContextManager
from inspect import getfullargspec, iscoroutinefunction, isgeneratorfunction

Expand Down Expand Up @@ -71,7 +72,7 @@ def __init__(self, func=None, name=None, signature=None,
self.name = '_lambda_'
self.doc = func.__doc__
self.module = func.__module__
if inspect.isroutine(func):
if inspect.isroutine(func) or isinstance(func, functools.partial):
argspec = getfullargspec(func)
self.annotations = getattr(func, '__annotations__', {})
for a in ('args', 'varargs', 'varkw', 'defaults', 'kwonlyargs',
Expand Down

0 comments on commit f2afbe8

Please sign in to comment.