Skip to content

Use circuitpython_typing.FillBasedLED instead of custom Pixel protocol #56

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
May 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 2 additions & 21 deletions adafruit_espatcontrol/adafruit_espatcontrol_wifimanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,8 @@

try:
from typing import Dict, Any, Optional, Union, Tuple

try:
from typing import Protocol
except ImportError:
from typing_extensions import Protocol
from circuitpython_typing.led import FillBasedLED
from adafruit_espatcontrol.adafruit_espatcontrol import ESP_ATcontrol
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to keep this ESP_ATcontrol line


class Pixel(Protocol):
"""
A class for providing type hints for parameters
requiring a pixel device (NeoPixel/DotStar)
"""

def fill( # pylint: disable=unused-argument, no-self-use
self, value: Union[int, Tuple[int, int, int]]
) -> Any:
"""
Duck types out the fill method for pixel devices
"""
...

except ImportError:
pass

Expand All @@ -52,7 +33,7 @@ def __init__(
self,
esp: ESP_ATcontrol,
secrets: Dict[str, Union[str, int]],
status_pixel: Optional[Pixel] = None,
status_pixel: Optional[FillBasedLED] = None,
attempts: int = 2,
):
"""
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
# SPDX-License-Identifier: Unlicense

Adafruit-Blinka
adafruit-circuitpython-typing>=1.4.0
pyserial
6 changes: 5 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@
# Author details
author="Adafruit Industries",
author_email="[email protected]",
install_requires=["Adafruit-Blinka", "pyserial"],
install_requires=[
"Adafruit-Blinka",
"adafruit-circuitpython-typing>=1.4.0",
"pyserial",
],
# Choose your license
license="MIT",
# See https://pypi.python.org/pypi?%3Aaction=list_classifiers
Expand Down