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

Function create_package

Lib/test/test_modulefinder.py:312–328  ·  view source on GitHub ↗
(test_dir, source)

Source from the content-addressed store, hash-verified

310
311
312def create_package(test_dir, source):
313 ofi = None
314 try:
315 for line in source.splitlines():
316 if type(line) != bytes:
317 line = line.encode('utf-8')
318 if line.startswith(b' ') or line.startswith(b'\t'):
319 ofi.write(line.strip() + b'\n')
320 else:
321 if ofi:
322 ofi.close()
323 if type(line) == bytes:
324 line = line.decode('utf-8')
325 ofi = open_file(os.path.join(test_dir, line.strip()))
326 finally:
327 if ofi:
328 ofi.close()
329
330class ModuleFinderTest(unittest.TestCase):
331 def setUp(self):

Callers 1

_do_testMethod · 0.70

Calls 9

open_fileFunction · 0.85
splitlinesMethod · 0.45
encodeMethod · 0.45
startswithMethod · 0.45
writeMethod · 0.45
stripMethod · 0.45
closeMethod · 0.45
decodeMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…