Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7a6d44d

Browse files
tacaswelljankatins
authored andcommitted
MNT: make boilerplate.py a bit smarter
Check if there is a `__wrapped__` attribute and if there is use that for the to extract the signature from.
1 parent a0c738e commit 7a6d44d

2 files changed

Lines changed: 211 additions & 92 deletions

File tree

boilerplate.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,12 @@ def format_value(value):
209209
mappable = ''
210210

211211
# Get argspec of wrapped function
212-
args, varargs, varkw, defaults = inspect.getargspec(getattr(Axes, func))
212+
work_func = getattr(Axes, func)
213+
if hasattr(work_func, '__wrapped__'):
214+
work_func = work_func.__wrapped__
215+
216+
args, varargs, varkw, defaults = inspect.getargspec(work_func)
217+
213218
args.pop(0) # remove 'self' argument
214219
if defaults is None:
215220
defaults = ()

0 commit comments

Comments
 (0)