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

Class FakeShell

IPython/extensions/tests/test_autoreload.py:38–63  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

36noop = lambda *a, **kw: None
37
38class FakeShell:
39
40 def __init__(self):
41 self.ns = {}
42 self.user_ns = self.ns
43 self.user_ns_hidden = {}
44 self.events = EventManager(self, {'pre_run_cell', pre_run_cell})
45 self.auto_magics = AutoreloadMagics(shell=self)
46 self.events.register('pre_run_cell', self.auto_magics.pre_run_cell)
47
48 register_magics = set_hook = noop
49
50 def run_code(self, code):
51 self.events.trigger('pre_run_cell')
52 exec(code, self.user_ns)
53 self.auto_magics.post_execute_hook()
54
55 def push(self, items):
56 self.ns.update(items)
57
58 def magic_autoreload(self, parameter):
59 self.auto_magics.autoreload(parameter)
60
61 def magic_aimport(self, parameter, stream=None):
62 self.auto_magics.aimport(parameter, stream=stream)
63 self.auto_magics.post_execute_hook()
64
65
66class Fixture(TestCase):

Callers 1

setUpMethod · 0.85

Calls

no outgoing calls

Tested by 1

setUpMethod · 0.68