orkes.shared.get_instances_from_func#

orkes.shared.get_instances_from_func(func, state, target_class)[source]#

Retrieves all instances of a target class created within a function.

This function uses a trace to inspect the local variables of the given function and returns all instances of the target class.

Parameters:
  • func (Callable) – The function to inspect.

  • state – The state to pass to the function.

  • target_class (type) – The class to look for.

Returns:

A list of instances of the target class.

Return type:

list