INNER CODE UNIT · Python

execute

iamgreggarcia/codesherpa · executors/executor.py:22

    def execute(self, code: str) -> str:
        pass


class PythonExecutor(Executor):
    locals = {}

    def execute(self, code: str) -> str:
        logger.info("Executing Python code: {}", code)
        output = io.StringIO()

        # Parse the code into an AST.
        tree = ast.parse(code, mode="exec")

        try:
            # Redirect standard output to our StringIO instance.
            with redirect_stdout(output):
                for node in tree.body:

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…