silo.low_code.framework.action_inspection module

This module allows inspection of a function prior to execution. It allows a step developer to request only the information they need to minimize overloading the ResultContainer and having “unused” arguments in their function signature.

The inspection works for BaseClasses, functions, and typechecked functions. It may work with some decorated functions based on how the arguments are referenced or if the attribute, ch_func, is set.

silo.low_code.framework.action_inspection.execute_action(action, available_params)

Inspect, Validate, and Execute the function

Given a function and a dictionary of possible argument names, inspect the original function signature, and call the function with the arguments the developer specified in the function signature. This allows the step developer to specify a number of different arguments that will be supplied at runtime.

The known-supported functions that can be executed by execute_action are as follows:

  • All class functions

  • All non-wrapped functions

  • Wrapped @typechecked functions

Other wrapped functions can be used if the function utilizes the correct argument names in the wrapped signature. If the wrapped function utilizes invalid arguments or uses *args or **kw the function will not be able to be inspected and will produce an error. This can be solved by setting the attribute ch_func to the original function. This allows for the correct arguments to be extracted for execution.

def decorated(func):
    def wrapped(*args, **kwargs):
        return func(*args, **kwargs)

    wrapped.ch_func = func
    return wrapped
Parameters
  • action (callable) – Action to execute

  • available_params (dict) – Available parameters for the function

Returns

Result of the execution

Return type

object