Skip to content

Commit b3408b0

Browse files
authored
Merge pull request #56 from tekktrik/doc/use-circuitpython-typing
Use circuitpython_typing.FillBasedLED instead of custom Pixel protocol
2 parents b21c4f8 + bc13850 commit b3408b0

File tree

3 files changed

+8
-22
lines changed

3 files changed

+8
-22
lines changed

adafruit_espatcontrol/adafruit_espatcontrol_wifimanager.py

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -18,27 +18,8 @@
1818

1919
try:
2020
from typing import Dict, Any, Optional, Union, Tuple
21-
22-
try:
23-
from typing import Protocol
24-
except ImportError:
25-
from typing_extensions import Protocol
21+
from circuitpython_typing.led import FillBasedLED
2622
from adafruit_espatcontrol.adafruit_espatcontrol import ESP_ATcontrol
27-
28-
class Pixel(Protocol):
29-
"""
30-
A class for providing type hints for parameters
31-
requiring a pixel device (NeoPixel/DotStar)
32-
"""
33-
34-
def fill( # pylint: disable=unused-argument, no-self-use
35-
self, value: Union[int, Tuple[int, int, int]]
36-
) -> Any:
37-
"""
38-
Duck types out the fill method for pixel devices
39-
"""
40-
...
41-
4223
except ImportError:
4324
pass
4425

@@ -52,7 +33,7 @@ def __init__(
5233
self,
5334
esp: ESP_ATcontrol,
5435
secrets: Dict[str, Union[str, int]],
55-
status_pixel: Optional[Pixel] = None,
36+
status_pixel: Optional[FillBasedLED] = None,
5637
attempts: int = 2,
5738
):
5839
"""

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@
33
# SPDX-License-Identifier: Unlicense
44

55
Adafruit-Blinka
6+
adafruit-circuitpython-typing>=1.4.0
67
pyserial

setup.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,11 @@
3434
# Author details
3535
author="Adafruit Industries",
3636
author_email="[email protected]",
37-
install_requires=["Adafruit-Blinka", "pyserial"],
37+
install_requires=[
38+
"Adafruit-Blinka",
39+
"adafruit-circuitpython-typing>=1.4.0",
40+
"pyserial",
41+
],
3842
# Choose your license
3943
license="MIT",
4044
# See https://pypi.python.org/pypi?%3Aaction=list_classifiers

0 commit comments

Comments
 (0)