hup.base.call module

Collection of helper functions for callables.

parameters(op: Callable, *args, **kwds) → collections.OrderedDict

Get parameters of a callable object.

Parameters:
  • op – Callable object
  • *args – Arbitrary arguments, that are zipped into the returned parameter dictionary.
  • **kwds – Arbitrary keyword arguments, that respectively - if declared within the callable object - are merged into the returned parameter dictionary. If the callable object allows a variable number of keyword arguments, all given keyword arguments are merged into the parameter dictionary.
Returns:

Ordered Dictionary containing all parameters.

Examples

>>> parameters(parameters)
OrderedDict()
>>> parameters(parameters, list)
OrderedDict([('operator', list)])
parse(text: str) → Tuple[str, tuple, dict]

Split a function call in the function name, it’s arguments and keywords.

Parameters:text – Function call given as valid Python code.
Returns:A tuple consisting of the function name as string, the arguments as tuple and the keywords as dictionary.
safe_call(f: Callable, *args, **kwds) → Any

Evaluate callable object for given parameters.

Evaluates a callable for the subset of given parameters, which is known to the callables signature.

Parameters:
  • f – Callable object
  • *args – Arbitrary arguments
  • **kwds – Arbitrary keyword arguments

Returns: