MCPcopy Index your code
hub / github.com/prompt-toolkit/ptpython / eval

Method eval

src/ptpython/repl.py:200–208  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

198 # Create `eval` task. Ensure that control-c will cancel this
199 # task.
200 async def eval() -> Any:
201 nonlocal system_exit
202 try:
203 return await self.eval_async(text)
204 except SystemExit as e:
205 # Don't propagate SystemExit in `create_task()`. That
206 # will kill the event loop. We want to handle it
207 # gracefully.
208 system_exit = e
209
210 task = asyncio.create_task(eval())
211 loop.add_signal_handler(signal.SIGINT, lambda *_: task.cancel())

Callers 1

Calls 5

eval_asyncMethod · 0.95
_compile_with_flagsMethod · 0.95
_store_eval_resultMethod · 0.95
_has_coroutine_flagFunction · 0.85
get_globalsMethod · 0.80

Tested by

no test coverage detected