fix python errors
C++ / fmt (pull_request) Successful in 10s
JS/TS / fmt (pull_request) Successful in 15s
JS/TS / lint (pull_request) Successful in 15s
Python / static (pull_request) Successful in 53s
Rust / fmt (pull_request) Successful in 1m6s
Rust / build (pull_request) Successful in 2m10s
C++ / build (pull_request) Successful in 2m37s
Rust / clippy (pull_request) Successful in 1m33s
Python / verify (pull_request) Successful in 2m53s
C++ / clang-tidy (pull_request) Successful in 3m59s

This commit is contained in:
2026-08-16 13:11:17 +02:00
parent bfaba488f3
commit 33c9432390
+9 -12
View File
@@ -255,7 +255,7 @@ def _start_hotplug_watcher(on_hotplug: Callable[[], None]):
return None
debounce_lock = threading.Lock()
debounce_state = {"timer": None}
debounce_state: dict[str, threading.Timer | None] = {"timer": None}
DEBOUNCE_SECONDS = 0.5
def _fire():
@@ -381,6 +381,7 @@ class _ListenerRegistry:
continue
listener = ListenerClass(obj, self._touch_and_notify)
to_join = None
if obj.isDevice:
ident = None
@@ -476,7 +477,7 @@ class _ListenerRegistry:
"device" if dev_info.isDevice else "receiver",
)
if "to_join" in locals():
if to_join is not None:
try:
to_join.join(timeout=1.0)
except Exception:
@@ -565,9 +566,13 @@ def _iter_open_devices():
for dev_info in base.receivers_and_devices():
try:
if dev_info.isDevice:
d = device.create_device(base, dev_info)
d = device.create_device(base, dev_info) # pyright: ignore[reportArgumentType]
if d is not None:
yield d
else:
d = receiver.create_receiver(base, dev_info)
d = receiver.create_receiver(base, dev_info) # pyright: ignore[reportArgumentType]
if d is not None:
yield from d
except OSError as e:
if e.errno == 13:
logger.error(
@@ -583,14 +588,6 @@ def _iter_open_devices():
logger.exception("failed opening %s", dev_info)
continue
if d is None:
continue
if d.isDevice:
yield d
else:
yield from d
def _to_device_battery(dev, battery) -> DeviceBattery | None:
if battery is None: