Skip to content
This repository was archived by the owner on Jul 8, 2022. It is now read-only.

Commit 7901a4a

Browse files
py3.7 typing dependency fix
1 parent fa7e2ff commit 7901a4a

File tree

3 files changed

+22
-3
lines changed

3 files changed

+22
-3
lines changed

optimizely/entities.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,13 @@
1212
# limitations under the License.
1313
from __future__ import annotations
1414
from typing import Any, Optional
15-
from typing_extensions import TypedDict
15+
16+
try:
17+
# python 3.7
18+
from typing_extensions import TypedDict
19+
except ImportError:
20+
# python 3.8 +
21+
from typing import TypedDict # type: ignore
1622

1723

1824
class BaseEntity:

optimizely/event_dispatcher.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,21 @@
1818

1919
from requests import exceptions as request_exception
2020
from typing import Optional
21-
from typing_extensions import Protocol
2221

2322
from .helpers import enums
2423
from . import event_builder
2524

2625
REQUEST_TIMEOUT = 10
2726

2827

28+
try:
29+
# python 3.7
30+
from typing_extensions import Protocol
31+
except ImportError:
32+
# python 3.8 +
33+
from typing import Protocol # type: ignore
34+
35+
2936
class CustomEventDispatcher(Protocol):
3037
"""Interface to enforce required method"""
3138
def dispatch_event(self, event: Optional[event_builder.Event]) -> None:

optimizely/helpers/condition.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
# limitations under the License.
1313

1414
from __future__ import annotations
15-
from typing_extensions import Literal
1615
import json
1716
import numbers
1817
from typing import Any, Callable, Optional
@@ -22,6 +21,13 @@
2221
from .enums import Errors
2322
from .enums import VersionType
2423

24+
try:
25+
# python 3.7
26+
from typing_extensions import Literal
27+
except ImportError:
28+
# python 3.8 +
29+
from typing import Literal # type: ignore
30+
2531

2632
class ConditionOperatorTypes:
2733
AND = 'and'

0 commit comments

Comments
 (0)