|
11 | 11 | import warnings |
12 | 12 | from collections.abc import Callable, Generator, Iterator, Sequence |
13 | 13 | from types import FunctionType, ModuleType |
14 | | -from typing import TYPE_CHECKING, Any, ParamSpec, TypeVar |
| 14 | +from typing import Any, ParamSpec, TypeVar |
15 | 15 |
|
16 | 16 | from .._lib import _compat, _helpers |
17 | | -from .._lib._typing import Array, ArrayNamespace, Device |
| 17 | +from .._lib._typing import ( |
| 18 | + Array, |
| 19 | + ArrayNamespace, |
| 20 | + Device, |
| 21 | + Graph, |
| 22 | + Key, |
| 23 | + SchedulerGetCallable, |
| 24 | + override, |
| 25 | +) |
| 26 | + |
| 27 | +if typing.TYPE_CHECKING: |
| 28 | + import numpy as np |
| 29 | + import pytest |
18 | 30 |
|
19 | 31 | __all__ = [ |
20 | 32 | "assert_close", |
|
25 | 37 | "patch_lazy_xp_functions", |
26 | 38 | ] |
27 | 39 |
|
28 | | -if TYPE_CHECKING: # pragma: no cover |
29 | | - # TODO import override from typing (requires Python >=3.12) |
30 | | - import numpy as np |
31 | | - import pytest |
32 | | - from dask.typing import Graph, Key, SchedulerGetCallable |
33 | | - from typing_extensions import override as _override |
34 | | - |
35 | | -else: |
36 | | - # Sphinx hacks |
37 | | - SchedulerGetCallable = object |
38 | | - |
39 | | - def _override(func): |
40 | | - return func |
41 | | - |
42 | 40 |
|
43 | 41 | __all__ = [ |
44 | 42 | "assert_close", |
@@ -493,7 +491,7 @@ def __init__(self, max_count: int, msg: str) -> None: # numpydoc ignore=GL08 |
493 | 491 | self.max_count = max_count |
494 | 492 | self.msg = msg |
495 | 493 |
|
496 | | - @_override |
| 494 | + @override |
497 | 495 | def __call__( |
498 | 496 | self, dsk: Graph, keys: Sequence[Key] | Key, **kwargs: Any |
499 | 497 | ) -> Any: # numpydoc ignore=GL08 |
|
0 commit comments