MCPcopy
hub / github.com/hylang/hy / ast_callback

Method ast_callback

hy/repl.py:307–321  ·  view source on GitHub ↗
(self, exec_ast, eval_ast)

Source from the content-addressed store, hash-verified

305 self.ast_callback(exec_ast, None)
306
307 def ast_callback(self, exec_ast, eval_ast):
308 if self.spy:
309 try:
310 # Mush the two AST chunks into a single module for
311 # conversion into Python.
312 new_ast = ast.Module(
313 exec_ast.body
314 + ([] if eval_ast is None else [ast.Expr(eval_ast.body)]),
315 type_ignores=[],
316 )
317 print(ast.unparse(new_ast))
318 print(self.spy_delimiter)
319 except Exception:
320 msg = "Exception in AST callback:\n{}\n".format(traceback.format_exc())
321 self.write(msg)
322
323 def _error_wrap(self, exc_info_override=False, *args, **kwargs):
324 # When `exc_info_override` is true, use a traceback that

Callers 2

__init__Method · 0.95
__call__Method · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected