diff --git a/usb_device.py b/usb_device.py index 691f85c..78baf4e 100644 --- a/usb_device.py +++ b/usb_device.py @@ -7,8 +7,11 @@ - USBDeviceManager: Manager class for device enumeration and lookup """ +# ruff: disable[I001,UP045] + import logging import re +from typing import Optional import usb.core import usb.util @@ -361,7 +364,7 @@ def list_devices(self) -> list[USBDevice]: devices = usb.core.find(find_all=True) return [USBDevice(device) for device in devices] - def find_by_bus_id(self, bus_id: str) -> "USBDevice" | None: + def find_by_bus_id(self, bus_id: str) -> Optional["USBDevice"]: """Find a device by its bus ID. Args: @@ -397,8 +400,8 @@ def find_by_identity( self, vendor_id: int, product_id: int, - serial_number: str | None = None, - ) -> "USBDevice" | None: + serial_number: Optional[str] = None, + ) -> Optional["USBDevice"]: """Find a device by VID, PID, and optionally serial number. Args: @@ -428,7 +431,7 @@ def find_by_identity( return None - def find_by_binding(self, binding: dict[str, str]) -> "USBDevice" | None: + def find_by_binding(self, binding: dict[str, str]) -> Optional["USBDevice"]: """Find a device that matches a binding configuration. The binding dictionary should contain 'vendor_id', 'product_id',