arguments_utils.py
1 import inspect 2 3 4 def _get_arg_names(f): 5 """Get the argument names of a function. 6 7 Args: 8 f: A function. 9 10 Returns: 11 A list of argument names. 12 13 """ 14 # `inspect.getargspec` or `inspect.getfullargspec` doesn't work properly for a wrapped function. 15 # See https://hynek.me/articles/decorators#mangled-signatures for details. 16 return list(inspect.signature(f).parameters.keys())