MCPcopy Create free account
hub / github.com/ipython/ipython / InteractiveShell

Class InteractiveShell

IPython/core/interactiveshell.py:339–3793  ·  view source on GitHub ↗

An enhanced, interactive shell for Python.

Source from the content-addressed store, hash-verified

337
338
339class InteractiveShell(SingletonConfigurable):
340 """An enhanced, interactive shell for Python."""
341
342 _instance = None
343
344 ast_transformers = List([], help=
345 """
346 A list of ast.NodeTransformer subclass instances, which will be applied
347 to user input before code is run.
348 """
349 ).tag(config=True)
350
351 autocall = Enum((0,1,2), default_value=0, help=
352 """
353 Make IPython automatically call any callable object even if you didn't
354 type explicit parentheses. For example, 'str 43' becomes 'str(43)'
355 automatically. The value can be '0' to disable the feature, '1' for
356 'smart' autocall, where it is not applied if there are no more
357 arguments on the line, and '2' for 'full' autocall, where all callable
358 objects are automatically called (even if no arguments are present).
359 """
360 ).tag(config=True)
361
362 autoindent = Bool(True, help=
363 """
364 Autoindent IPython code entered interactively.
365 """
366 ).tag(config=True)
367
368 autoawait = Bool(True, help=
369 """
370 Automatically run await statement in the top level repl.
371 """
372 ).tag(config=True)
373
374 loop_runner_map ={
375 'asyncio':(_asyncio_runner, True),
376 'curio':(_curio_runner, True),
377 'trio':(_trio_runner, True),
378 'sync': (_pseudo_sync_runner, False)
379 }
380
381 loop_runner = Any(default_value="IPython.core.interactiveshell._asyncio_runner",
382 allow_none=True,
383 help="""Select the loop runner that will be used to execute top-level asynchronous code"""
384 ).tag(config=True)
385
386 @default('loop_runner')
387 def _default_loop_runner(self):
388 return import_item("IPython.core.interactiveshell._asyncio_runner")
389
390 @validate('loop_runner')
391 def _import_runner(self, proposal):
392 if isinstance(proposal.value, str):
393 if proposal.value in self.loop_runner_map:
394 runner, autoawait = self.loop_runner_map[proposal.value]
395 self.autoawait = autoawait
396 return runner

Callers

nothing calls this directly

Calls 1

SeparateUnicodeClass · 0.85

Tested by

no test coverage detected