Requires an active DSL preprocessor session.
(
self,
function_name: str,
original_function: Callable[..., Any],
code_object: types.CodeType,
exec_globals: dict[str, Any],
)
| 651 | self.exec_imports(import_info.finally_imports, exec_globals) |
| 652 | |
| 653 | def exec( |
| 654 | self, |
| 655 | function_name: str, |
| 656 | original_function: Callable[..., Any], |
| 657 | code_object: types.CodeType, |
| 658 | exec_globals: dict[str, Any], |
| 659 | ) -> Callable[..., Any] | None: |
| 660 | """Requires an active DSL preprocessor session.""" |
| 661 | # Get imports from the original module |
| 662 | module_imports = self._get_module_imports(original_function) |
| 663 | |
| 664 | # Import all required modules |
| 665 | self.exec_imports(module_imports, exec_globals) |
| 666 | |
| 667 | # Execute the transformed code |
| 668 | log().info( |
| 669 | "ASTPreprocessor Executing transformed code for function [%s]", |
| 670 | function_name, |
| 671 | ) |
| 672 | exec(code_object, exec_globals) |
| 673 | return exec_globals.get(function_name) |
| 674 | |
| 675 | @staticmethod |
| 676 | def print_ast(transformed_tree: ast.AST | None = None) -> None: |