inspect.formatargvalues()

inspect.formatargvalues(args[, varargs, varkw, locals, formatarg, formatvarargs, formatvarkw, formatvalue]) Format a pretty argument spec from the four values returned by getargvalues(). The format* arguments are the corresponding optional formatting functions that are called to turn names and values into strings. Deprecated since version 3.5: Use signature() and Signature Object, which provide a better introspecting API for callables.

inspect.formatargspec()

inspect.formatargspec(args[, varargs, varkw, defaults, kwonlyargs, kwonlydefaults, annotations[, formatarg, formatvarargs, formatvarkw, formatvalue, formatreturns, formatannotations]]) Format a pretty argument spec from the values returned by getargspec() or getfullargspec(). The first seven arguments are (args, varargs, varkw, defaults, kwonlyargs, kwonlydefaults, annotations). The other six arguments are functions that are called to turn argument names, * argument name, ** argument name, d

inspect.cleandoc()

inspect.cleandoc(doc) Clean up indentation from docstrings that are indented to line up with blocks of code. All leading whitespace is removed from the first line. Any leading whitespace that can be uniformly removed from the second line onwards is removed. Empty lines at the beginning and end are subsequently removed. Also, all tabs are expanded to spaces.

inspect.BoundArguments.signature

signature A reference to the parent Signature object.

inspect.BoundArguments.kwargs

kwargs A dict of keyword arguments values. Dynamically computed from the arguments attribute.

inspect.currentframe()

inspect.currentframe() Return the frame object for the caller’s stack frame. CPython implementation detail: This function relies on Python stack frame support in the interpreter, which isn’t guaranteed to exist in all implementations of Python. If running in an implementation without Python stack frame support this function returns None.

inspect.BoundArguments.args

args A tuple of positional arguments values. Dynamically computed from the arguments attribute.

inspect.BoundArguments.arguments

arguments An ordered, mutable mapping (collections.OrderedDict) of parameters’ names to arguments’ values. Contains only explicitly bound arguments. Changes in arguments will reflect in args and kwargs. Should be used in conjunction with Signature.parameters for any argument processing purposes. Note Arguments for which Signature.bind() or Signature.bind_partial() relied on a default value are skipped. However, if needed, use BoundArguments.apply_defaults() to add them.

inspect.BoundArguments.apply_defaults()

apply_defaults() Set default values for missing arguments. For variable-positional arguments (*args) the default is an empty tuple. For variable-keyword arguments (**kwargs) the default is an empty dict. >>> def foo(a, b='ham', *args): pass >>> ba = inspect.signature(foo).bind('spam') >>> ba.apply_defaults() >>> ba.arguments OrderedDict([('a', 'spam'), ('b', 'ham'), ('args', ())]) New in version 3.5.

inspect.BoundArguments

class inspect.BoundArguments Result of a Signature.bind() or Signature.bind_partial() call. Holds the mapping of arguments to the function’s parameters. arguments An ordered, mutable mapping (collections.OrderedDict) of parameters’ names to arguments’ values. Contains only explicitly bound arguments. Changes in arguments will reflect in args and kwargs. Should be used in conjunction with Signature.parameters for any argument processing purposes. Note Arguments for which Signature.bind()