Skip to content

Commit d545d65

Browse files
committed
Typing fixes
1 parent 0dc12df commit d545d65

File tree

6 files changed

+27
-8
lines changed

6 files changed

+27
-8
lines changed

circuitpython_typing/__init__.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,21 @@
1515
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_Typing.git"
1616

1717
import array
18-
from typing import Union, Optional
19-
from typing_extensions import Protocol, TypeAlias # Safety import for Python 3.7
18+
from typing import Optional, Union
19+
20+
import alarm
21+
import audiocore
22+
import audiomixer
23+
import audiomp3
24+
import rgbmatrix
25+
import synthio
26+
import ulab
27+
from alarm.pin import PinAlarm
28+
from alarm.time import TimeAlarm
29+
30+
# Protocol was introduced in Python 3.8, TypeAlias in 3.10
31+
from typing_extensions import Protocol, TypeAlias
32+
from ulab.numpy import ndarray
2033

2134
# Lists below are alphabetized.
2235

circuitpython_typing/http.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@
1111
* Author(s): Alec Delaney
1212
"""
1313

14+
from adafruit_requests import Response
15+
1416
# Protocol was introduced in Python 3.8.
1517
from typing_extensions import Protocol
16-
from adafruit_requests import Response
1718

1819

1920
class HTTPProtocol(Protocol):

circuitpython_typing/led.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
"""
1313

1414
# Protocol was introduced in Python 3.8, TypeAlias in 3.10
15-
from typing import Union, Tuple
15+
from typing import Tuple, Union
16+
1617
from typing_extensions import Protocol, TypeAlias
1718

1819
ColorBasedColorUnion: TypeAlias = Union[int, Tuple[int, int, int]]

circuitpython_typing/pil.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@
1111
* Author(s): Alec Delaney
1212
"""
1313

14-
from typing import Tuple, Optional, Callable
15-
from typing_extensions import Protocol # Safety import for Python 3.7
14+
from typing import Callable, Optional, Tuple
15+
16+
# Protocol was introduced in Python 3.8
17+
from typing_extensions import Protocol
1618

1719

1820
class PixelAccess(Protocol):

circuitpython_typing/socket.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,11 @@
1313
from types import ModuleType
1414
from typing import Any, Optional, Tuple, Union
1515

16+
from adafruit_connection_manager import _FakeSSLContext
17+
1618
# Protocol was introduced in Python 3.8, TypeAlias in 3.10
1719
from typing_extensions import Protocol, TypeAlias
1820

19-
2021
# Based on https://github.com/python/typeshed/blob/master/stdlib/_socket.pyi
2122

2223
__all__ = [
@@ -126,4 +127,4 @@ def TLS_MODE(self) -> int: # pylint: disable=invalid-name
126127
"""Constant representing that a socket's connection mode is TLS."""
127128

128129

129-
SSLContextType: TypeAlias = Union[SSLContext, "_FakeSSLContext"]
130+
SSLContextType: TypeAlias = Union[SSLContext, _FakeSSLContext]

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@
55

66
Adafruit-Blinka
77
adafruit-circuitpython-busdevice
8+
Adafruit-Circuitpython-connectionmanager@git+https://github.com/adafruit/Adafruit_CircuitPython_ConnectionManager@connection-manager
89
adafruit-circuitpython-requests
910
typing_extensions~=4.0

0 commit comments

Comments
 (0)