Skip to content

Commit 0396dcc

Browse files
style: fix 3 ruff lint errors in video pipeline
- UP024: Replace `(OSError, IOError)` with `OSError` in video_setup.py - E402: Use existing `os` import instead of `import os as _os` in video_visual.py - SIM103: Inline condition in `_detect_gpu()` return statement Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 446f6a8 commit 0396dcc

File tree

2 files changed

+10
-15
lines changed

2 files changed

+10
-15
lines changed

src/skill_seekers/cli/video_setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ def _read_rocm_version() -> str:
229229
try:
230230
with open("/opt/rocm/.info/version") as f:
231231
return f.read().strip().split("-")[0]
232-
except (OSError, IOError):
232+
except OSError:
233233
return ""
234234

235235

src/skill_seekers/cli/video_visual.py

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,12 @@
3636
# Set ROCm/MIOpen env vars BEFORE importing torch (via easyocr).
3737
# Without MIOPEN_FIND_MODE=FAST, MIOpen tries to allocate huge workspace
3838
# buffers (300MB+), gets 0 bytes, and silently falls back to CPU kernels.
39-
import os as _os
40-
41-
if "MIOPEN_FIND_MODE" not in _os.environ:
42-
_os.environ["MIOPEN_FIND_MODE"] = "FAST"
43-
if "MIOPEN_USER_DB_PATH" not in _os.environ:
44-
_miopen_db = _os.path.expanduser("~/.config/miopen")
45-
_os.makedirs(_miopen_db, exist_ok=True)
46-
_os.environ["MIOPEN_USER_DB_PATH"] = _miopen_db
39+
if "MIOPEN_FIND_MODE" not in os.environ:
40+
os.environ["MIOPEN_FIND_MODE"] = "FAST"
41+
if "MIOPEN_USER_DB_PATH" not in os.environ:
42+
_miopen_db = os.path.expanduser("~/.config/miopen")
43+
os.makedirs(_miopen_db, exist_ok=True)
44+
os.environ["MIOPEN_USER_DB_PATH"] = _miopen_db
4745

4846
# Tier 2 dependency flags
4947
try:
@@ -98,12 +96,9 @@ def _detect_gpu() -> bool:
9896
try:
9997
import torch
10098

101-
if torch.cuda.is_available():
102-
return True
103-
# ROCm exposes GPU via torch.version.hip
104-
if hasattr(torch.version, "hip") and torch.version.hip is not None:
105-
return True
106-
return False
99+
return torch.cuda.is_available() or (
100+
hasattr(torch.version, "hip") and torch.version.hip is not None
101+
)
107102
except ImportError:
108103
return False
109104

0 commit comments

Comments
 (0)