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

Method create

Lib/test/test_site.py:418–438  ·  view source on GitHub ↗

Create a .pth file with a comment, blank lines, an ``import ``, a line with self.good_dirname, and a line with self.bad_dirname. Creation of the directory for self.good_dir_path (based off of self.good_dirname) is also performed. Make sure to

(self)

Source from the content-addressed store, hash-verified

416 self.bad_dir_path = os.path.join(self.base_dir, self.bad_dirname)
417
418 def create(self):
419 """Create a .pth file with a comment, blank lines, an ``import
420 <self.imported>``, a line with self.good_dirname, and a line with
421 self.bad_dirname.
422
423 Creation of the directory for self.good_dir_path (based off of
424 self.good_dirname) is also performed.
425
426 Make sure to call self.cleanup() to undo anything done by this method.
427
428 """
429 FILE = open(self.file_path, 'w')
430 try:
431 print("#import @bad module name", file=FILE)
432 print("\n", file=FILE)
433 print("import %s" % self.imported, file=FILE)
434 print(self.good_dirname, file=FILE)
435 print(self.bad_dirname, file=FILE)
436 finally:
437 FILE.close()
438 os.mkdir(self.good_dir_path)
439
440 def cleanup(self, prep=False):
441 """Make sure that the .pth file is deleted, self.imported is not in

Callers 15

test_addpackageMethod · 0.95
test_addsitedirMethod · 0.95
__init__Method · 0.45
geFunction · 0.45
ZuFunction · 0.45
d3.min.jsFile · 0.45
anFunction · 0.45
JtFunction · 0.45

Calls 3

openFunction · 0.50
closeMethod · 0.45
mkdirMethod · 0.45

Tested by

no test coverage detected