in nubia/internal/helpers.py [0:0]
def get_arg_spec(function):
"""
Basic backport of python's 3 inspect.gefullargspec to python 2
"""
def set_default_value(dictionary, key, value):
if not dictionary.get(key, None):
dictionary[key] = value
if hasattr(inspect, "getfullargspec"):
argspec = inspect.getfullargspec(function)._asdict()
argspec["annotations"].update(getattr(function, "__annotations__", {}))
else:
argspec = inspect.getargspec(function)._asdict()
# python 3 renamed keywords for varkw
argspec["varkw"] = argspec.pop("keywords")
argspec["annotations"] = getattr(function, "__annotations__", None)
for field in ["args", "defaults", "kwonlyargs"]:
set_default_value(argspec, field, [])
for field in ["kwonlydefaults", "annotations"]:
set_default_value(argspec, field, {})
return FullArgSpec(**argspec)