(self, shell=None)
| 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: |
nothing calls this directly
no outgoing calls
no test coverage detected