17
0
Files
python-django-rest-framewor…/pr_34.patch

25 lines
860 B
Diff

commit 904b1c4032ce7e3b695ffb122a219a8c07f06fe9
Author: John Vandenberg <jayvdb@gmail.com>
Date: Sun May 15 09:28:54 2022 +0800
find_function_args: Include spec.kwonlyargs
Fixes https://github.com/dealertrack/django-rest-framework-braces/issues/32
diff --git a/drf_braces/utils.py b/drf_braces/utils.py
index 6730c17..e6323e5 100644
--- a/drf_braces/utils.py
+++ b/drf_braces/utils.py
@@ -12,7 +12,10 @@ def find_function_args(func):
"""
try:
spec = inspect.getfullargspec(func) if hasattr(inspect, 'getfullargspec') else inspect.getargspec(func)
- return [i for i in spec[0] if i not in IGNORE_ARGS]
+ arg_list = spec[0]
+ if hasattr(spec, 'kwonlyargs'):
+ arg_list += spec.kwonlyargs
+ return [i for i in arg_list if i not in IGNORE_ARGS]
except TypeError:
return []