From 8ae066ea8b6bcc21a2e47f0be4440e78f4055980 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Elio=20Petten=C3=B2?= Date: Sat, 17 Dec 2022 14:30:40 +0000 Subject: Add the handle_ attribute typing to the class. This makes sure that the import of BinaryIO is actually used in the code itself. --- glucometerutils/support/hiddevice.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/glucometerutils/support/hiddevice.py b/glucometerutils/support/hiddevice.py index e9a5d01..bd35a8f 100644 --- a/glucometerutils/support/hiddevice.py +++ b/glucometerutils/support/hiddevice.py @@ -19,6 +19,8 @@ class HidSession: methods abstracting the HID library. """ + handle_: Optional[BinaryIO] + def __init__( self, usb_id: Optional[Tuple[int, int]], @@ -51,7 +53,7 @@ class HidSession: # If the user passed a device, try opening it. if device: - self.handle_ = open(device, "w+b") # type: Optional[BinaryIO] + self.handle_ = open(device, "w+b") else: self.handle_ = None logging.info("No --device parameter provided, using hidapi library.") -- cgit v1.2.3