MCPcopy Create free account
hub / github.com/aaPanel/BaoTa / use2project

Method use2project

mod/project/python/pyenv_tool.py:553–573  ·  view source on GitHub ↗
(self, project_name: str)

Source from the content-addressed store, hash-verified

551 return bin_path
552
553 def use2project(self, project_name: str):
554 if not project_name:
555 return
556 with open(self.project_to_pyenv_map_file, "r+") as f:
557 home = os.path.dirname(os.path.dirname(self.bin_path))
558 for i in _SYS_BIN_PATH:
559 if self.bin_path.startswith(i):
560 home = i
561 break
562 data = f.read()
563
564 lines = data.split("\n")
565 for i, line in enumerate(lines):
566 if line.startswith(project_name + ":"):
567 lines[i] = "{}:{}".format(project_name, home)
568 break
569 else:
570 lines.append("{}:{}".format(project_name, home))
571 f.seek(0)
572 f.truncate()
573 f.write("\n".join(lines))
574
575
576class _EnvironmentDetector:

Callers 2

simple_prep_envMethod · 0.80
get_active_shellMethod · 0.80

Calls 9

openFunction · 0.85
dirnameMethod · 0.80
seekMethod · 0.80
readMethod · 0.45
splitMethod · 0.45
formatMethod · 0.45
appendMethod · 0.45
writeMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected