Skip to content

Commit ceb98a1

Browse files
committed
use typing-extensions
1 parent c22aadd commit ceb98a1

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

adaptive/learner/balancing_learner.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,19 @@
77
from contextlib import suppress
88
from functools import partial
99
from operator import itemgetter
10-
from typing import Any, Callable, Dict, Literal, Sequence, Tuple, Union
10+
from typing import Any, Callable, Dict, Sequence, Tuple, Union
1111

1212
import numpy as np
1313

1414
from adaptive.learner.base_learner import BaseLearner
1515
from adaptive.notebook_integration import ensure_holoviews
1616
from adaptive.utils import cache_latest, named_product, restore
1717

18+
try:
19+
from typing import Literal
20+
except ImportError:
21+
from typing_extensions import Literal
22+
1823

1924
def dispatch(child_functions: list[Callable], arg: Any) -> Any:
2025
index, x = arg

setup.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ def get_version_and_cmdclass(package_name):
3232
"cloudpickle",
3333
"loky >= 2.9",
3434
]
35+
if sys.version_info < (3, 8):
36+
install_requires.append("typing_extensions")
3537

3638
extras_require = {
3739
"notebook": [

0 commit comments

Comments
 (0)