mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-07 22:04:48 +03:00
Merge 343b055ba7
into d404597e0b
This commit is contained in:
commit
11a1c5419b
|
@ -58,10 +58,18 @@ def is_simple_callable(obj):
|
|||
if not (function or method):
|
||||
return False
|
||||
|
||||
args, _, _, defaults = inspect.getargspec(obj)
|
||||
len_args = len(args) if function else len(args) - 1
|
||||
len_defaults = len(defaults) if defaults else 0
|
||||
return len_args <= len_defaults
|
||||
if six.PY2:
|
||||
args, _, _, defaults = inspect.getargspec(obj)
|
||||
len_args = len(args) if function else len(args) - 1
|
||||
len_defaults = len(defaults) if defaults else 0
|
||||
return len_args <= len_defaults
|
||||
else:
|
||||
sig = inspect.signature(obj)
|
||||
for name, param in sig.parameters.items():
|
||||
if param.default is not inspect.Parameter.empty:
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
|
||||
def get_attribute(instance, attrs):
|
||||
|
|
Loading…
Reference in New Issue
Block a user