Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion stubs/rasterio/rasterio/_typing.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down