MCPcopy Create free account
hub / github.com/ContinuumIO/tranquilizer / parse

Method parse

tranquilizer/handler.py:50–62  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

48 self.fn = fn
49
50 def parse(self):
51 from nbconvert import ScriptExporter
52
53 exporter = ScriptExporter()
54 source, _ = exporter.from_filename(self.fn)
55
56 self.nodes = ast.parse(source, self.fn)
57
58 delete = False if platform.startswith('win') else True
59 with tempfile.NamedTemporaryFile(mode='w', dir=dirname(self.fn), delete=delete) as tmp:
60 tmp.write(source)
61 tmp.flush()
62 self.module = run_path(tmp.name, init_globals={'get_ipython': MagicMock()})

Callers 2

test_nb_parserFunction · 0.95
test_tranquilized_nbFunction · 0.95

Calls 1

parseMethod · 0.45

Tested by 2

test_nb_parserFunction · 0.76
test_tranquilized_nbFunction · 0.76