Skip to content

Commit 1b12ff5

Browse files
committed
use TypedDict definitions for args
1 parent 8e12133 commit 1b12ff5

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

adafruit_avrprog.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_AVRprog.git"
3434

3535
try:
36-
from typing import Any, Dict, List, Optional, Tuple, Union, TypedDict
36+
from typing import List, Optional, Tuple, Union, TypedDict
3737
from typing_extensions import TypeAlias
3838
from os import PathLike
3939
from busio import SPI
@@ -57,7 +57,7 @@ class ChipDictionary(TypedDict):
5757
sig: List[int]
5858
flash_size: int
5959
page_size: int
60-
fuse_mask: Tuple[int]
60+
fuse_mask: Tuple[int, int, int, int]
6161

6262
class FileState(TypedDict):
6363
"""
@@ -159,7 +159,7 @@ def verify_sig(self, chip: ChipDictionary, verbose: bool = False) -> bool:
159159
# pylint: disable=too-many-branches
160160
def program_file(
161161
self,
162-
chip: Dict[str, Any],
162+
chip: ChipDictionary,
163163
file_name: FileDescriptorOrPath,
164164
verbose: bool = False,
165165
verify: bool = True,
@@ -231,7 +231,7 @@ def program_file(
231231

232232
def verify_file(
233233
self,
234-
chip: Dict[str, Any],
234+
chip: ChipDictionary,
235235
file_name: FileDescriptorOrPath,
236236
verbose: bool = False,
237237
) -> bool:
@@ -279,7 +279,7 @@ def verify_file(
279279
self.end()
280280
return True
281281

282-
def read_fuses(self, chip: Dict[str, Any]) -> Tuple[int, int, int, int]:
282+
def read_fuses(self, chip: ChipDictionary) -> Tuple[int, int, int, int]:
283283
"""
284284
Read the 4 fuses and return them in a tuple (low, high, ext, lock)
285285
Each fuse is bitwise-&'s with the chip's fuse mask for simplicity
@@ -296,7 +296,7 @@ def read_fuses(self, chip: Dict[str, Any]) -> Tuple[int, int, int, int]:
296296
# pylint: disable=unused-argument,too-many-arguments
297297
def write_fuses(
298298
self,
299-
chip: Dict[str, Any],
299+
chip: ChipDictionary,
300300
low: Optional[int] = None,
301301
high: Optional[int] = None,
302302
ext: Optional[int] = None,
@@ -318,7 +318,7 @@ def write_fuses(
318318
# pylint: disable=too-many-arguments
319319
def verify_fuses(
320320
self,
321-
chip: Dict[str, Any],
321+
chip: ChipDictionary,
322322
low: Optional[int] = None,
323323
high: Optional[int] = None,
324324
ext: Optional[int] = None,
@@ -439,7 +439,7 @@ def _busy_wait(self) -> None:
439439

440440

441441
def read_hex_page(
442-
file_state: Dict[str, Any], page_addr: int, page_size: int, page_buffer: bytearray
442+
file_state: FileState, page_addr: int, page_size: int, page_buffer: bytearray
443443
) -> bool:
444444
# pylint: disable=too-many-branches
445445
"""

0 commit comments

Comments
 (0)