diff --git a/stubs/rasterio/rasterio/_typing.pyi b/stubs/rasterio/rasterio/_typing.pyi index 974afc3a8369..a1011123b397 100644 --- a/stubs/rasterio/rasterio/_typing.pyi +++ b/stubs/rasterio/rasterio/_typing.pyi @@ -16,13 +16,19 @@ class _SupportsGeoInterface(Protocol): @property def __geo_interface__(self) -> Mapping[str, Any]: ... +@type_check_only +class _SupportsToWkt(Protocol): + def to_wkt(self) -> str: ... + # A GeoJSON-like mapping, or any object exposing one through the # `__geo_interface__` protocol (e.g. shapely / geopandas geometries). # The runtime unwraps `__geo_interface__` before use, so both forms are # accepted anywhere a geometry is expected. Geometry: TypeAlias = Mapping[str, Any] | _SupportsGeoInterface # noqa: Y047 Colormap: TypeAlias = dict[int, tuple[int, int, int] | tuple[int, int, int, int]] -CRSInput: TypeAlias = str | dict[str, str] | CRS +# A WKT / PROJ string, an EPSG code, a PROJ dict, or any object exposing +# `to_wkt` (e.g. a pyproj CRS). `CRS.from_user_input` normalizes all of them. +CRSInput: TypeAlias = str | int | dict[str, str] | CRS | _SupportsToWkt FileOrBytes: TypeAlias = BinaryIO | bytes Indexes: TypeAlias = int | Sequence[int] NumType: TypeAlias = int | float