Function find_arguments

Synopsis

def find_arguments(callable_)

Description

Returns the arguments and required arguments for a function/class

Source

Lines 116-127 in anyfig/figutils.py.

def find_arguments(callable_):
  ''' Returns the arguments and required arguments for a function/class'''
  parameters = dict(inspect.signature(callable_).parameters)
  parameters.pop('self', None)  # Remove self argument

  required_args = [
    name for name, param in parameters.items()
    if param.default == inspect.Parameter.empty
  ]
  return list(parameters), required_args







Add Discussion as Guest

Log in