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

Method __init__

IPython/core/builtin_trap.py:25–37  ·  view source on GitHub ↗
(self, shell=None)

Source from the content-addressed store, hash-verified

23 allow_none=True)
24
25 def __init__(self, shell=None):
26 super(BuiltinTrap, self).__init__(shell=shell, config=None)
27 self._orig_builtins = {}
28 # We define this to track if a single BuiltinTrap is nested.
29 # Only turn off the trap when the outermost call to __exit__ is made.
30 self._nested_level = 0
31 self.shell = shell
32 # builtins we always add - if set to HideBuiltin, they will just
33 # be removed instead of being replaced by something else
34 self.auto_builtins = {'exit': HideBuiltin,
35 'quit': HideBuiltin,
36 'get_ipython': self.shell.get_ipython,
37 }
38
39 def __enter__(self):
40 if self._nested_level == 0:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected