Skip to content

Commit 08e31ca

Browse files
committed
Add backup import of Protocol from typing_extensions
1 parent 5fda7e7 commit 08e31ca

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

adafruit_requests.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,12 @@ def cast(_t, value):
5050
else:
5151
from ssl import SSLContext
5252
from types import ModuleType, TracebackType
53-
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
5459

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

0 commit comments

Comments
 (0)