Skip to content

Commit 79e59f4

Browse files
Use signature instead of getfullargspec
Using signature allows the validation to get to the root function when a function is decorated. This reduced a significant amount of the errors in the string.py file
1 parent b1c3a90 commit 79e59f4

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

scripts/validate_docstrings.py

+10-6
Original file line numberDiff line numberDiff line change
@@ -436,16 +436,20 @@ def signature_parameters(self):
436436
# accessor classes have a signature but don't want to show this
437437
return tuple()
438438
try:
439-
sig = inspect.getfullargspec(self.obj)
439+
sig = inspect.signature(self.obj)
440440
except (TypeError, ValueError):
441441
# Some objects, mainly in C extensions do not support introspection
442442
# of the signature
443443
return tuple()
444-
params = sig.args
445-
if sig.varargs:
446-
params.append("*" + sig.varargs)
447-
if sig.varkw:
448-
params.append("**" + sig.varkw)
444+
params = list()
445+
for parameter, data in sig.parameters.items():
446+
if data.kind == inspect.Parameter.VAR_POSITIONAL:
447+
params.append("*" + parameter)
448+
elif data.kind == inspect.Parameter.VAR_KEYWORD:
449+
params.append("**" + parameter)
450+
else:
451+
params.append(parameter)
452+
449453
params = tuple(params)
450454
if params and params[0] in ("self", "cls"):
451455
return params[1:]

0 commit comments

Comments
 (0)