Refactor HVideoTool's configuration and project management: updated project handling in core/project.py, streamlined restoration settings in config.py, and improved documentation in CLAUDE.md. Removed unused parameters and enhanced type hints for better clarity.
This commit is contained in:
@@ -44,7 +44,7 @@ def _run_nvidia_smi() -> dict:
|
||||
out["gpus"].append(parts[0])
|
||||
if len(parts) > 1 and parts[1]:
|
||||
out["driver_version"] = parts[1]
|
||||
except Exception: # noqa: BLE001 - any failure => "not found"
|
||||
except Exception:
|
||||
return out
|
||||
# Max CUDA version the driver supports (only in the plain header).
|
||||
try:
|
||||
@@ -54,7 +54,7 @@ def _run_nvidia_smi() -> dict:
|
||||
m = re.search(r"CUDA Version:\s*([\d.]+)", r2.stdout)
|
||||
if m:
|
||||
out["cuda_driver"] = m.group(1)
|
||||
except Exception: # noqa: BLE001
|
||||
except Exception:
|
||||
pass
|
||||
return out
|
||||
|
||||
@@ -76,23 +76,23 @@ def gather() -> dict:
|
||||
}
|
||||
try:
|
||||
import torch
|
||||
except Exception as exc: # noqa: BLE001 - report any import failure
|
||||
except Exception as exc:
|
||||
info["import_error"] = str(exc)
|
||||
else:
|
||||
info["installed"] = True
|
||||
info["version"] = getattr(torch, "__version__", None)
|
||||
try:
|
||||
info["built_cuda"] = torch.version.cuda
|
||||
except Exception: # noqa: BLE001
|
||||
except Exception:
|
||||
info["built_cuda"] = None
|
||||
try:
|
||||
info["cuda_available"] = bool(torch.cuda.is_available())
|
||||
except Exception: # noqa: BLE001
|
||||
except Exception:
|
||||
info["cuda_available"] = False
|
||||
if info["cuda_available"]:
|
||||
try:
|
||||
info["device_name"] = torch.cuda.get_device_name(0)
|
||||
except Exception: # noqa: BLE001
|
||||
except Exception:
|
||||
info["device_name"] = None
|
||||
|
||||
smi = _run_nvidia_smi()
|
||||
@@ -103,10 +103,6 @@ def gather() -> dict:
|
||||
return info
|
||||
|
||||
|
||||
def device_label(info: dict) -> str:
|
||||
return "CUDA" if info.get("cuda_available") else "CPU"
|
||||
|
||||
|
||||
def _ver_tuple(v: str | None) -> tuple[int, ...]:
|
||||
try:
|
||||
return tuple(int(x) for x in str(v).split(".")[:2])
|
||||
|
||||
Reference in New Issue
Block a user