|
171 | 171 | THE SOFTWARE. |
172 | 172 | """ |
173 | 173 |
|
| 174 | + |
174 | 175 | from abc import ABC, abstractmethod |
175 | 176 | from collections.abc import Callable, Mapping |
176 | | -from typing import TYPE_CHECKING, Any, Protocol, TypeAlias, TypeVar, Union, overload |
| 177 | +from typing import ( |
| 178 | + TYPE_CHECKING, |
| 179 | + Any, |
| 180 | + Literal, |
| 181 | + Protocol, |
| 182 | + TypeAlias, |
| 183 | + TypeVar, |
| 184 | + overload, |
| 185 | +) |
177 | 186 | from warnings import warn |
178 | 187 |
|
179 | | -import numpy as np |
180 | 188 | from typing_extensions import Self |
181 | 189 |
|
182 | 190 | from pymbolic.typing import Integer, Scalar as _Scalar |
183 | 191 | from pytools import memoize_method |
184 | 192 |
|
185 | 193 |
|
186 | 194 | if TYPE_CHECKING: |
| 195 | + import numpy as np |
| 196 | + from numpy.typing import DTypeLike |
| 197 | + |
187 | 198 | import loopy |
188 | 199 | from pytools.tag import ToTagSetConvertible |
189 | 200 |
|
@@ -243,6 +254,21 @@ def __rpow__(self, other: Self | ScalarLike) -> Array: ... |
243 | 254 | def __truediv__(self, other: Self | ScalarLike) -> Array: ... |
244 | 255 | def __rtruediv__(self, other: Self | ScalarLike) -> Array: ... |
245 | 256 |
|
| 257 | + def copy(self) -> Self: ... |
| 258 | + |
| 259 | + @property |
| 260 | + def real(self) -> Array: ... |
| 261 | + @property |
| 262 | + def imag(self) -> Array: ... |
| 263 | + def conj(self) -> Array: ... |
| 264 | + |
| 265 | + def astype(self, dtype: DTypeLike) -> Array: ... |
| 266 | + |
| 267 | + def reshape(self, |
| 268 | + *shape: int, |
| 269 | + order: Literal["C"] | Literal["F"] |
| 270 | + ) -> Array: ... |
| 271 | + |
246 | 272 |
|
247 | 273 | # deprecated, use ScalarLike instead |
248 | 274 | Scalar = _Scalar |
@@ -287,7 +313,7 @@ def __rtruediv__(self, other: Self | ScalarLike) -> Array: ... |
287 | 313 | ContainerOrScalarT = TypeVar("ContainerOrScalarT", bound="ArrayContainer | ScalarLike") |
288 | 314 |
|
289 | 315 |
|
290 | | -NumpyOrContainerOrScalar = Union[np.ndarray, "ArrayContainer", ScalarLike] |
| 316 | +NumpyOrContainerOrScalar: TypeAlias = "np.ndarray | ArrayContainer | ScalarLike" |
291 | 317 |
|
292 | 318 | # }}} |
293 | 319 |
|
|
0 commit comments