bokeh.application.handlers.code_runner#
Provide a utility class CodeRunner
for use by handlers that execute
Python source code.
- class CodeRunner(source: str, path: PathLike, argv: list[str], package: ModuleType | None = None)[source]#
Compile and run Python source code.
- __init__(source: str, path: PathLike, argv: list[str], package: ModuleType | None = None) None [source]#
- Parameters:
- Raises:
ValueError, if package is specified for an __init__.py –
- reset_run_errors() None [source]#
Clears any transient error conditions from a previous run.
- Returns
None
- run(module: ModuleType, post_check: Callable[[], None] | None = None) None [source]#
Execute the configured source code in a module and run any post checks.
- Parameters:
module (Module) – A module to execute the configured code in.
post_check (callable, optional) – A function that raises an exception if expected post-conditions are not met after code execution.