dynamic_executor.utils package

Submodules

dynamic_executor.utils.DynamicModeExecutor module

class dynamic_executor.utils.DynamicModeExecutor.DynamicModeExecutor(executor_path: Path = PosixPath('executor.py'), finish_upon_success: bool = True, supress_print: bool = False)[source]

Bases: object

A main component of dynamic execution loop. Creates executor file with access to local and global variables where code can be safely executed.

for error in DynamicModeExecutor().execute(locals(), globals()):

pass

With each iteration modules are reloaded and the changes applied to DynamicClass instances.

execute(local_vars: Dict, global_vars: Dict, executor_path: Path = None, finish_upon_success: bool = None, supress_print: bool = None) Generator[str, None, None][source]

Method used to override class parameters and accept local and global parameters.

Parameters:
  • local_vars – local variables that can be a subject to change usually locals().

  • global_vars – global variables that can be a subject to change usually global().

  • executor_path – A path to an executor file, defaults to one in self.

  • finish_upon_success – Specifies if there should be any iterations after a successful execution. Defaults to a value in self.

  • supress_print – Manages exception printing. If True exception is printed as if it occurred during an uncontrolled runtime. Exception is always yielded by loop not matter the argument.

Returns:

Error message if one occurred during execution. None otherwise.

dynamic_executor.utils.get_dynamic_classes module

dynamic_executor.utils.get_modules module

dynamic_executor.utils.re_import module

Module contents