Skip to content

Commit ba54e8d

Browse files
author
Alec Delaney
committed
Use Protocol type annotation
1 parent 2ac4bd1 commit ba54e8d

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

adafruit_lifx.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,9 @@
3535
LIFX_URL = "https://api.lifx.com/v1/lights/"
3636

3737
try:
38-
from typing import Union, Dict, Any
39-
from adafruit_esp32spi.adafruit_esp32spi_wifimanager import ESPSPI_WiFiManager
40-
from adafruit_espatcontrol.adafruit_espatcontrol_wifimanager import (
41-
ESPAT_WiFiManager,
42-
)
43-
from adafruit_requests import Session, Response
44-
45-
WifiManagerType = Union[ESPSPI_WiFiManager, ESPAT_WiFiManager, Session]
38+
from typing import Dict, Any
39+
from circuitpython_typing.http import HTTPProtocol
40+
from adafruit_requests import Response
4641
except ImportError:
4742
pass
4843

@@ -55,7 +50,7 @@ class LIFX:
5550
:param str lifx_token: LIFX API token (https://api.developer.lifx.com/docs/authentication)
5651
"""
5752

58-
def __init__(self, wifi_manager: WifiManagerType, lifx_token: str) -> None:
53+
def __init__(self, wifi_manager: HTTPProtocol, lifx_token: str) -> None:
5954
wifi_type = str(type(wifi_manager))
6055
allowed_wifi_types = ("ESPSPI_WiFiManager", "ESPAT_WiFiManager", "Session")
6156
if any(x in wifi_type for x in allowed_wifi_types):

requirements.txt

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

55
Adafruit-Blinka
6+
adafruit-circuitpython-typing~=1.8
67
adafruit-circuitpython-requests
78
adafruit-circuitpython-esp32spi
89
adafruit-circuitpython-esp-atcontrol

0 commit comments

Comments
 (0)