summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDiego Elio Pettenò <flameeyes@flameeyes.com>2023-08-03 12:38:27 +0200
committerDiego Elio Pettenò <flameeyes@flameeyes.com>2023-08-03 13:02:57 +0200
commita833036b0c354320716617d3e477f2e5e1e47b6a (patch)
tree97bd9e71d9e9978530c6475fa7a97293c95a2718
parentInclude Python 3.10 and 3.11 as part of CI. (diff)
downloadfreestyle-hid-a833036b0c354320716617d3e477f2e5e1e47b6a.tar
freestyle-hid-a833036b0c354320716617d3e477f2e5e1e47b6a.tar.gz
freestyle-hid-a833036b0c354320716617d3e477f2e5e1e47b6a.tar.bz2
freestyle-hid-a833036b0c354320716617d3e477f2e5e1e47b6a.tar.lz
freestyle-hid-a833036b0c354320716617d3e477f2e5e1e47b6a.tar.xz
freestyle-hid-a833036b0c354320716617d3e477f2e5e1e47b6a.tar.zst
freestyle-hid-a833036b0c354320716617d3e477f2e5e1e47b6a.zip
-rw-r--r--freestyle_hid/_session.py9
-rw-r--r--freestyle_hid/tools/encrypted_setup_extractor.py3
2 files changed, 7 insertions, 5 deletions
diff --git a/freestyle_hid/_session.py b/freestyle_hid/_session.py
index 03e8c54..b204284 100644
--- a/freestyle_hid/_session.py
+++ b/freestyle_hid/_session.py
@@ -6,7 +6,8 @@ import logging
import pathlib
import random
import re
-from typing import AnyStr, Callable, Iterator, Optional, Sequence, Tuple
+from collections.abc import Iterator, Sequence
+from typing import AnyStr, Callable, Optional
import construct
@@ -57,8 +58,8 @@ _ALWAYS_UNENCRYPTED_MESSAGES = (
def _create_matcher(
message_type: int, content: Optional[bytes]
-) -> Callable[[Tuple[int, bytes]], bool]:
- def _matcher(message: Tuple[int, bytes]) -> bool:
+) -> Callable[[tuple[int, bytes]], bool]:
+ def _matcher(message: tuple[int, bytes]) -> bool:
return message[0] == message_type and (content is None or content == message[1])
return _matcher
@@ -298,7 +299,7 @@ class Session:
self._write_hid(message)
- def read_response(self, encrypted: bool = False) -> Tuple[int, bytes]:
+ def read_response(self, encrypted: bool = False) -> tuple[int, bytes]:
"""Read the response from the device and extracts it."""
usb_packet = self._handle.read()
diff --git a/freestyle_hid/tools/encrypted_setup_extractor.py b/freestyle_hid/tools/encrypted_setup_extractor.py
index cb9c416..ffcdc79 100644
--- a/freestyle_hid/tools/encrypted_setup_extractor.py
+++ b/freestyle_hid/tools/encrypted_setup_extractor.py
@@ -7,7 +7,8 @@
import logging
import sys
-from typing import BinaryIO, Optional, Sequence
+from collections.abc import Sequence
+from typing import BinaryIO, Optional
import click
import click_log