MCPcopy Create free account
hub / github.com/SunOner/sunone_aimbot / _python_probe

Function _python_probe

helper_api.py:192–214  ·  view source on GitHub ↗
(script: str, timeout: int = 30)

Source from the content-addressed store, hash-verified

190
191
192def _python_probe(script: str, timeout: int = 30) -> dict[str, Any]:
193 try:
194 result = subprocess.run(
195 [sys.executable, "-c", script],
196 cwd=PROJECT_DIR,
197 capture_output=True,
198 text=True,
199 timeout=timeout,
200 )
201 except (OSError, subprocess.TimeoutExpired) as exc:
202 return {"available": False, "error": str(exc)}
203
204 if result.returncode != 0:
205 return {"available": False, "error": (result.stderr or result.stdout).strip()}
206
207 output_lines = [line for line in result.stdout.splitlines() if line.strip()]
208 if not output_lines:
209 return {"available": False, "error": "Probe returned no output."}
210
211 try:
212 return json.loads(output_lines[-1])
213 except json.JSONDecodeError:
214 return {"available": False, "error": result.stdout.strip()}
215
216
217def _torch_info() -> dict[str, Any]:

Callers 3

_torch_infoFunction · 0.85
_tensorrt_infoFunction · 0.85
_ultralytics_versionFunction · 0.85

Calls 1

runMethod · 0.45

Tested by

no test coverage detected