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

Method _remove_old_python_env

mod/project/python/pyenv_tool.py:460–469  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

458
459 @staticmethod
460 def _remove_old_python_env():
461 try:
462 data = public.readFile("/etc/profile")
463 rep = re.compile(r'# +Start-Python-Env[^\n]*\n(export +PATH=".*")\n# +End-Python-Env')
464 rep2 = re.compile(r'# +Start-Python-Env[^\n]*\nif\s+\[ +-f[^\n]*\n# +End-Python-Env')
465 data = rep.sub("", data)
466 data = rep2.sub("", data)
467 public.writeFile("/etc/profile", data)
468 except:
469 pass
470
471 @classmethod
472 def set_profile_env(cls, pyenv: Optional["PythonEnvironment"]) -> Optional[str]:

Callers 1

set_profile_envMethod · 0.80

Calls 3

readFileMethod · 0.80
writeFileMethod · 0.80
subMethod · 0.45

Tested by

no test coverage detected