|
29 | 29 | """ |
30 | 30 |
|
31 | 31 | import itertools |
32 | | -from collections.abc import Callable, Mapping |
33 | 32 | from dataclasses import dataclass |
34 | | -from typing import cast |
| 33 | +from typing import TYPE_CHECKING, cast |
35 | 34 |
|
36 | 35 | import numpy as np |
37 | 36 | from immutabledict import immutabledict |
38 | 37 |
|
39 | 38 | import pytato as pt |
40 | | -from pymbolic import Scalar |
41 | | -from pytools.tag import Tag |
42 | 39 |
|
43 | 40 | from arraycontext.container import is_array_container_type |
44 | 41 | from arraycontext.container.traversal import rec_keyed_map_array_container |
45 | | -from arraycontext.context import ( |
46 | | - Array, |
47 | | - ArrayOrContainer, |
48 | | - ArrayT, |
49 | | -) |
50 | | -from arraycontext.impl.pytato import _BasePytatoArrayContext |
| 42 | + |
| 43 | + |
| 44 | +if TYPE_CHECKING: |
| 45 | + from collections.abc import Callable, Mapping |
| 46 | + |
| 47 | + from pymbolic import Scalar |
| 48 | + from pytools.tag import Tag |
| 49 | + |
| 50 | + from arraycontext.context import ( |
| 51 | + Array, |
| 52 | + ArrayOrContainer, |
| 53 | + ArrayT, |
| 54 | + ) |
| 55 | + from arraycontext.impl.pytato import _BasePytatoArrayContext |
51 | 56 |
|
52 | 57 |
|
53 | 58 | def _get_arg_id_to_arg(args: tuple[object, ...], |
@@ -133,7 +138,7 @@ def get_placeholder_replacement( |
133 | 138 | if arg is None: |
134 | 139 | return None |
135 | 140 | elif np.isscalar(arg): |
136 | | - return cast(Scalar, arg) |
| 141 | + return cast("Scalar", arg) |
137 | 142 | elif isinstance(arg, pt.Array): |
138 | 143 | return arg_id_to_placeholder[key] |
139 | 144 | elif is_array_container_type(arg.__class__): |
|
0 commit comments