MCPcopy Index your code
hub / github.com/RustPython/RustPython / make_module

Method make_module

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

Source from the content-addressed store, hash-verified

4409 self.assertIn("bluch", actual)
4410
4411 def make_module(self, code):
4412 tmpdir = Path(tempfile.mkdtemp())
4413 self.addCleanup(shutil.rmtree, tmpdir)
4414
4415 sys.path.append(str(tmpdir))
4416 self.addCleanup(sys.path.pop)
4417
4418 mod_name = ''.join(random.choices(string.ascii_letters, k=16))
4419 module = tmpdir / (mod_name + ".py")
4420 module.write_text(code)
4421
4422 return mod_name
4423
4424 def get_import_from_suggestion(self, code, name):
4425 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