Skip to content

Commit 7ac2df5

Browse files
authored
Merge pull request #107 from tekktrik/doc/rerun-black
Use typing_extensions.Protocol if needed
2 parents 3dc3bec + cf17c20 commit 7ac2df5

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

adafruit_requests.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,15 @@ def cast(_t, value):
4747
"""No-op shim for the typing.cast() function which is not available in CircuitPython."""
4848
return value
4949

50-
5150
else:
5251
from ssl import SSLContext
5352
from types import ModuleType, TracebackType
54-
from typing import Any, Dict, List, Optional, Protocol, Tuple, Type, Union, cast
53+
from typing import Any, Dict, List, Optional, Tuple, Type, Union, cast
54+
55+
try:
56+
from typing import Protocol
57+
except ImportError:
58+
from typing_extensions import Protocol
5559

5660
# Based on https://github.com/python/typeshed/blob/master/stdlib/_socket.pyi
5761
class CommonSocketType(Protocol):

0 commit comments

Comments
 (0)