Skip to content

Commit 96730ec

Browse files
mrosseelclaude
andcommitted
fix: resolve lint and mypy errors in sys_utils_nixos.py
- Fix E402 lint: reorder gi imports, add noqa for gi.repository - Fix Python 3.10 syntax: dict | None → Optional[dict] - Fix utils.pifinder_home → utils.home_dir / "PiFinder" - Add dbus/gi to mypy ignore list (no type stubs available) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent b9668fa commit 96730ec

2 files changed

Lines changed: 10 additions & 5 deletions

File tree

python/PiFinder/sys_utils_nixos.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,18 @@
1616
import zipfile
1717
import logging
1818
from pathlib import Path
19+
from typing import Optional
1920

2021
import requests
2122

2223
import dbus
2324
import pam
25+
from PiFinder import utils
26+
2427
import gi
2528

2629
gi.require_version("NM", "1.0")
27-
from gi.repository import GLib, NM
28-
29-
from PiFinder import utils
30+
from gi.repository import GLib, NM # noqa: E402
3031

3132
BACKUP_PATH = str(utils.data_dir / "PiFinder_backup.zip")
3233
AP_CONNECTION_NAME = "PiFinder-AP"
@@ -424,7 +425,7 @@ def shutdown() -> None:
424425
UPGRADE_REF_FILE = Path("/run/pifinder/upgrade-ref")
425426

426427

427-
def fetch_version_manifest() -> dict | None:
428+
def fetch_version_manifest() -> Optional[dict]:
428429
"""Fetch the channel/version manifest from GitHub."""
429430
try:
430431
resp = requests.get(VERSIONS_URL, timeout=10)
@@ -542,7 +543,7 @@ def switch_camera(cam_type: str) -> None:
542543
Requires reboot (dtoverlay change).
543544
"""
544545
logger.info("SYS: Switching camera to %s via nixos-rebuild", cam_type)
545-
flake_path = str(utils.pifinder_home)
546+
flake_path = str(utils.home_dir / "PiFinder")
546547
result = _run([
547548
"sudo", "nixos-rebuild", "switch",
548549
"--flake", f"{flake_path}#pifinder-{cam_type}",

python/pyproject.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,10 @@ module = [
137137
'picamera2',
138138
'bottle',
139139
'libinput',
140+
'dbus',
141+
'gi',
142+
'gi.repository',
143+
'gi.repository.*',
140144
]
141145
ignore_missing_imports = true
142146
ignore_errors = true

0 commit comments

Comments
 (0)