MCPcopy Index your code
hub / github.com/python/cpython / make_module

Method make_module

Lib/test/test_traceback.py:4567–4578  ·  view source on GitHub ↗
(self, code)

Source from the content-addressed store, hash-verified

4565 self.assertIn("'.normal.target'", actual)
4566
4567 def make_module(self, code):
4568 tmpdir = Path(tempfile.mkdtemp())
4569 self.addCleanup(shutil.rmtree, tmpdir)
4570
4571 sys.path.append(str(tmpdir))
4572 self.addCleanup(sys.path.pop)
4573
4574 mod_name = ''.join(random.choices(string.ascii_letters, k=16))
4575 module = tmpdir / (mod_name + ".py")
4576 module.write_text(code)
4577
4578 return mod_name
4579
4580 def get_import_from_suggestion(self, code, name):
4581 modname = self.make_module(code)

Callers 1

Calls 8

PathClass · 0.90
strFunction · 0.85
mkdtempMethod · 0.80
addCleanupMethod · 0.80
choicesMethod · 0.80
appendMethod · 0.45
joinMethod · 0.45
write_textMethod · 0.45

Tested by

no test coverage detected