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

Method from_dict

mod/project/python/pyenv_tool.py:159–176  ·  view source on GitHub ↗
(cls, data: Dict)

Source from the content-addressed store, hash-verified

157
158 @classmethod
159 def from_dict(cls, data: Dict) -> Optional["PythonEnvironment"]:
160 if not isinstance(data, dict):
161 return None
162 try:
163 return cls(
164 data["bin_path"],
165 data["version"],
166 data["type"],
167 conda_path=data.get("conda_path"),
168 venv_name=data.get("venv_name"),
169 activate_sh=data.get("activate_sh"),
170 system_path=data.get("system_path"),
171 ps=data.get("ps"),
172 site_packages=data.get("site_packages"),
173 )
174 except Exception as e:
175 # print("PythonEnvironment.from_dict error: {}".format(str(e)))
176 return None
177
178 def create_venv(self, env_path: str, ps: str = "") -> Optional[str]:
179 if self.env_type != "system":

Callers 1

all_envMethod · 0.45

Calls 1

getMethod · 0.45

Tested by

no test coverage detected