1
0
mirror of https://github.com/django/django.git synced 2025-11-07 07:15:35 +00:00

Fixed #35179 -- Made admindocs detect positional/keyword-only arguments.

This commit is contained in:
Salvo Polizzi
2024-02-10 17:50:55 +01:00
committed by Mariusz Felisiak
parent bf692b2fdc
commit e6fa74f020
3 changed files with 11 additions and 3 deletions

View File

@@ -68,9 +68,7 @@ def func_accepts_var_args(func):
def method_has_no_args(meth):
"""Return True if a method only accepts 'self'."""
count = len(
[p for p in _get_callable_parameters(meth) if p.kind == p.POSITIONAL_OR_KEYWORD]
)
count = len([p for p in _get_callable_parameters(meth) if p.kind in ARG_KINDS])
return count == 0 if inspect.ismethod(meth) else count == 1