Skip to content

Commit 7af3af8

Browse files
authored
Merge pull request #230 from makermelissa/main
Fix typing errors for MicroPython
2 parents ea71d32 + 86ced30 commit 7af3af8

File tree

4 files changed

+26
-18
lines changed

4 files changed

+26
-18
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44

55
repos:
66
- repo: https://github.com/python/black
7-
rev: 20.8b1
7+
rev: 22.3.0
88
hooks:
99
- id: black
10+
additional_dependencies: ['click==8.0.4']
1011
- repo: https://github.com/fsfe/reuse-tool
1112
rev: v0.12.1
1213
hooks:

adafruit_platformdetect/__init__.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,14 @@
88
import os
99
import re
1010
import sys
11-
from typing import Optional
1211

13-
from .board import Board
14-
from .chip import Chip
12+
try:
13+
from typing import Optional
14+
except ImportError:
15+
pass
16+
17+
from adafruit_platformdetect.board import Board
18+
from adafruit_platformdetect.chip import Chip
1519

1620
# Needed to find libs (like libusb) installed by homebrew on Apple Silicon
1721
if sys.platform == "darwin":

adafruit_platformdetect/board.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,16 @@
2020
2121
"""
2222

23-
# imports
24-
from __future__ import annotations
2523
import os
2624
import re
27-
from typing import Optional, TYPE_CHECKING
28-
from .constants import boards, chips
2925

30-
if TYPE_CHECKING:
31-
from . import Detector
26+
try:
27+
from typing import Optional
28+
except ImportError:
29+
pass
30+
31+
from adafruit_platformdetect.constants import boards, chips
32+
3233

3334
__version__ = "0.0.0-auto.0"
3435
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_PlatformDetect.git"
@@ -37,7 +38,7 @@
3738
class Board:
3839
"""Attempt to detect specific boards."""
3940

40-
def __init__(self, detector: Detector) -> None:
41+
def __init__(self, detector) -> None:
4142
self.detector = detector
4243
self._board_id = None
4344

adafruit_platformdetect/chip.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,17 @@
1919
2020
"""
2121

22-
# imports
23-
from __future__ import annotations
22+
2423
import os
2524
import sys
26-
from typing import Optional, TYPE_CHECKING
27-
from .constants import chips
2825

29-
if TYPE_CHECKING:
30-
from . import Detector
26+
try:
27+
from typing import Optional
28+
except ImportError:
29+
pass
30+
31+
from adafruit_platformdetect.constants import chips
32+
3133

3234
__version__ = "0.0.0-auto.0"
3335
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_PlatformDetect.git"
@@ -36,7 +38,7 @@
3638
class Chip:
3739
"""Attempt detection of current chip / CPU."""
3840

39-
def __init__(self, detector: Detector) -> None:
41+
def __init__(self, detector) -> None:
4042
self.detector = detector
4143
self._chip_id = None
4244

0 commit comments

Comments
 (0)