|
3 | 3 | from __future__ import annotations |
4 | 4 |
|
5 | 5 | from collections.abc import Callable, Sequence |
6 | | -from typing import Literal, SupportsFloat, Union |
| 6 | +from typing import Literal, SupportsFloat |
7 | 7 |
|
8 | 8 | import numpy as np |
9 | 9 | from shapely.geometry import LineString, Point, Polygon # type: ignore[import-untyped] |
10 | 10 |
|
11 | 11 | # Proper type annotations for shapely is not yet available. |
12 | 12 |
|
13 | 13 |
|
14 | | -JSON = Union[dict[str, "JSON"], list["JSON"], str, int, float, bool, None] |
| 14 | +JSON = dict[str, "JSON"] | list["JSON"] | str | int | float | bool | None |
15 | 15 | NumPair = tuple[SupportsFloat, SupportsFloat] |
16 | 16 | IntPair = tuple[int, int] |
17 | 17 |
|
18 | 18 | # WSIReader |
19 | | -Resolution = Union[SupportsFloat, NumPair, np.ndarray, Sequence[SupportsFloat]] |
| 19 | +Resolution = SupportsFloat | NumPair | np.ndarray | Sequence[SupportsFloat] |
20 | 20 | Units = Literal["mpp", "power", "baseline", "level"] |
21 | 21 | Bounds = tuple[SupportsFloat, SupportsFloat, SupportsFloat, SupportsFloat] |
22 | 22 | IntBounds = tuple[int, int, int, int] |
23 | 23 |
|
24 | 24 | # Annotation Store |
25 | | -Geometry = Union[Point, LineString, Polygon] |
| 25 | +Geometry = Point | LineString | Polygon |
26 | 26 | Properties = JSON # Could define this using a TypedDict |
27 | | -QueryGeometry = Union[Bounds, Geometry] |
| 27 | +QueryGeometry = Bounds | Geometry |
28 | 28 | CallablePredicate = Callable[[Properties], bool] |
29 | 29 | CallableSelect = Callable[[Properties], Properties] |
30 | | -Predicate = Union[str, bytes, CallablePredicate] |
31 | | -Select = Union[str, bytes, CallableSelect] |
| 30 | +Predicate = str | bytes | CallablePredicate |
| 31 | +Select = str | bytes | CallableSelect |
32 | 32 | NumpyPadLiteral = Literal[ |
33 | 33 | "constant", |
34 | 34 | "edge", |
|
0 commit comments