From 67dce53571c14e686d4aff9d73490acd14c63227 Mon Sep 17 00:00:00 2001 From: Ali Hamdan Date: Sun, 26 May 2024 11:52:07 +0200 Subject: [PATCH 1/2] Remove shapely stubs --- README.md | 16 +- requirements-tests.txt | 4 +- run.py | 2 +- stubs/shapely-stubs/.ruff.toml | 4 - stubs/shapely-stubs/__init__.pyi | 32 -- stubs/shapely-stubs/_enum.pyi | 5 - stubs/shapely-stubs/_geometry.pyi | 184 -------- stubs/shapely-stubs/_ragged_array.pyi | 12 - stubs/shapely-stubs/_typing.pyi | 61 --- stubs/shapely-stubs/_version.pyi | 6 - stubs/shapely-stubs/affinity.pyi | 23 - stubs/shapely-stubs/algorithms/__init__.pyi | 0 stubs/shapely-stubs/algorithms/cga.pyi | 6 - stubs/shapely-stubs/algorithms/polylabel.pyi | 19 - stubs/shapely-stubs/constructive.pyi | 430 ------------------ stubs/shapely-stubs/coordinates.pyi | 43 -- stubs/shapely-stubs/coords.pyi | 18 - stubs/shapely-stubs/creation.pyi | 252 ---------- stubs/shapely-stubs/decorators.pyi | 11 - stubs/shapely-stubs/errors.pyi | 17 - stubs/shapely-stubs/geometry/__init__.pyi | 25 - stubs/shapely-stubs/geometry/base.pyi | 285 ------------ stubs/shapely-stubs/geometry/collection.pyi | 17 - stubs/shapely-stubs/geometry/geo.pyi | 9 - stubs/shapely-stubs/geometry/linestring.pyi | 45 -- .../geometry/multilinestring.pyi | 15 - stubs/shapely-stubs/geometry/multipoint.pyi | 20 - stubs/shapely-stubs/geometry/multipolygon.pyi | 22 - stubs/shapely-stubs/geometry/point.pyi | 39 -- stubs/shapely-stubs/geometry/polygon.pyi | 45 -- stubs/shapely-stubs/geos.pyi | 3 - stubs/shapely-stubs/io.pyi | 140 ------ stubs/shapely-stubs/lib.pyi | 423 ----------------- stubs/shapely-stubs/linear.pyi | 69 --- stubs/shapely-stubs/measurement.pyi | 68 --- stubs/shapely-stubs/ops.pyi | 106 ----- stubs/shapely-stubs/plotting.pyi | 76 ---- stubs/shapely-stubs/predicates.pyi | 214 --------- stubs/shapely-stubs/prepared.pyi | 20 - stubs/shapely-stubs/set_operations.pyi | 86 ---- stubs/shapely-stubs/speedups.pyi | 12 - stubs/shapely-stubs/strtree.pyi | 82 ---- stubs/shapely-stubs/testing.pyi | 14 - stubs/shapely-stubs/validation.pyi | 7 - stubs/shapely-stubs/vectorized/__init__.pyi | 37 -- stubs/shapely-stubs/wkb.pyi | 16 - stubs/shapely-stubs/wkt.pyi | 8 - stubtest_allowlist.txt | 10 - tests/shapely/test_io.py | 6 +- 49 files changed, 10 insertions(+), 3054 deletions(-) delete mode 100644 stubs/shapely-stubs/.ruff.toml delete mode 100644 stubs/shapely-stubs/__init__.pyi delete mode 100644 stubs/shapely-stubs/_enum.pyi delete mode 100644 stubs/shapely-stubs/_geometry.pyi delete mode 100644 stubs/shapely-stubs/_ragged_array.pyi delete mode 100644 stubs/shapely-stubs/_typing.pyi delete mode 100644 stubs/shapely-stubs/_version.pyi delete mode 100644 stubs/shapely-stubs/affinity.pyi delete mode 100644 stubs/shapely-stubs/algorithms/__init__.pyi delete mode 100644 stubs/shapely-stubs/algorithms/cga.pyi delete mode 100644 stubs/shapely-stubs/algorithms/polylabel.pyi delete mode 100644 stubs/shapely-stubs/constructive.pyi delete mode 100644 stubs/shapely-stubs/coordinates.pyi delete mode 100644 stubs/shapely-stubs/coords.pyi delete mode 100644 stubs/shapely-stubs/creation.pyi delete mode 100644 stubs/shapely-stubs/decorators.pyi delete mode 100644 stubs/shapely-stubs/errors.pyi delete mode 100644 stubs/shapely-stubs/geometry/__init__.pyi delete mode 100644 stubs/shapely-stubs/geometry/base.pyi delete mode 100644 stubs/shapely-stubs/geometry/collection.pyi delete mode 100644 stubs/shapely-stubs/geometry/geo.pyi delete mode 100644 stubs/shapely-stubs/geometry/linestring.pyi delete mode 100644 stubs/shapely-stubs/geometry/multilinestring.pyi delete mode 100644 stubs/shapely-stubs/geometry/multipoint.pyi delete mode 100644 stubs/shapely-stubs/geometry/multipolygon.pyi delete mode 100644 stubs/shapely-stubs/geometry/point.pyi delete mode 100644 stubs/shapely-stubs/geometry/polygon.pyi delete mode 100644 stubs/shapely-stubs/geos.pyi delete mode 100644 stubs/shapely-stubs/io.pyi delete mode 100644 stubs/shapely-stubs/lib.pyi delete mode 100644 stubs/shapely-stubs/linear.pyi delete mode 100644 stubs/shapely-stubs/measurement.pyi delete mode 100644 stubs/shapely-stubs/ops.pyi delete mode 100644 stubs/shapely-stubs/plotting.pyi delete mode 100644 stubs/shapely-stubs/predicates.pyi delete mode 100644 stubs/shapely-stubs/prepared.pyi delete mode 100644 stubs/shapely-stubs/set_operations.pyi delete mode 100644 stubs/shapely-stubs/speedups.pyi delete mode 100644 stubs/shapely-stubs/strtree.pyi delete mode 100644 stubs/shapely-stubs/testing.pyi delete mode 100644 stubs/shapely-stubs/validation.pyi delete mode 100644 stubs/shapely-stubs/vectorized/__init__.pyi delete mode 100644 stubs/shapely-stubs/wkb.pyi delete mode 100644 stubs/shapely-stubs/wkt.pyi diff --git a/README.md b/README.md index e68f56e..5eb16de 100644 --- a/README.md +++ b/README.md @@ -90,17 +90,6 @@ This project is licensed under the MIT License. Yes Yes - - shapely - shapely - - PyPI, - GitHub - - Complete - Yes - Yes - ## Upstreamed stubs @@ -118,4 +107,9 @@ These stubs were included here in the past and have been moved to typeshed or to typeshed pip install types-seaborn + + shapely + typeshed + pip install types-shapely + diff --git a/requirements-tests.txt b/requirements-tests.txt index 76a5303..b4e5bcc 100644 --- a/requirements-tests.txt +++ b/requirements-tests.txt @@ -7,14 +7,12 @@ pyright==1.1.364 # Runtime dependencies # -------------------- -shapely>=2.0,<2.1 geopandas>=0.14.4,<1.0 # Transient dependencies # ---------------------- -# shapely -pyproj>=3.6.1 # geopandas +types-shapely>=2.0 pandas-stubs>=2.2.2.240514 matplotlib>=3.8.0 folium>=0.16.0 diff --git a/run.py b/run.py index 43cf6c5..e2168a3 100755 --- a/run.py +++ b/run.py @@ -20,7 +20,7 @@ class Text(str): ... "ruff-format": ["tests", "stubs"], "mypy": ["tests", "stubs"], "pyright": ["tests", "stubs"], - "stubtest": ["--allowlist=stubtest_allowlist.txt", "shapely", "geopandas"], + "stubtest": ["--allowlist=stubtest_allowlist.txt", "geopandas"], "pytest": [], } diff --git a/stubs/shapely-stubs/.ruff.toml b/stubs/shapely-stubs/.ruff.toml deleted file mode 100644 index 10c50f9..0000000 --- a/stubs/shapely-stubs/.ruff.toml +++ /dev/null @@ -1,4 +0,0 @@ -extend = "../../pyproject.toml" - -[lint] -isort.known-first-party = ["shapely"] diff --git a/stubs/shapely-stubs/__init__.pyi b/stubs/shapely-stubs/__init__.pyi deleted file mode 100644 index 8fc4c69..0000000 --- a/stubs/shapely-stubs/__init__.pyi +++ /dev/null @@ -1,32 +0,0 @@ -from . import affinity as affinity -from ._geometry import * -from .constructive import * -from .coordinates import * -from .creation import * -from .errors import setup_signal_checks as setup_signal_checks -from .geometry import ( - GeometryCollection as GeometryCollection, - LinearRing as LinearRing, - LineString as LineString, - MultiLineString as MultiLineString, - MultiPoint as MultiPoint, - MultiPolygon as MultiPolygon, - Point as Point, - Polygon as Polygon, -) -from .io import * -from .lib import ( - Geometry as Geometry, - GEOSException as GEOSException, - geos_capi_version as geos_capi_version, - geos_capi_version_string as geos_capi_version_string, - geos_version as geos_version, - geos_version_string as geos_version_string, -) -from .linear import * -from .measurement import * -from .predicates import * -from .set_operations import * -from .strtree import * - -__version__: str diff --git a/stubs/shapely-stubs/_enum.pyi b/stubs/shapely-stubs/_enum.pyi deleted file mode 100644 index 130510d..0000000 --- a/stubs/shapely-stubs/_enum.pyi +++ /dev/null @@ -1,5 +0,0 @@ -from enum import IntEnum - -class ParamEnum(IntEnum): - @classmethod - def get_value(cls, item: str) -> int: ... diff --git a/stubs/shapely-stubs/_geometry.pyi b/stubs/shapely-stubs/_geometry.pyi deleted file mode 100644 index 2da422f..0000000 --- a/stubs/shapely-stubs/_geometry.pyi +++ /dev/null @@ -1,184 +0,0 @@ -from enum import IntEnum -from typing import Any, Literal, SupportsIndex, overload -from typing_extensions import TypeAlias - -import numpy as np -from numpy.typing import NDArray - -from shapely._enum import ParamEnum -from shapely._typing import ArrayLike, ArrayLikeSeq, GeoArray, OptGeoArrayLike, OptGeoArrayLikeSeq, OptGeoT -from shapely.geometry import LinearRing, LineString, MultiLineString, MultiPoint, MultiPolygon, Point, Polygon -from shapely.geometry.base import BaseGeometry, BaseMultipartGeometry -from shapely.lib import Geometry - -__all__ = [ - "GeometryType", - "get_type_id", - "get_dimensions", - "get_coordinate_dimension", - "get_num_coordinates", - "get_srid", - "set_srid", - "get_x", - "get_y", - "get_z", - "get_exterior_ring", - "get_num_points", - "get_num_interior_rings", - "get_num_geometries", - "get_point", - "get_interior_ring", - "get_geometry", - "get_parts", - "get_rings", - "get_precision", - "set_precision", - "force_2d", - "force_3d", -] - -_PrecisionMode: TypeAlias = Literal["valid_output", "pointwise", "keep_collapsed", 0, 1, 2] - -class GeometryType(IntEnum): - MISSING = -1 - POINT = 0 - LINESTRING = 1 - LINEARRING = 2 - POLYGON = 3 - MULTIPOINT = 4 - MULTILINESTRING = 5 - MULTIPOLYGON = 6 - GEOMETRYCOLLECTION = 7 - -@overload -def get_type_id(geometry: Geometry | None, **kwargs) -> int: ... -@overload -def get_type_id(geometry: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.int64]: ... -@overload -def get_dimensions(geometry: Geometry | None, **kwargs) -> int: ... -@overload -def get_dimensions(geometry: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.int64]: ... -@overload -def get_coordinate_dimension(geometry: Geometry | None, **kwargs) -> int: ... -@overload -def get_coordinate_dimension(geometry: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.int64]: ... -@overload -def get_num_coordinates(geometry: Geometry | None, **kwargs) -> int: ... -@overload -def get_num_coordinates(geometry: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.int64]: ... -@overload -def get_srid(geometry: Geometry | None, **kwargs) -> int: ... -@overload -def get_srid(geometry: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.int64]: ... -@overload -def set_srid(geometry: OptGeoT, srid: SupportsIndex, **kwargs) -> OptGeoT: ... -@overload -def set_srid(geometry: OptGeoArrayLikeSeq, srid: ArrayLike[SupportsIndex], **kwargs) -> GeoArray: ... -@overload -def set_srid(geometry: OptGeoArrayLike, srid: ArrayLikeSeq[SupportsIndex], **kwargs) -> GeoArray: ... -@overload -def get_x(point: Geometry | None, **kwargs) -> float: ... -@overload -def get_x(point: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.float64]: ... -@overload -def get_y(point: Geometry | None, **kwargs) -> float: ... -@overload -def get_y(point: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.float64]: ... -@overload -def get_z(point: Geometry | None, **kwargs) -> float: ... -@overload -def get_z(point: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.float64]: ... -@overload -def get_point(geometry: LineString, index: SupportsIndex, **kwargs) -> Point | Any: ... -@overload -def get_point(geometry: Point | Polygon | BaseMultipartGeometry | None, index: SupportsIndex, **kwargs) -> None: ... -@overload -def get_point(geometry: Geometry, index: SupportsIndex, **kwargs) -> Point | None: ... -@overload -def get_point(geometry: OptGeoArrayLikeSeq, index: ArrayLike[SupportsIndex], **kwargs) -> GeoArray: ... -@overload -def get_point(geometry: OptGeoArrayLike, index: ArrayLikeSeq[SupportsIndex], **kwargs) -> GeoArray: ... -@overload -def get_num_points(geometry: Geometry | None, **kwargs) -> int: ... -@overload -def get_num_points(geometry: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.int64]: ... -@overload -def get_exterior_ring(geometry: Polygon, **kwargs) -> LinearRing: ... -@overload -def get_exterior_ring(geometry: Point | LineString | BaseMultipartGeometry | None, **kwargs) -> None: ... -@overload -def get_exterior_ring(geometry: Geometry, **kwargs) -> LinearRing | None: ... -@overload -def get_exterior_ring(geometry: OptGeoArrayLikeSeq, **kwargs) -> GeoArray: ... -@overload -def get_interior_ring(geometry: Polygon, index: SupportsIndex, **kwargs) -> LinearRing | Any: ... -@overload -def get_interior_ring(geometry: Point | LineString | BaseMultipartGeometry | None, index: SupportsIndex, **kwargs) -> None: ... -@overload -def get_interior_ring(geometry: Geometry, index: SupportsIndex, **kwargs) -> LinearRing | None: ... -@overload -def get_interior_ring(geometry: OptGeoArrayLikeSeq, index: ArrayLike[SupportsIndex], **kwargs) -> GeoArray: ... -@overload -def get_interior_ring(geometry: OptGeoArrayLike, index: ArrayLikeSeq[SupportsIndex], **kwargs) -> GeoArray: ... -@overload -def get_num_interior_rings(geometry: Geometry | None, **kwargs) -> int: ... -@overload -def get_num_interior_rings(geometry: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.int64]: ... -@overload -def get_geometry(geometry: MultiPoint, index: SupportsIndex, **kwargs) -> Point | Any: ... -@overload -def get_geometry(geometry: MultiLineString, index: SupportsIndex, **kwargs) -> LineString | Any: ... -@overload -def get_geometry(geometry: MultiPolygon, index: SupportsIndex, **kwargs) -> Polygon | Any: ... -@overload -def get_geometry(geometry: BaseMultipartGeometry, index: SupportsIndex, **kwargs) -> BaseGeometry | Any: ... -@overload -def get_geometry(geometry: None, index: SupportsIndex, **kwargs) -> None: ... -@overload -def get_geometry(geometry: Geometry | None, index: SupportsIndex, **kwargs) -> BaseGeometry | None: ... -@overload -def get_geometry(geometry: OptGeoArrayLikeSeq, index: ArrayLike[SupportsIndex], **kwargs) -> GeoArray: ... -@overload -def get_geometry(geometry: OptGeoArrayLike, index: ArrayLikeSeq[SupportsIndex], **kwargs) -> GeoArray: ... -@overload -def get_parts(geometry: OptGeoArrayLike, return_index: Literal[False] = False) -> GeoArray: ... -@overload -def get_parts(geometry: OptGeoArrayLike, return_index: Literal[True]) -> tuple[GeoArray, NDArray[np.int64]]: ... -@overload -def get_parts(geometry: OptGeoArrayLike, return_index: bool) -> GeoArray | tuple[GeoArray, NDArray[np.int64]]: ... -@overload -def get_rings(geometry: OptGeoArrayLike, return_index: Literal[False] = False) -> GeoArray: ... -@overload -def get_rings(geometry: OptGeoArrayLike, return_index: Literal[True]) -> tuple[GeoArray, NDArray[np.int64]]: ... -@overload -def get_rings(geometry: OptGeoArrayLike, return_index: bool) -> GeoArray | tuple[GeoArray, NDArray[np.int64]]: ... -@overload -def get_num_geometries(geometry: Geometry | None, **kwargs) -> int: ... -@overload -def get_num_geometries(geometry: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.int64]: ... -@overload -def get_precision(geometry: Geometry | None, **kwargs) -> float: ... -@overload -def get_precision(geometry: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.float64]: ... - -class SetPrecisionMode(ParamEnum): - valid_output: int - pointwise: int - keep_collapsed: int - -@overload -def set_precision(geometry: OptGeoT, grid_size: float, mode: _PrecisionMode = "valid_output", **kwargs) -> OptGeoT: ... -@overload -def set_precision( - geometry: OptGeoArrayLikeSeq, grid_size: float, mode: _PrecisionMode = "valid_output", **kwargs -) -> GeoArray: ... -@overload -def force_2d(geometry: OptGeoT, **kwargs) -> OptGeoT: ... -@overload -def force_2d(geometry: OptGeoArrayLikeSeq, **kwargs) -> GeoArray: ... -@overload -def force_3d(geometry: OptGeoT, z: float = 0.0, **kwargs) -> OptGeoT: ... -@overload -def force_3d(geometry: OptGeoArrayLikeSeq, z: ArrayLike[float] = 0.0, **kwargs) -> GeoArray: ... -@overload -def force_3d(geometry: OptGeoArrayLike, z: ArrayLikeSeq[float], **kwargs) -> GeoArray: ... diff --git a/stubs/shapely-stubs/_ragged_array.pyi b/stubs/shapely-stubs/_ragged_array.pyi deleted file mode 100644 index 9d1767b..0000000 --- a/stubs/shapely-stubs/_ragged_array.pyi +++ /dev/null @@ -1,12 +0,0 @@ -import numpy as np -from numpy.typing import NDArray - -from shapely._geometry import GeometryType -from shapely._typing import ArrayLike, ArrayLikeSeq, GeoArray, OptGeoArrayLikeSeq - -def to_ragged_array( - geometries: OptGeoArrayLikeSeq, include_z: bool | None = None -) -> tuple[GeometryType, NDArray[np.float64], tuple[NDArray[np.int64], ...]]: ... -def from_ragged_array( - geometry_type: GeometryType, coords: ArrayLike[float], offsets: ArrayLikeSeq[int] | None = None -) -> GeoArray: ... diff --git a/stubs/shapely-stubs/_typing.pyi b/stubs/shapely-stubs/_typing.pyi deleted file mode 100644 index ed4d208..0000000 --- a/stubs/shapely-stubs/_typing.pyi +++ /dev/null @@ -1,61 +0,0 @@ -import sys -from collections.abc import Sequence -from typing import Any, Protocol, TypeVar, type_check_only -from typing_extensions import TypeAlias - -import numpy as np -from numpy.typing import NDArray - -from shapely.lib import Geometry - -if sys.version_info >= (3, 12): - from collections.abc import Buffer - -_T = TypeVar("_T") -_T_co = TypeVar("_T_co", covariant=True) -_T_contra = TypeVar("_T_contra", contravariant=True) -_DType = TypeVar("_DType", bound=np.dtype[Any]) -_DType_co = TypeVar("_DType_co", covariant=True, bound=np.dtype[Any]) - -GeoT = TypeVar("GeoT", bound=Geometry) # noqa: PYI001 -OptGeoT = TypeVar("OptGeoT", bound=Geometry | None) # noqa: PYI001 - -@type_check_only -class SupportsArray(Protocol[_DType_co]): - def __array__(self) -> np.ndarray[Any, _DType_co]: ... - -# TODO revisit when mypy is happy with generic recursive type alias -# NestedSequence: TypeAlias = Sequence[_T] | Sequence[NestedSequence[_T]] -NestedSequence: TypeAlias = Sequence[_T] | Sequence[Sequence[_T]] | Sequence[Sequence[Sequence[_T]]] -DualArrayLike: TypeAlias = SupportsArray[_DType] | NestedSequence[SupportsArray[_DType]] | NestedSequence[_T] - -# array-like sequences: objects accepted by np.array that produce at least 1-D arrays -if sys.version_info >= (3, 12): - ArrayLikeSeq: TypeAlias = Buffer | DualArrayLike[np.dtype[Any], _T] -else: - ArrayLikeSeq: TypeAlias = DualArrayLike[np.dtype[Any], _T] -GeoArrayLikeSeq: TypeAlias = ArrayLikeSeq[Geometry] -OptGeoArrayLikeSeq: TypeAlias = ArrayLikeSeq[Geometry | None] - -# array-like: objects accepted by np.array that may also produce 0-D array -ArrayLike: TypeAlias = _T | ArrayLikeSeq[_T] -GeoArrayLike: TypeAlias = ArrayLike[Geometry] -OptGeoArrayLike: TypeAlias = ArrayLike[Geometry | None] - -# There is no way to pronounce "array of BaseGeometry" currently because of the restriction on -# NDArray type variable to np.dtype and because np.object_ is not generic. -# Note the use of `BaseGeometry` instead of `Geometry` as the alias is used in return types. -GeoArray: TypeAlias = NDArray[np.object_] - -@type_check_only -class SupportsGeoInterface(Protocol): - @property - def __geo_interface__(self) -> dict[str, Any]: ... - -@type_check_only -class SupportsRead(Protocol[_T_co]): - def read(self) -> _T_co: ... - -@type_check_only -class SupportsWrite(Protocol[_T_contra]): - def write(self, s: _T_contra, /) -> object: ... diff --git a/stubs/shapely-stubs/_version.pyi b/stubs/shapely-stubs/_version.pyi deleted file mode 100644 index 249ab56..0000000 --- a/stubs/shapely-stubs/_version.pyi +++ /dev/null @@ -1,6 +0,0 @@ -from typing import TypedDict - -version_json: str -_Versions = TypedDict("_Versions", {"date": str, "dirty": bool, "error": None, "full-revisionid": str, "version": str}) - -def get_versions() -> _Versions: ... diff --git a/stubs/shapely-stubs/affinity.pyi b/stubs/shapely-stubs/affinity.pyi deleted file mode 100644 index a90c9cc..0000000 --- a/stubs/shapely-stubs/affinity.pyi +++ /dev/null @@ -1,23 +0,0 @@ -from collections.abc import Collection -from typing import Literal, overload -from typing_extensions import TypeAlias - -from shapely._typing import GeoT -from shapely.geometry import Point -from shapely.lib import Geometry - -__all__ = ["affine_transform", "rotate", "scale", "skew", "translate"] - -_Origin: TypeAlias = Literal["center", "centroid"] | Point | tuple[float, float] | tuple[float, float, float] - -def affine_transform(geom: GeoT, matrix: Collection[float]) -> GeoT: ... -@overload -def interpret_origin(geom: Geometry, origin: _Origin, ndim: Literal[2]) -> tuple[float, float]: ... -@overload -def interpret_origin(geom: Geometry, origin: _Origin, ndim: Literal[3]) -> tuple[float, float, float]: ... -@overload -def interpret_origin(geom: Geometry, origin: _Origin, ndim: int) -> tuple[float, float] | tuple[float, float, float]: ... -def rotate(geom: GeoT, angle: float, origin: _Origin = "center", use_radians: bool = False) -> GeoT: ... -def scale(geom: GeoT, xfact: float = 1.0, yfact: float = 1.0, zfact: float = 1.0, origin: _Origin = "center") -> GeoT: ... -def skew(geom: GeoT, xs: float = 0.0, ys: float = 0.0, origin: _Origin = "center", use_radians: bool = False) -> GeoT: ... -def translate(geom: GeoT, xoff: float = 0.0, yoff: float = 0.0, zoff: float = 0.0) -> GeoT: ... diff --git a/stubs/shapely-stubs/algorithms/__init__.pyi b/stubs/shapely-stubs/algorithms/__init__.pyi deleted file mode 100644 index e69de29..0000000 diff --git a/stubs/shapely-stubs/algorithms/cga.pyi b/stubs/shapely-stubs/algorithms/cga.pyi deleted file mode 100644 index 0fd4add..0000000 --- a/stubs/shapely-stubs/algorithms/cga.pyi +++ /dev/null @@ -1,6 +0,0 @@ -from collections.abc import Callable - -from shapely.geometry import LinearRing - -def signed_area(ring: LinearRing) -> float: ... -def is_ccw_impl(name: None = None) -> Callable[[LinearRing], bool]: ... diff --git a/stubs/shapely-stubs/algorithms/polylabel.pyi b/stubs/shapely-stubs/algorithms/polylabel.pyi deleted file mode 100644 index 5e17f98..0000000 --- a/stubs/shapely-stubs/algorithms/polylabel.pyi +++ /dev/null @@ -1,19 +0,0 @@ -from shapely.errors import TopologicalError as TopologicalError -from shapely.geometry import Point, Polygon - -class Cell: - x: float - y: float - h: float - centroid: Point - distance: float - max_distance: float - def __init__(self, x: float, y: float, h: float, polygon: Polygon) -> None: ... - def __lt__(self, other: Cell) -> bool: ... - def __le__(self, other: Cell) -> bool: ... - def __eq__(self, other: object) -> bool: ... - def __ne__(self, other: object) -> bool: ... - def __gt__(self, other: Cell) -> bool: ... - def __ge__(self, other: Cell) -> bool: ... - -def polylabel(polygon: Polygon, tolerance: float = 1.0) -> Point: ... diff --git a/stubs/shapely-stubs/constructive.pyi b/stubs/shapely-stubs/constructive.pyi deleted file mode 100644 index 14817d4..0000000 --- a/stubs/shapely-stubs/constructive.pyi +++ /dev/null @@ -1,430 +0,0 @@ -from collections.abc import Sequence -from typing import Any, Literal, SupportsIndex, overload - -from shapely._enum import ParamEnum -from shapely._typing import ArrayLike, ArrayLikeSeq, GeoArray, OptGeoArrayLike, OptGeoArrayLikeSeq, OptGeoT -from shapely.geometry import GeometryCollection, LineString, MultiLineString, MultiPoint, MultiPolygon, Point, Polygon -from shapely.geometry.base import BaseGeometry, BaseMultipartGeometry -from shapely.lib import Geometry - -__all__ = [ - "BufferCapStyle", - "BufferJoinStyle", - "boundary", - "buffer", - "offset_curve", - "centroid", - "clip_by_rect", - "concave_hull", - "convex_hull", - "delaunay_triangles", - "segmentize", - "envelope", - "extract_unique_points", - "build_area", - "make_valid", - "normalize", - "node", - "point_on_surface", - "polygonize", - "polygonize_full", - "remove_repeated_points", - "reverse", - "simplify", - "snap", - "voronoi_polygons", - "oriented_envelope", - "minimum_rotated_rectangle", - "minimum_bounding_circle", -] - -class BufferCapStyle(ParamEnum): - round: int - flat: int - square: int - -class BufferJoinStyle(ParamEnum): - round: int - mitre: int - bevel: int - -@overload -def boundary(geometry: Point | MultiPoint, **kwargs) -> GeometryCollection: ... -@overload -def boundary(geometry: LineString | MultiLineString, **kwargs) -> MultiPoint: ... -@overload -def boundary(geometry: Polygon | MultiPolygon, **kwargs) -> MultiLineString: ... -@overload -def boundary(geometry: GeometryCollection | None, **kwargs) -> None: ... -@overload -def boundary(geometry: Geometry, **kwargs) -> BaseMultipartGeometry | Any: ... -@overload -def boundary(geometry: OptGeoArrayLikeSeq, **kwargs) -> GeoArray: ... -@overload -def buffer( - geometry: Geometry, - distance: float, - quad_segs: int = 8, - cap_style: BufferJoinStyle | Literal["round", "square", "flat"] = "round", - join_style: BufferJoinStyle | Literal["round", "mitre", "bevel"] = "round", - mitre_limit: float = 5.0, - single_sided: bool = False, - **kwargs, -) -> Polygon: ... -@overload -def buffer( - geometry: None, - distance: float, - quad_segs: int = 8, - cap_style: BufferJoinStyle | Literal["round", "square", "flat"] = "round", - join_style: BufferJoinStyle | Literal["round", "mitre", "bevel"] = "round", - mitre_limit: float = 5.0, - single_sided: bool = False, - **kwargs, -) -> None: ... -@overload -def buffer( - geometry: Geometry | None, - distance: float, - quad_segs: int = 8, - cap_style: BufferJoinStyle | Literal["round", "square", "flat"] = "round", - join_style: BufferJoinStyle | Literal["round", "mitre", "bevel"] = "round", - mitre_limit: float = 5.0, - single_sided: bool = False, - **kwargs, -) -> Polygon | None: ... -@overload -def buffer( - geometry: OptGeoArrayLike, - distance: ArrayLikeSeq[float], - quad_segs: int = 8, - cap_style: BufferJoinStyle | Literal["round", "square", "flat"] = "round", - join_style: BufferJoinStyle | Literal["round", "mitre", "bevel"] = "round", - mitre_limit: float = 5.0, - single_sided: bool = False, - **kwargs, -) -> GeoArray: ... -@overload -def buffer( - geometry: OptGeoArrayLikeSeq, - distance: ArrayLike[float], - quad_segs: int = 8, - cap_style: BufferJoinStyle | Literal["round", "square", "flat"] = "round", - join_style: BufferJoinStyle | Literal["round", "mitre", "bevel"] = "round", - mitre_limit: float = 5.0, - single_sided: bool = False, - **kwargs, -) -> GeoArray: ... -@overload -def offset_curve( - geometry: Geometry, - distance: float, - quad_segs: SupportsIndex = 8, - join_style: BufferJoinStyle | Literal["round", "mitre", "bevel"] = "round", - mitre_limit: float = 5.0, - **kwargs, -) -> LineString | MultiLineString: ... -@overload -def offset_curve( - geometry: None, - distance: float, - quad_segs: SupportsIndex = 8, - join_style: BufferJoinStyle | Literal["round", "mitre", "bevel"] = "round", - mitre_limit: float = 5.0, - **kwargs, -) -> None: ... -@overload -def offset_curve( - geometry: Geometry | None, - distance: float, - quad_segs: SupportsIndex = 8, - join_style: BufferJoinStyle | Literal["round", "mitre", "bevel"] = "round", - mitre_limit: float = 5.0, - **kwargs, -) -> LineString | MultiLineString | None: ... -@overload -def offset_curve( - geometry: OptGeoArrayLike, - distance: ArrayLikeSeq[float], - quad_segs: SupportsIndex = 8, - join_style: BufferJoinStyle | Literal["round", "mitre", "bevel"] = "round", - mitre_limit: float = 5.0, - **kwargs, -) -> GeoArray: ... -@overload -def offset_curve( - geometry: OptGeoArrayLikeSeq, - distance: ArrayLike[float], - quad_segs: SupportsIndex = 8, - join_style: BufferJoinStyle | Literal["round", "mitre", "bevel"] = "round", - mitre_limit: float = 5.0, - **kwargs, -) -> GeoArray: ... -@overload -def centroid(geometry: Geometry, **kwargs) -> Point: ... -@overload -def centroid(geometry: None, **kwargs) -> None: ... -@overload -def centroid(geometry: Geometry | None, **kwargs) -> Point | None: ... -@overload -def centroid(geometry: OptGeoArrayLikeSeq, **kwargs) -> GeoArray: ... -@overload -def clip_by_rect(geometry: Geometry, xmin: float, ymin: float, xmax: float, ymax: float, **kwargs) -> BaseGeometry: ... -@overload -def clip_by_rect(geometry: None, xmin: float, ymin: float, xmax: float, ymax: float, **kwargs) -> None: ... -@overload -def clip_by_rect( - geometry: Geometry | None, xmin: float, ymin: float, xmax: float, ymax: float, **kwargs -) -> BaseGeometry | None: ... -@overload -def clip_by_rect(geometry: OptGeoArrayLikeSeq, xmin: float, ymin: float, xmax: float, ymax: float, **kwargs) -> GeoArray: ... -@overload -def concave_hull(geometry: Geometry, ratio: float = 0.0, allow_holes: bool = False, **kwargs) -> BaseGeometry: ... -@overload -def concave_hull(geometry: None, ratio: float = 0.0, allow_holes: bool = False, **kwargs) -> None: ... -@overload -def concave_hull(geometry: Geometry | None, ratio: float = 0.0, allow_holes: bool = False, **kwargs) -> BaseGeometry | None: ... -@overload -def concave_hull(geometry: OptGeoArrayLikeSeq, ratio: float = 0.0, allow_holes: bool = False, **kwargs) -> GeoArray: ... -@overload -def convex_hull(geometry: Geometry, **kwargs) -> BaseGeometry: ... -@overload -def convex_hull(geometry: None, **kwargs) -> None: ... -@overload -def convex_hull(geometry: Geometry | None, **kwargs) -> BaseGeometry | None: ... -@overload -def convex_hull(geometry: OptGeoArrayLikeSeq, **kwargs) -> GeoArray: ... -@overload -def delaunay_triangles( - geometry: Geometry, tolerance: float = 0.0, only_edges: Literal[False] = False, **kwargs -) -> GeometryCollection: ... -@overload -def delaunay_triangles(geometry: Geometry, tolerance: float, only_edges: Literal[True], **kwargs) -> MultiLineString: ... -@overload -def delaunay_triangles(geometry: Geometry, tolerance: float = 0.0, *, only_edges: Literal[True], **kwargs) -> MultiLineString: ... -@overload -def delaunay_triangles( - geometry: Geometry, tolerance: float = 0.0, only_edges: bool = False, **kwargs -) -> GeometryCollection | MultiLineString: ... -@overload -def delaunay_triangles(geometry: None, tolerance: float = 0.0, only_edges: bool = False, **kwargs) -> None: ... -@overload -def delaunay_triangles( - geometry: Geometry | None, tolerance: float = 0.0, only_edges: bool = False, **kwargs -) -> GeometryCollection | MultiLineString | None: ... -@overload -def delaunay_triangles( - geometry: OptGeoArrayLike, tolerance: ArrayLike[float], only_edges: ArrayLikeSeq[bool], **kwargs -) -> GeoArray: ... -@overload -def delaunay_triangles( - geometry: OptGeoArrayLike, tolerance: ArrayLike[float] = 0.0, *, only_edges: ArrayLikeSeq[bool], **kwargs -) -> GeoArray: ... -@overload -def delaunay_triangles( - geometry: OptGeoArrayLike, tolerance: ArrayLikeSeq[float], only_edges: ArrayLike[bool] = False, **kwargs -) -> GeoArray: ... -@overload -def delaunay_triangles( - geometry: OptGeoArrayLikeSeq, tolerance: ArrayLike[float] = 0.0, only_edges: ArrayLike[bool] = False, **kwargs -) -> GeoArray: ... -@overload -def envelope(geometry: Point, **kwargs) -> Point: ... -@overload -def envelope(geometry: Geometry, **kwargs) -> BaseGeometry: ... -@overload -def envelope(geometry: None, **kwargs) -> None: ... -@overload -def envelope(geometry: Geometry | None, **kwargs) -> BaseGeometry | None: ... -@overload -def envelope(geometry: OptGeoArrayLikeSeq, **kwargs) -> GeoArray: ... -@overload -def extract_unique_points(geometry: Geometry, **kwargs) -> MultiPoint: ... -@overload -def extract_unique_points(geometry: None, **kwargs) -> None: ... -@overload -def extract_unique_points(geometry: Geometry | None, **kwargs) -> MultiPoint | None: ... -@overload -def extract_unique_points(geometry: OptGeoArrayLikeSeq, **kwargs) -> GeoArray: ... -@overload -def build_area(geometry: Geometry, **kwargs) -> BaseGeometry: ... -@overload -def build_area(geometry: None, **kwargs) -> None: ... -@overload -def build_area(geometry: Geometry | None, **kwargs) -> BaseGeometry | None: ... -@overload -def build_area(geometry: OptGeoArrayLikeSeq, **kwargs) -> GeoArray: ... -@overload -def make_valid(geometry: Geometry, **kwargs) -> BaseGeometry: ... -@overload -def make_valid(geometry: None, **kwargs) -> None: ... -@overload -def make_valid(geometry: Geometry | None, **kwargs) -> BaseGeometry | None: ... -@overload -def make_valid(geometry: OptGeoArrayLikeSeq, **kwargs) -> GeoArray: ... -@overload -def normalize(geometry: OptGeoT, **kwargs) -> OptGeoT: ... -@overload -def normalize(geometry: OptGeoArrayLikeSeq, **kwargs) -> GeoArray: ... -@overload -def point_on_surface(geometry: Geometry, **kwargs) -> Point: ... -@overload -def point_on_surface(geometry: None, **kwargs) -> None: ... -@overload -def point_on_surface(geometry: Geometry | None, **kwargs) -> Point | None: ... -@overload -def point_on_surface(geometry: OptGeoArrayLikeSeq, **kwargs) -> GeoArray: ... -@overload -def node(geometry: Geometry, **kwargs) -> MultiLineString: ... -@overload -def node(geometry: None, **kwargs) -> None: ... -@overload -def node(geometry: Geometry | None, **kwargs) -> MultiLineString | None: ... -@overload -def node(geometry: OptGeoArrayLikeSeq, **kwargs) -> GeoArray: ... -@overload -def polygonize(geometries: Sequence[Geometry | None], **kwargs) -> GeometryCollection: ... -@overload -def polygonize(geometries: Sequence[Sequence[Geometry | None]], **kwargs) -> GeoArray: ... -@overload -def polygonize(geometries: OptGeoArrayLikeSeq, **kwargs) -> GeometryCollection | GeoArray: ... -@overload -def polygonize_full( - geometries: Sequence[Geometry | None], **kwargs -) -> tuple[GeometryCollection, GeometryCollection, GeometryCollection, GeometryCollection]: ... -@overload -def polygonize_full( - geometries: Sequence[Sequence[Geometry | None]], **kwargs -) -> tuple[GeoArray, GeoArray, GeoArray, GeoArray]: ... -@overload -def polygonize_full( - geometries: OptGeoArrayLikeSeq, **kwargs -) -> ( - tuple[GeometryCollection, GeometryCollection, GeometryCollection, GeometryCollection] - | tuple[GeoArray, GeoArray, GeoArray, GeoArray] -): ... -@overload -def remove_repeated_points(geometry: OptGeoT, tolerance: float = 0.0, **kwargs) -> OptGeoT: ... -@overload -def remove_repeated_points(geometry: OptGeoArrayLikeSeq, tolerance: float = 0.0, **kwargs) -> GeoArray: ... -@overload -def reverse(geometry: OptGeoT, **kwargs) -> OptGeoT: ... -@overload -def reverse(geometry: OptGeoArrayLikeSeq, **kwargs) -> GeoArray: ... -@overload -def segmentize(geometry: OptGeoT, max_segment_length: float, **kwargs) -> OptGeoT: ... -@overload -def segmentize(geometry: OptGeoArrayLike, max_segment_length: ArrayLikeSeq[float], **kwargs) -> GeoArray: ... -@overload -def segmentize(geometry: OptGeoArrayLikeSeq, max_segment_length: ArrayLike[float], **kwargs) -> GeoArray: ... -@overload -def simplify(geometry: OptGeoT, tolerance: float, preserve_topology: bool = True, **kwargs) -> OptGeoT: ... -@overload -def simplify(geometry: OptGeoArrayLike, tolerance: ArrayLikeSeq[float], preserve_topology: bool = True, **kwargs) -> GeoArray: ... -@overload -def simplify(geometry: OptGeoArrayLikeSeq, tolerance: ArrayLike[float], preserve_topology: bool = True, **kwargs) -> GeoArray: ... -@overload -def snap(geometry: OptGeoT, reference: Geometry, tolerance: float, **kwargs) -> OptGeoT: ... -@overload -def snap(geometry: Geometry | None, reference: None, tolerance: float, **kwargs) -> None: ... -@overload -def snap(geometry: OptGeoArrayLikeSeq, reference: OptGeoArrayLike, tolerance: ArrayLike[float], **kwargs) -> GeoArray: ... -@overload -def snap(geometry: OptGeoArrayLike, reference: OptGeoArrayLikeSeq, tolerance: ArrayLike[float], **kwargs) -> GeoArray: ... -@overload -def snap(geometry: OptGeoArrayLike, reference: OptGeoArrayLike, tolerance: ArrayLikeSeq[float], **kwargs) -> GeoArray: ... -@overload -def voronoi_polygons( - geometry: Geometry, tolerance: float = 0.0, extend_to: Geometry | None = None, only_edges: Literal[False] = False, **kwargs -) -> GeometryCollection[Polygon]: ... -@overload -def voronoi_polygons( - geometry: Geometry, tolerance: float, extend_to: Geometry | None, only_edges: Literal[True], **kwargs -) -> LineString | MultiLineString: ... -@overload -def voronoi_polygons( - geometry: Geometry, tolerance: float = 0.0, extend_to: Geometry | None = None, *, only_edges: Literal[True], **kwargs -) -> LineString | MultiLineString: ... -@overload -def voronoi_polygons( - geometry: Geometry, tolerance: float = 0.0, extend_to: Geometry | None = None, only_edges: bool = False, **kwargs -) -> GeometryCollection[Polygon] | LineString | MultiLineString: ... -@overload -def voronoi_polygons( - geometry: None, tolerance: float = 0.0, extend_to: Geometry | None = None, only_edges: bool = False, **kwargs -) -> None: ... -@overload -def voronoi_polygons( - geometry: Geometry | None, tolerance: float = 0.0, extend_to: Geometry | None = None, only_edges: bool = False, **kwargs -) -> GeometryCollection[Polygon] | LineString | MultiLineString | None: ... -@overload -def voronoi_polygons( - geometry: OptGeoArrayLikeSeq, - tolerance: ArrayLike[float] = 0.0, - extend_to: OptGeoArrayLike = None, - only_edges: ArrayLike[bool] = False, - **kwargs, -) -> GeoArray: ... -@overload -def voronoi_polygons( - geometry: OptGeoArrayLike, - tolerance: ArrayLikeSeq[float], - extend_to: OptGeoArrayLike = None, - only_edges: ArrayLike[bool] = False, - **kwargs, -) -> GeoArray: ... -@overload -def voronoi_polygons( - geometry: OptGeoArrayLike, - tolerance: ArrayLike[float], - extend_to: OptGeoArrayLikeSeq, - only_edges: ArrayLike[bool] = False, - **kwargs, -) -> GeoArray: ... -@overload -def voronoi_polygons( - geometry: OptGeoArrayLike, - tolerance: ArrayLike[float] = 0.0, - *, - extend_to: OptGeoArrayLikeSeq, - only_edges: ArrayLike[bool] = False, - **kwargs, -) -> GeoArray: ... -@overload -def voronoi_polygons( - geometry: OptGeoArrayLike, tolerance: ArrayLike[float], extend_to: OptGeoArrayLike, only_edges: ArrayLikeSeq[bool], **kwargs -) -> GeoArray: ... -@overload -def voronoi_polygons( - geometry: OptGeoArrayLike, - tolerance: ArrayLike[float] = 0.0, - extend_to: OptGeoArrayLike = None, - *, - only_edges: ArrayLikeSeq[bool], - **kwargs, -) -> GeoArray: ... -@overload -def oriented_envelope(geometry: Point, **kwargs) -> Point: ... -@overload -def oriented_envelope(geometry: Geometry, **kwargs) -> BaseGeometry: ... -@overload -def oriented_envelope(geometry: None, **kwargs) -> None: ... -@overload -def oriented_envelope(geometry: Geometry | None, **kwargs) -> BaseGeometry | None: ... -@overload -def oriented_envelope(geometry: OptGeoArrayLikeSeq, **kwargs) -> GeoArray: ... - -minimum_rotated_rectangle = oriented_envelope - -@overload -def minimum_bounding_circle(geometry: Point, **kwargs) -> Point: ... -@overload -def minimum_bounding_circle(geometry: LineString | Polygon | BaseMultipartGeometry, **kwargs) -> Polygon: ... -@overload -def minimum_bounding_circle(geometry: Geometry, **kwargs) -> Polygon | Point: ... -@overload -def minimum_bounding_circle(geometry: None, **kwargs) -> None: ... -@overload -def minimum_bounding_circle(geometry: Geometry | None, **kwargs) -> Polygon | Point | None: ... -@overload -def minimum_bounding_circle(geometry: OptGeoArrayLikeSeq, **kwargs) -> GeoArray: ... diff --git a/stubs/shapely-stubs/coordinates.pyi b/stubs/shapely-stubs/coordinates.pyi deleted file mode 100644 index 1b72e48..0000000 --- a/stubs/shapely-stubs/coordinates.pyi +++ /dev/null @@ -1,43 +0,0 @@ -from collections.abc import Callable -from typing import Literal, overload - -import numpy as np -from numpy.typing import NDArray - -from shapely._typing import ArrayLikeSeq, GeoArray, GeoT, OptGeoArrayLike, OptGeoArrayLikeSeq, OptGeoT - -__all__ = ["transform", "count_coordinates", "get_coordinates", "set_coordinates"] - -@overload -def transform( - geometry: OptGeoT, transformation: Callable[[NDArray[np.float64]], NDArray[np.float64]], include_z: bool = False -) -> OptGeoT: ... -@overload -def transform( - geometry: OptGeoArrayLikeSeq, transformation: Callable[[NDArray[np.float64]], NDArray[np.float64]], include_z: bool = False -) -> GeoArray: ... -def count_coordinates(geometry: OptGeoArrayLike) -> int: ... -@overload -def get_coordinates( - geometry: OptGeoArrayLike, include_z: bool = False, return_index: Literal[False] = False -) -> NDArray[np.float64]: ... -@overload -def get_coordinates( - geometry: OptGeoArrayLike, include_z: bool = False, *, return_index: Literal[True] -) -> tuple[NDArray[np.float64], NDArray[np.int64]]: ... -@overload -def get_coordinates( - geometry: OptGeoArrayLike, include_z: bool, return_index: Literal[True] -) -> tuple[NDArray[np.float64], NDArray[np.int64]]: ... -@overload -def get_coordinates( - geometry: OptGeoArrayLike, include_z: bool = False, *, return_index: bool -) -> NDArray[np.float64] | tuple[NDArray[np.float64], NDArray[np.int64]]: ... -@overload -def get_coordinates( - geometry: OptGeoArrayLike, include_z: bool, return_index: bool -) -> NDArray[np.float64] | tuple[NDArray[np.float64], NDArray[np.int64]]: ... -@overload -def set_coordinates(geometry: GeoT, coordinates: ArrayLikeSeq[float]) -> GeoT: ... -@overload -def set_coordinates(geometry: OptGeoArrayLikeSeq, coordinates: ArrayLikeSeq[float]) -> GeoArray: ... diff --git a/stubs/shapely-stubs/coords.pyi b/stubs/shapely-stubs/coords.pyi deleted file mode 100644 index a072aeb..0000000 --- a/stubs/shapely-stubs/coords.pyi +++ /dev/null @@ -1,18 +0,0 @@ -from array import array -from collections.abc import Iterator -from typing import overload - -import numpy as np -from numpy.typing import DTypeLike, NDArray - -class CoordinateSequence: - def __init__(self, coords: NDArray[np.float64]) -> None: ... - def __len__(self) -> int: ... - def __iter__(self) -> Iterator[tuple[float, float]]: ... - @overload - def __getitem__(self, key: int) -> tuple[float, float]: ... - @overload - def __getitem__(self, key: slice) -> list[tuple[float, float]]: ... - def __array__(self, dtype: DTypeLike | None = None) -> NDArray[np.float64]: ... - @property - def xy(self) -> tuple[array[float], array[float]]: ... diff --git a/stubs/shapely-stubs/creation.pyi b/stubs/shapely-stubs/creation.pyi deleted file mode 100644 index d2fba67..0000000 --- a/stubs/shapely-stubs/creation.pyi +++ /dev/null @@ -1,252 +0,0 @@ -from collections.abc import Sequence -from typing import Literal, SupportsIndex, overload - -import numpy as np -from numpy.typing import NDArray - -from shapely._geometry import GeometryType -from shapely._typing import ArrayLike, ArrayLikeSeq, GeoArray, OptGeoArrayLike, OptGeoArrayLikeSeq -from shapely.geometry import GeometryCollection, LinearRing, LineString, MultiLineString, MultiPoint, MultiPolygon, Point, Polygon -from shapely.lib import Geometry - -__all__ = [ - "points", - "linestrings", - "linearrings", - "polygons", - "multipoints", - "multilinestrings", - "multipolygons", - "geometrycollections", - "box", - "prepare", - "destroy_prepared", - "empty", -] - -@overload -def points( - coords: float, # acts as x - y: float, - z: float | None = None, - indices: None = None, - out: None = None, - **kwargs, -) -> Point: ... -@overload -def points( - coords: Sequence[float], # acts as x, y[, z] - y: None = None, - z: None = None, - indices: None = None, - out: None = None, - **kwargs, -) -> Point: ... -@overload -def points( - coords: Sequence[float], # acts as (x1, x2, ...) - y: Sequence[float], # must be (y1, y2, ...) - z: Sequence[float] | None = None, - indices: ArrayLikeSeq[int] | None = None, - out: NDArray[np.object_] | None = None, - **kwargs, -) -> GeoArray: ... -@overload -def points( - coords: Sequence[Sequence[float]], # acts as (x1, x2, ...), (y1, y2, ...)[, (z1, z2, ...)] - y: None = None, - z: None = None, - indices: ArrayLikeSeq[int] | None = None, - out: NDArray[np.object_] | None = None, - **kwargs, -) -> GeoArray: ... -@overload -def points( - coords: ArrayLike[float], - y: ArrayLike[float], - z: ArrayLike[float] | None = None, - indices: ArrayLikeSeq[int] | None = None, - out: NDArray[np.object_] | None = None, - **kwargs, -) -> Point | GeoArray: ... -@overload -def points( - coords: ArrayLikeSeq[float], - y: ArrayLike[float] | None = None, - z: ArrayLike[float] | None = None, - indices: ArrayLikeSeq[int] | None = None, - out: NDArray[np.object_] | None = None, - **kwargs, -) -> Point | GeoArray: ... -@overload -def linestrings( - coords: Sequence[float], # acts as (x1, x2, ...) - y: Sequence[float], - z: Sequence[float] | None = None, - indices: None = None, - out: None = None, - **kwargs, -) -> LineString: ... -@overload -def linestrings( - coords: Sequence[Sequence[float]], # acts as (x1, y1[, z1]), (x2, y2[, z2]), ... - y: None = None, - z: None = None, - indices: None = None, - out: None = None, - **kwargs, -) -> LineString: ... -@overload -def linestrings( - coords: Sequence[Sequence[Sequence[float]]], # acts as seq of (x1, y1[, z1]), (x2, y2[, z2]), ... - y: None = None, - z: None = None, - indices: ArrayLikeSeq[int] | None = None, - out: NDArray[np.object_] | None = None, - **kwargs, -) -> GeoArray: ... -@overload -def linestrings( - coords: ArrayLikeSeq[float], - y: ArrayLikeSeq[float] | None = None, - z: ArrayLikeSeq[float] | None = None, - indices: ArrayLikeSeq[int] | None = None, - out: NDArray[np.object_] | None = None, - **kwargs, -) -> LineString | GeoArray: ... -@overload -def linearrings( - coords: Sequence[float], # acts as (x1, x2, ...) - y: Sequence[float], - z: Sequence[float] | None = None, - indices: None = None, - out: None = None, - **kwargs, -) -> LinearRing: ... -@overload -def linearrings( - coords: Sequence[Sequence[float]], # acts as (x1, y1[, z1]), (x2, y2[, z2]), ... - y: None = None, - z: None = None, - indices: None = None, - out: None = None, - **kwargs, -) -> LinearRing: ... -@overload -def linearrings( - coords: Sequence[Sequence[Sequence[float]]], # acts as seq of (x1, y1[, z1]), (x2, y2[, z2]), ... - y: None = None, - z: None = None, - indices: ArrayLikeSeq[int] | None = None, - out: NDArray[np.object_] | None = None, - **kwargs, -) -> GeoArray: ... -@overload -def linearrings( - coords: ArrayLikeSeq[float], - y: ArrayLikeSeq[float] | None = None, - z: ArrayLikeSeq[float] | None = None, - indices: ArrayLikeSeq[int] | None = None, - out: NDArray[np.object_] | None = None, - **kwargs, -) -> LinearRing | GeoArray: ... -@overload -def polygons( - geometries: LinearRing | Sequence[Sequence[float]] | None, - holes: ArrayLikeSeq[float] | OptGeoArrayLikeSeq | None = None, - indices: None = None, - out: None = None, - **kwargs, -) -> Polygon: ... -@overload -def polygons( - geometries: Sequence[LinearRing | Sequence[Sequence[float]] | None], - holes: ArrayLikeSeq[float] | OptGeoArrayLikeSeq | None = None, - indices: ArrayLikeSeq[int] | None = None, - out: NDArray[np.object_] | None = None, - **kwargs, -) -> GeoArray: ... -@overload -def polygons( - geometries: ArrayLikeSeq[float] | OptGeoArrayLikeSeq, - holes: ArrayLikeSeq[float] | OptGeoArrayLikeSeq | None = None, - indices: ArrayLikeSeq[int] | None = None, - out: NDArray[np.object_] | None = None, - **kwargs, -) -> Polygon | GeoArray: ... -@overload -def box(xmin: float, ymin: float, xmax: float, ymax: float, ccw: bool = True, **kwargs) -> Polygon: ... -@overload -def box( - xmin: ArrayLikeSeq[float], - ymin: ArrayLikeSeq[float], - xmax: ArrayLikeSeq[float], - ymax: ArrayLikeSeq[float], - ccw: bool = True, - **kwargs, -) -> GeoArray: ... -@overload -def multipoints( - geometries: Sequence[Point | Sequence[float] | None], indices: None = None, out: None = None, **kwargs -) -> MultiPoint: ... -@overload -def multipoints( - geometries: Sequence[Sequence[Point | Sequence[float] | None]], - indices: ArrayLikeSeq[int] | None = None, - out: NDArray[np.object_] | None = None, - **kwargs, -) -> GeoArray: ... -@overload -def multipoints( - geometries: OptGeoArrayLikeSeq, indices: ArrayLikeSeq[int] | None = None, out: NDArray[np.object_] | None = None, **kwargs -) -> MultiPoint | GeoArray: ... -@overload -def multilinestrings( - geometries: Sequence[LineString | Sequence[Sequence[float]] | None], indices: None = None, out: None = None, **kwargs -) -> MultiLineString: ... -@overload -def multilinestrings( - geometries: Sequence[Sequence[LineString | Sequence[Sequence[float]] | None]], - indices: ArrayLikeSeq[int] | None = None, - out: NDArray[np.object_] | None = None, - **kwargs, -) -> GeoArray: ... -@overload -def multilinestrings( - geometries: OptGeoArrayLikeSeq, indices: ArrayLikeSeq[int] | None = None, out: NDArray[np.object_] | None = None, **kwargs -) -> MultiLineString | GeoArray: ... -@overload -def multipolygons( - geometries: Sequence[Polygon | Sequence[Sequence[float]] | None], indices: None = None, out: None = None, **kwargs -) -> MultiPolygon: ... -@overload -def multipolygons( - geometries: Sequence[Sequence[Polygon | Sequence[Sequence[float]] | None]], - indices: ArrayLikeSeq[int] | None = None, - out: NDArray[np.object_] | None = None, - **kwargs, -) -> GeoArray: ... -@overload -def multipolygons( - geometries: OptGeoArrayLikeSeq, indices: ArrayLikeSeq[int] | None = None, out: NDArray[np.object_] | None = None, **kwargs -) -> MultiPolygon | GeoArray: ... -@overload -def geometrycollections( - geometries: Sequence[Geometry | None], indices: None = None, out: None = None, **kwargs -) -> GeometryCollection: ... -@overload -def geometrycollections( - geometries: Sequence[Sequence[Geometry | None]], - indices: ArrayLikeSeq[int] | None = None, - out: NDArray[np.object_] | None = None, - **kwargs, -) -> GeoArray: ... -@overload -def geometrycollections( - geometries: OptGeoArrayLikeSeq, indices: ArrayLikeSeq[int] | None = None, out: NDArray[np.object_] | None = None, **kwargs -) -> GeometryCollection | GeoArray: ... -def prepare(geometry: OptGeoArrayLike, **kwargs) -> None: ... -def destroy_prepared(geometry: OptGeoArrayLike, **kwargs) -> None: ... -def empty( - shape: SupportsIndex | Sequence[SupportsIndex], geom_type: GeometryType | int | None = None, order: Literal["C", "F"] = "C" -) -> NDArray[np.object_]: ... diff --git a/stubs/shapely-stubs/decorators.pyi b/stubs/shapely-stubs/decorators.pyi deleted file mode 100644 index d9149d6..0000000 --- a/stubs/shapely-stubs/decorators.pyi +++ /dev/null @@ -1,11 +0,0 @@ -from collections.abc import Callable -from typing import TypeVar - -_F = TypeVar("_F", bound=Callable[..., object]) - -class requires_geos: - version: tuple[int, int, int] - def __init__(self, version: str) -> None: ... - def __call__(self, func: _F) -> _F: ... - -def multithreading_enabled(func: _F) -> _F: ... diff --git a/stubs/shapely-stubs/errors.pyi b/stubs/shapely-stubs/errors.pyi deleted file mode 100644 index 0dc5ee1..0000000 --- a/stubs/shapely-stubs/errors.pyi +++ /dev/null @@ -1,17 +0,0 @@ -from shapely.lib import GEOSException as GEOSException, ShapelyError as ShapelyError - -def setup_signal_checks(interval: int = 10000) -> None: ... - -class UnsupportedGEOSVersionError(ShapelyError): ... -class DimensionError(ShapelyError): ... -class TopologicalError(ShapelyError): ... -class ShapelyDeprecationWarning(FutureWarning): ... -class EmptyPartError(ShapelyError): ... -class GeometryTypeError(ShapelyError): ... - -# deprecated aliases -ReadingError = ShapelyError -WKBReadingError = ShapelyError -WKTReadingError = ShapelyError -PredicateError = ShapelyError -InvalidGeometryError = ShapelyError diff --git a/stubs/shapely-stubs/geometry/__init__.pyi b/stubs/shapely-stubs/geometry/__init__.pyi deleted file mode 100644 index 97227a3..0000000 --- a/stubs/shapely-stubs/geometry/__init__.pyi +++ /dev/null @@ -1,25 +0,0 @@ -from .base import CAP_STYLE as CAP_STYLE, JOIN_STYLE as JOIN_STYLE -from .collection import GeometryCollection as GeometryCollection -from .geo import box as box, mapping as mapping, shape as shape -from .linestring import LineString as LineString -from .multilinestring import MultiLineString as MultiLineString -from .multipoint import MultiPoint as MultiPoint -from .multipolygon import MultiPolygon as MultiPolygon -from .point import Point as Point -from .polygon import LinearRing as LinearRing, Polygon as Polygon - -__all__ = [ - "box", - "shape", - "mapping", - "Point", - "LineString", - "Polygon", - "MultiPoint", - "MultiLineString", - "MultiPolygon", - "GeometryCollection", - "LinearRing", - "CAP_STYLE", - "JOIN_STYLE", -] diff --git a/stubs/shapely-stubs/geometry/base.pyi b/stubs/shapely-stubs/geometry/base.pyi deleted file mode 100644 index 876e288..0000000 --- a/stubs/shapely-stubs/geometry/base.pyi +++ /dev/null @@ -1,285 +0,0 @@ -from array import array -from collections.abc import Iterator -from typing import Any, Generic, Literal, NoReturn, overload -from typing_extensions import Self, TypeVar, deprecated - -import numpy as np -from numpy.typing import NDArray - -from shapely._typing import ArrayLikeSeq, GeoArray, GeoT, OptGeoArrayLike, OptGeoArrayLikeSeq -from shapely.constructive import BufferCapStyle, BufferJoinStyle -from shapely.coords import CoordinateSequence -from shapely.geometry.collection import GeometryCollection -from shapely.geometry.point import Point -from shapely.geometry.polygon import Polygon -from shapely.lib import Geometry - -GEOMETRY_TYPES: list[str] - -@deprecated("Function 'geom_factory' is deprecated.") -def geom_factory(g: int, parent: object | None = None) -> Any: ... -def dump_coords(geom: Geometry) -> list[tuple[float, float] | list[tuple[float, float]]]: ... - -class CAP_STYLE: - round: Literal[BufferCapStyle.round] - flat: Literal[BufferCapStyle.flat] - square: Literal[BufferCapStyle.square] - -class JOIN_STYLE: - round: Literal[BufferJoinStyle.round] - mitre: Literal[BufferJoinStyle.mitre] - bevel: Literal[BufferJoinStyle.bevel] - -class BaseGeometry(Geometry): - @deprecated( - "Directly calling 'BaseGeometry()' is deprecated. To create an empty geometry, " - "use one of the subclasses instead, for example 'GeometryCollection()'." - ) - def __new__(self) -> GeometryCollection: ... - def __bool__(self) -> bool: ... - def __nonzero__(self) -> bool: ... - def __format__(self, format_spec: str) -> str: ... - @overload - def __and__(self, other: Geometry) -> BaseGeometry: ... - @overload - def __and__(self, other: OptGeoArrayLikeSeq) -> GeoArray: ... - @overload - def __and__(self, other: None) -> None: ... - @overload - def __or__(self, other: Geometry) -> BaseGeometry: ... - @overload - def __or__(self, other: OptGeoArrayLikeSeq) -> GeoArray: ... - @overload - def __or__(self, other: None) -> None: ... - @overload - def __sub__(self, other: Geometry) -> BaseGeometry: ... - @overload - def __sub__(self, other: OptGeoArrayLikeSeq) -> GeoArray: ... - @overload - def __sub__(self, other: None) -> None: ... - @overload - def __xor__(self, other: Geometry) -> BaseGeometry: ... - @overload - def __xor__(self, other: OptGeoArrayLikeSeq) -> GeoArray: ... - @overload - def __xor__(self, other: None) -> None: ... - def __eq__(self, other: object) -> bool: ... - def __ne__(self, other: object) -> bool: ... - def __hash__(self) -> int: ... - @property - def coords(self) -> CoordinateSequence: ... - @property - def xy(self) -> tuple[array[float], array[float]]: ... - @property - def __geo_interface__(self) -> dict[str, Any]: ... - @deprecated("Method 'geometryType()' is deprecated. Use attribute 'geom_type' instead.") - def geometryType(self) -> str: ... - @property - @deprecated("Attribute 'type' is deprecated. Use attribute 'geom_type' instead.") - def type(self) -> str: ... - @property - def wkt(self) -> str: ... - @property - def wkb(self) -> bytes: ... - @property - def wkb_hex(self) -> str: ... - def svg(self, scale_factor: float = 1.0, **kwargs) -> str: ... - def _repr_svg_(self) -> str: ... - @property - def geom_type(self) -> str: ... - @property - def area(self) -> float: ... - @overload - def distance(self, other: Geometry | None) -> float: ... - @overload - def distance(self, other: OptGeoArrayLikeSeq) -> NDArray[np.float64]: ... - @overload - def hausdorff_distance(self, other: Geometry | None) -> float: ... - @overload - def hausdorff_distance(self, other: OptGeoArrayLikeSeq) -> NDArray[np.float64]: ... - @property - def length(self) -> float: ... - @property - def minimum_clearance(self) -> float: ... - @property - def boundary(self) -> BaseMultipartGeometry | Any: ... # is None for GeometryCollection - @property - def bounds(self) -> tuple[float, float, float, float]: ... - @property - def centroid(self) -> Point: ... - def point_on_surface(self) -> Point: ... - def representative_point(self) -> Point: ... - @property - def convex_hull(self) -> BaseGeometry: ... - @property - def envelope(self) -> BaseGeometry: ... - @property - def oriented_envelope(self) -> BaseGeometry: ... - @property - def minimum_rotated_rectangle(self) -> BaseGeometry: ... - def buffer( - self, - distance: float, - quad_segs: int = 16, - cap_style: BufferCapStyle | Literal["round", "square", "flat"] = "round", - join_style: BufferJoinStyle | Literal["round", "mitre", "bevel"] = "round", - mitre_limit: float = 5.0, - single_sided: bool = False, - *, - quadsegs: int | None = None, # deprecated - resolution: int | None = None, # to be deprecated - ) -> Polygon: ... - def simplify(self, tolerance: float, preserve_topology: bool = True) -> BaseGeometry: ... - def normalize(self) -> BaseGeometry: ... - @overload - def difference(self, other: Geometry, grid_size: float | None = None) -> BaseGeometry: ... - @overload - def difference(self, other: OptGeoArrayLikeSeq, grid_size: float | None = None) -> GeoArray: ... - @overload - def difference(self, other: None, grid_size: float | None = None) -> None: ... - @overload - def intersection(self, other: Geometry, grid_size: float | None = None) -> BaseGeometry: ... - @overload - def intersection(self, other: OptGeoArrayLikeSeq, grid_size: float | None = None) -> GeoArray: ... - @overload - def intersection(self, other: None, grid_size: float | None = None) -> None: ... - @overload - def symmetric_difference(self, other: Geometry, grid_size: float | None = None) -> BaseGeometry: ... - @overload - def symmetric_difference(self, other: OptGeoArrayLikeSeq, grid_size: float | None = None) -> GeoArray: ... - @overload - def symmetric_difference(self, other: None, grid_size: float | None = None) -> None: ... - @overload - def union(self, other: Geometry, grid_size: float | None = None) -> BaseGeometry: ... - @overload - def union(self, other: OptGeoArrayLikeSeq, grid_size: float | None = None) -> GeoArray: ... - @overload - def union(self, other: None, grid_size: float | None = None) -> None: ... - @property - def has_z(self) -> bool: ... - @property - def is_empty(self) -> bool: ... - @property - def is_ring(self) -> bool: ... - @property - def is_closed(self) -> bool: ... - @property - def is_simple(self) -> bool: ... - @property - def is_valid(self) -> bool: ... - @overload - def relate(self, other: Geometry) -> str: ... - @overload - def relate(self, other: OptGeoArrayLikeSeq) -> NDArray[np.str_]: ... - @overload - def relate(self, other: None) -> None: ... - @overload - def covers(self, other: Geometry | None) -> bool: ... - @overload - def covers(self, other: OptGeoArrayLikeSeq) -> NDArray[np.bool_]: ... - @overload - def covered_by(self, other: Geometry | None) -> bool: ... - @overload - def covered_by(self, other: OptGeoArrayLikeSeq) -> NDArray[np.bool_]: ... - @overload - def contains(self, other: Geometry | None) -> bool: ... - @overload - def contains(self, other: OptGeoArrayLikeSeq) -> NDArray[np.bool_]: ... - @overload - def contains_properly(self, other: Geometry | None) -> bool: ... - @overload - def contains_properly(self, other: OptGeoArrayLikeSeq) -> NDArray[np.bool_]: ... - @overload - def crosses(self, other: Geometry | None) -> bool: ... - @overload - def crosses(self, other: OptGeoArrayLikeSeq) -> NDArray[np.bool_]: ... - @overload - def disjoint(self, other: Geometry | None) -> bool: ... - @overload - def disjoint(self, other: OptGeoArrayLikeSeq) -> NDArray[np.bool_]: ... - @overload - def equals(self, other: Geometry | None) -> bool: ... - @overload - def equals(self, other: OptGeoArrayLikeSeq) -> NDArray[np.bool_]: ... - @overload - def intersects(self, other: Geometry | None) -> bool: ... - @overload - def intersects(self, other: OptGeoArrayLikeSeq) -> NDArray[np.bool_]: ... - @overload - def overlaps(self, other: Geometry | None) -> bool: ... - @overload - def overlaps(self, other: OptGeoArrayLikeSeq) -> NDArray[np.bool_]: ... - @overload - def touches(self, other: Geometry | None) -> bool: ... - @overload - def touches(self, other: OptGeoArrayLikeSeq) -> NDArray[np.bool_]: ... - @overload - def within(self, other: Geometry | None) -> bool: ... - @overload - def within(self, other: OptGeoArrayLikeSeq) -> NDArray[np.bool_]: ... - @overload - def dwithin(self, other: Geometry | None, distance: float) -> bool: ... - @overload - def dwithin(self, other: OptGeoArrayLikeSeq, distance: float) -> NDArray[np.bool_]: ... - @overload - def dwithin(self, other: OptGeoArrayLike, distance: ArrayLikeSeq[float]) -> NDArray[np.bool_]: ... - @overload - def equals_exact(self, other: Geometry | None, tolerance: float) -> bool: ... - @overload - def equals_exact(self, other: OptGeoArrayLikeSeq, tolerance: float) -> NDArray[np.bool_]: ... - @overload - def equals_exact(self, other: OptGeoArrayLike, tolerance: ArrayLikeSeq[float]) -> NDArray[np.bool_]: ... - @deprecated("Method 'almost_equals()' is deprecated. Use method 'equals_exact()' instead.") - def almost_equals(self, other: OptGeoArrayLike, decimal: int = 6) -> bool | NDArray[np.bool_]: ... - @overload - def relate_pattern(self, other: Geometry | None, pattern: str) -> bool: ... - @overload - def relate_pattern(self, other: OptGeoArrayLikeSeq, pattern: str) -> NDArray[np.bool_]: ... - @overload - def line_locate_point(self, other: Point | None, normalized: bool = False) -> float: ... - @overload - def line_locate_point(self, other: OptGeoArrayLikeSeq, normalized: bool = False) -> NDArray[np.float64]: ... - @overload - def project(self, other: Point | None, normalized: bool = False) -> float: ... - @overload - def project(self, other: OptGeoArrayLikeSeq, normalized: bool = False) -> NDArray[np.float64]: ... - @overload - def line_interpolate_point(self, distance: float, normalized: bool = False) -> Point: ... - @overload - def line_interpolate_point(self, distance: ArrayLikeSeq[float], normalized: bool = False) -> GeoArray: ... - @overload - def interpolate(self, distance: float, normalized: bool = False) -> Point: ... - @overload - def interpolate(self, distance: ArrayLikeSeq[float], normalized: bool = False) -> GeoArray: ... - @overload - def segmentize(self, max_segment_length: float) -> Self: ... - @overload - def segmentize(self, max_segment_length: ArrayLikeSeq[float]) -> GeoArray: ... - def reverse(self) -> Self: ... - -_GeoT_co = TypeVar("_GeoT_co", bound=Geometry, default=BaseGeometry, covariant=True) - -class BaseMultipartGeometry(BaseGeometry, Generic[_GeoT_co]): - @property - def coords(self) -> NoReturn: ... - @property - def geoms(self) -> GeometrySequence[Self]: ... - def svg(self, scale_factor: float = 1.0, color: str | None = None) -> str: ... # type: ignore[override] - -_P_co = TypeVar("_P_co", covariant=True, bound=BaseMultipartGeometry[Geometry]) - -class GeometrySequence(Generic[_P_co]): - def __init__(self, parent: _P_co) -> None: ... - def __iter__(self: GeometrySequence[BaseMultipartGeometry[GeoT]]) -> Iterator[GeoT]: ... - def __len__(self) -> int: ... - @overload - def __getitem__(self: GeometrySequence[BaseMultipartGeometry[GeoT]], key: int | np.integer[Any]) -> GeoT: ... - @overload - def __getitem__(self, key: slice) -> _P_co: ... - -class EmptyGeometry(BaseGeometry): - @deprecated( - "The 'EmptyGeometry()' constructor is deprecated. Use one of the " - "geometry subclasses instead, for example 'GeometryCollection()'." - ) - def __new__(self) -> GeometryCollection: ... # type: ignore[misc] diff --git a/stubs/shapely-stubs/geometry/collection.pyi b/stubs/shapely-stubs/geometry/collection.pyi deleted file mode 100644 index 2cba5ba..0000000 --- a/stubs/shapely-stubs/geometry/collection.pyi +++ /dev/null @@ -1,17 +0,0 @@ -from collections.abc import Collection -from typing_extensions import Self, overload - -from shapely._typing import OptGeoArrayLike -from shapely.geometry.base import BaseMultipartGeometry, GeometrySequence, _GeoT_co - -class GeometryCollection(BaseMultipartGeometry[_GeoT_co]): - # Overloads of __new__ are used because mypy is unable to narrow the typevar otherwise - @overload - def __new__( - self, geoms: BaseMultipartGeometry[_GeoT_co] | GeometrySequence[BaseMultipartGeometry[_GeoT_co]] | Collection[_GeoT_co] - ) -> Self: ... - @overload - def __new__(self, geoms: OptGeoArrayLike = None) -> Self: ... - # more precise base overrides - @property - def boundary(self) -> None: ... diff --git a/stubs/shapely-stubs/geometry/geo.pyi b/stubs/shapely-stubs/geometry/geo.pyi deleted file mode 100644 index 505e589..0000000 --- a/stubs/shapely-stubs/geometry/geo.pyi +++ /dev/null @@ -1,9 +0,0 @@ -from typing import Any - -from shapely._typing import SupportsGeoInterface -from shapely.geometry.base import BaseGeometry -from shapely.geometry.polygon import Polygon - -def box(minx: float, miny: float, maxx: float, maxy: float, ccw: bool = True) -> Polygon: ... -def shape(context: dict[str, Any] | SupportsGeoInterface) -> BaseGeometry: ... -def mapping(ob: SupportsGeoInterface) -> dict[str, Any]: ... diff --git a/stubs/shapely-stubs/geometry/linestring.pyi b/stubs/shapely-stubs/geometry/linestring.pyi deleted file mode 100644 index 603d7b7..0000000 --- a/stubs/shapely-stubs/geometry/linestring.pyi +++ /dev/null @@ -1,45 +0,0 @@ -from collections.abc import Iterable -from typing import Literal, SupportsFloat, SupportsIndex -from typing_extensions import Self, TypeAlias - -from shapely._typing import ArrayLikeSeq -from shapely.constructive import BufferJoinStyle -from shapely.geometry.base import BaseGeometry -from shapely.geometry.multilinestring import MultiLineString -from shapely.geometry.multipoint import MultiPoint -from shapely.geometry.point import Point -from shapely.geometry.polygon import Polygon - -__all__ = ["LineString"] - -_ConvertibleToLineString: TypeAlias = LineString | ArrayLikeSeq[float] | Iterable[Point | Iterable[SupportsFloat]] - -class LineString(BaseGeometry): - def __new__(self, coordinates: _ConvertibleToLineString | None = None) -> Self: ... - def svg(self, scale_factor: float = 1.0, stroke_color: str | None = None, opacity: float | None = None) -> str: ... # type: ignore[override] - def offset_curve( - self, - distance: float, - quad_segs: SupportsIndex = 16, - join_style: BufferJoinStyle | Literal["round", "mitre", "bevel"] = ..., - mitre_limit: float = 5.0, - ) -> LineString | MultiLineString: ... - def parallel_offset( # to be deprecated - self, - distance: float, - side: str = "right", - resolution: SupportsIndex = 16, - join_style: BufferJoinStyle | Literal["round", "mitre", "bevel"] = ..., - mitre_limit: float = 5.0, - ) -> LineString | MultiLineString: ... - # more precise base overrides - @property - def boundary(self) -> MultiPoint: ... - @property - def convex_hull(self) -> LineString: ... - @property - def envelope(self) -> Polygon: ... - @property - def oriented_envelope(self) -> LineString: ... - @property - def minimum_rotated_rectangle(self) -> LineString: ... diff --git a/stubs/shapely-stubs/geometry/multilinestring.pyi b/stubs/shapely-stubs/geometry/multilinestring.pyi deleted file mode 100644 index 51608ef..0000000 --- a/stubs/shapely-stubs/geometry/multilinestring.pyi +++ /dev/null @@ -1,15 +0,0 @@ -from collections.abc import Collection -from typing_extensions import Self - -from shapely.geometry.base import BaseMultipartGeometry -from shapely.geometry.linestring import LineString, _ConvertibleToLineString -from shapely.geometry.multipoint import MultiPoint - -__all__ = ["MultiLineString"] - -class MultiLineString(BaseMultipartGeometry[LineString]): - def __new__(self, lines: BaseMultipartGeometry | Collection[_ConvertibleToLineString] | None = None) -> Self: ... - def svg(self, scale_factor: float = 1.0, stroke_color: str | None = None, opacity: float | None = None) -> str: ... # type: ignore[override] - # more precise base overrides - @property - def boundary(self) -> MultiPoint: ... diff --git a/stubs/shapely-stubs/geometry/multipoint.pyi b/stubs/shapely-stubs/geometry/multipoint.pyi deleted file mode 100644 index 0128cf7..0000000 --- a/stubs/shapely-stubs/geometry/multipoint.pyi +++ /dev/null @@ -1,20 +0,0 @@ -from collections.abc import Collection -from typing_extensions import Self - -from shapely.geometry.base import BaseMultipartGeometry -from shapely.geometry.collection import GeometryCollection -from shapely.geometry.point import Point, _PointLike - -__all__ = ["MultiPoint"] - -class MultiPoint(BaseMultipartGeometry[Point]): - # Note on "points" type in `__new__`: - # * `Collection` here is loose as the expected type should support "__getitem__". - # * `Sequence` is more correct but it will lead to False positives with common types - # like np.ndarray, pd.Index, pd.Series, ... - # I went with Collection as false negatives seem better to me than false positives in this case - def __new__(self, points: MultiPoint | Collection[_PointLike] | None = None) -> Self: ... - def svg(self, scale_factor: float = 1.0, fill_color: str | None = None, opacity: float | None = None) -> str: ... # type: ignore[override] - # more precise base overrides - @property - def boundary(self) -> GeometryCollection: ... # empty geometry collection diff --git a/stubs/shapely-stubs/geometry/multipolygon.pyi b/stubs/shapely-stubs/geometry/multipolygon.pyi deleted file mode 100644 index 667a4dc..0000000 --- a/stubs/shapely-stubs/geometry/multipolygon.pyi +++ /dev/null @@ -1,22 +0,0 @@ -from collections.abc import Collection -from typing_extensions import Self - -from shapely.geometry.base import BaseMultipartGeometry -from shapely.geometry.multilinestring import MultiLineString -from shapely.geometry.polygon import Polygon, _PolygonHolesLike, _PolygonShellLike - -__all__ = ["MultiPolygon"] - -class MultiPolygon(BaseMultipartGeometry[Polygon]): - def __new__( - self, - polygons: ( - BaseMultipartGeometry - | Collection[Polygon | tuple[_PolygonShellLike] | tuple[_PolygonShellLike, _PolygonHolesLike] | None] - | None - ) = None, - ) -> Self: ... - def svg(self, scale_factor: float = 1.0, fill_color: str | None = None, opacity: float | None = None) -> str: ... # type: ignore[override] - # more precise base overrides - @property - def boundary(self) -> MultiLineString: ... diff --git a/stubs/shapely-stubs/geometry/point.pyi b/stubs/shapely-stubs/geometry/point.pyi deleted file mode 100644 index 8572ba5..0000000 --- a/stubs/shapely-stubs/geometry/point.pyi +++ /dev/null @@ -1,39 +0,0 @@ -from collections.abc import Iterable -from typing import overload -from typing_extensions import Self, TypeAlias - -from shapely._typing import ArrayLikeSeq -from shapely.geometry.base import BaseGeometry -from shapely.geometry.collection import GeometryCollection - -__all__ = ["Point"] - -_PointLike: TypeAlias = Point | Iterable[float] | ArrayLikeSeq[float] - -class Point(BaseGeometry): - @overload # no args: empty point - def __new__(self) -> Self: ... - @overload # one arg: (x, y[, z]) tuple or a Point instance - def __new__(self, coords: _PointLike, /) -> Self: ... - @overload # two args: (x, y) tuple - def __new__(self, x: float, y: float, /) -> Self: ... - @overload # three args: (x, y, z) tuple - def __new__(self, x: float, y: float, z: float, /) -> Self: ... - @property - def x(self) -> float: ... - @property - def y(self) -> float: ... - @property - def z(self) -> float: ... - def svg(self, scale_factor: float = 1.0, fill_color: str | None = None, opacity: float | None = None) -> str: ... # type: ignore[override] - # more precise base overrides - @property - def boundary(self) -> GeometryCollection: ... # empty geometry collection - @property - def convex_hull(self) -> Point: ... - @property - def envelope(self) -> Point: ... - @property - def oriented_envelope(self) -> Point: ... - @property - def minimum_rotated_rectangle(self) -> Point: ... diff --git a/stubs/shapely-stubs/geometry/polygon.pyi b/stubs/shapely-stubs/geometry/polygon.pyi deleted file mode 100644 index c21910e..0000000 --- a/stubs/shapely-stubs/geometry/polygon.pyi +++ /dev/null @@ -1,45 +0,0 @@ -from collections.abc import Collection -from typing import NoReturn, overload -from typing_extensions import Self, TypeAlias - -from shapely.geometry.base import BaseGeometry -from shapely.geometry.linestring import LineString, _ConvertibleToLineString -from shapely.geometry.multilinestring import MultiLineString - -__all__ = ["orient", "Polygon", "LinearRing"] - -_ConvertibleToLinearRing: TypeAlias = _ConvertibleToLineString # same alias but with better name for doc purposes -_PolygonShellLike: TypeAlias = Polygon | _ConvertibleToLinearRing | None -_PolygonHolesLike: TypeAlias = Collection[_ConvertibleToLinearRing | None] | None - -class LinearRing(LineString): - def __new__(self, coordinates: _ConvertibleToLinearRing | None = None) -> Self: ... - @property - def is_ccw(self) -> bool: ... - -class InteriorRingSequence: - def __init__(self, parent: Polygon) -> None: ... - def __iter__(self) -> Self: ... - def __next__(self) -> LinearRing: ... - def __len__(self) -> int: ... - @overload - def __getitem__(self, key: int) -> LinearRing: ... - @overload - def __getitem__(self, key: slice) -> list[LinearRing]: ... - -class Polygon(BaseGeometry): - def __new__(self, shell: _PolygonShellLike = None, holes: _PolygonHolesLike = None) -> Self: ... - @property - def exterior(self) -> LinearRing: ... - @property - def interiors(self) -> list[LinearRing] | InteriorRingSequence: ... - @property - def coords(self) -> NoReturn: ... - def svg(self, scale_factor: float = 1.0, fill_color: str | None = None, opacity: float | None = None) -> str: ... # type: ignore[override] - @classmethod - def from_bounds(cls, xmin: float, ymin: float, xmax: float, ymax: float) -> Self: ... - # more precise base overrides - @property - def boundary(self) -> MultiLineString: ... - -def orient(polygon: Polygon, sign: float = 1.0) -> Polygon: ... diff --git a/stubs/shapely-stubs/geos.pyi b/stubs/shapely-stubs/geos.pyi deleted file mode 100644 index 669802c..0000000 --- a/stubs/shapely-stubs/geos.pyi +++ /dev/null @@ -1,3 +0,0 @@ -geos_version_string: str -geos_version: tuple[int, int, int] -geos_capi_version: tuple[int, int, int] diff --git a/stubs/shapely-stubs/io.pyi b/stubs/shapely-stubs/io.pyi deleted file mode 100644 index 58407df..0000000 --- a/stubs/shapely-stubs/io.pyi +++ /dev/null @@ -1,140 +0,0 @@ -from _typeshed import Incomplete -from typing import Literal, overload - -import numpy as np -from numpy.typing import NDArray - -from shapely._enum import ParamEnum -from shapely._ragged_array import from_ragged_array as from_ragged_array, to_ragged_array as to_ragged_array -from shapely._typing import ArrayLikeSeq, GeoArray, OptGeoArrayLikeSeq -from shapely.geometry.base import BaseGeometry -from shapely.lib import Geometry - -__all__ = ["from_geojson", "from_ragged_array", "from_wkb", "from_wkt", "to_geojson", "to_ragged_array", "to_wkb", "to_wkt"] - -# raise is a reserved keyword, we cannot use the class syntax of enums -# Mypy and stubtest aren't happy with the following definition -# DecodingErrorOptions = ParamEnum("DecodingErrorOptions", {"ignore": 0, "warn": 1, "raise": 2}) -DecodingErrorOptions: Incomplete - -class WKBFlavorOptions(ParamEnum): - extended: int - iso: int - -@overload -def to_wkt( - geometry: None, rounding_precision: int = 6, trim: bool = True, output_dimension: int = 3, old_3d: bool = False, **kwargs -) -> None: ... -@overload -def to_wkt( - geometry: Geometry, rounding_precision: int = 6, trim: bool = True, output_dimension: int = 3, old_3d: bool = False, **kwargs -) -> str: ... -@overload -def to_wkt( - geometry: OptGeoArrayLikeSeq, - rounding_precision: int = 6, - trim: bool = True, - output_dimension: int = 3, - old_3d: bool = False, - **kwargs, -) -> NDArray[np.str_]: ... -@overload -def to_wkb( - geometry: None, - hex: bool = False, - output_dimension: int = 3, - byte_order: int = -1, - include_srid: bool = False, - flavor: Literal["iso", "extended"] = "extended", - **kwargs, -) -> None: ... -@overload -def to_wkb( - geometry: Geometry, - hex: Literal[False] = False, - output_dimension: int = 3, - byte_order: int = -1, - include_srid: bool = False, - flavor: Literal["iso", "extended"] = "extended", - **kwargs, -) -> bytes: ... -@overload -def to_wkb( - geometry: Geometry, - hex: Literal[True], - output_dimension: int = 3, - byte_order: int = -1, - include_srid: bool = False, - flavor: Literal["iso", "extended"] = "extended", - **kwargs, -) -> str: ... -@overload -def to_wkb( - geometry: Geometry, - hex: bool, - output_dimension: int = 3, - byte_order: int = -1, - include_srid: bool = False, - flavor: Literal["iso", "extended"] = "extended", - **kwargs, -) -> bytes | str: ... -@overload -def to_wkb( - geometry: OptGeoArrayLikeSeq, - hex: Literal[False] = False, - output_dimension: int = 3, - byte_order: int = -1, - include_srid: bool = False, - flavor: Literal["iso", "extended"] = "extended", - **kwargs, -) -> NDArray[np.bytes_]: ... -@overload -def to_wkb( - geometry: OptGeoArrayLikeSeq, - hex: Literal[True], - output_dimension: int = 3, - byte_order: int = -1, - include_srid: bool = False, - flavor: Literal["iso", "extended"] = "extended", - **kwargs, -) -> NDArray[np.str_]: ... -@overload -def to_wkb( - geometry: OptGeoArrayLikeSeq, - hex: bool, - output_dimension: int = 3, - byte_order: int = -1, - include_srid: bool = False, - flavor: Literal["iso", "extended"] = "extended", - **kwargs, -) -> NDArray[np.bytes_] | NDArray[np.str_]: ... -@overload -def to_geojson(geometry: None, indent: int | None = None, **kwargs) -> None: ... -@overload -def to_geojson(geometry: Geometry, indent: int | None = None, **kwargs) -> str: ... -@overload -def to_geojson(geometry: OptGeoArrayLikeSeq, indent: int | None = None, **kwargs) -> NDArray[np.str_]: ... -@overload -def from_wkt(geometry: None, on_invalid: Literal["raise", "warn", "ignore"] = "raise", **kwargs) -> None: ... -@overload -def from_wkt(geometry: str, on_invalid: Literal["raise", "warn", "ignore"] = "raise", **kwargs) -> BaseGeometry: ... # type: ignore[overload-overlap] -@overload -def from_wkt( - geometry: ArrayLikeSeq[str | None], on_invalid: Literal["raise", "warn", "ignore"] = "raise", **kwargs -) -> GeoArray: ... -@overload -def from_wkb(geometry: None, on_invalid: Literal["raise", "warn", "ignore"] = "raise", **kwargs) -> None: ... -@overload -def from_wkb(geometry: str | bytes, on_invalid: Literal["raise", "warn", "ignore"] = "raise", **kwargs) -> BaseGeometry: ... # type: ignore[overload-overlap] -@overload -def from_wkb( - geometry: ArrayLikeSeq[str | bytes | None], on_invalid: Literal["raise", "warn", "ignore"] = "raise", **kwargs -) -> GeoArray: ... -@overload -def from_geojson(geometry: None, on_invalid: Literal["raise", "warn", "ignore"] = "raise", **kwargs) -> None: ... -@overload -def from_geojson(geometry: str | bytes, on_invalid: Literal["raise", "warn", "ignore"] = "raise", **kwargs) -> BaseGeometry: ... # type: ignore[overload-overlap] -@overload -def from_geojson( - geometry: ArrayLikeSeq[str | bytes | None], on_invalid: Literal["raise", "warn", "ignore"] = "raise", **kwargs -) -> GeoArray: ... diff --git a/stubs/shapely-stubs/lib.pyi b/stubs/shapely-stubs/lib.pyi deleted file mode 100644 index dc85172..0000000 --- a/stubs/shapely-stubs/lib.pyi +++ /dev/null @@ -1,423 +0,0 @@ -from typing import Literal, SupportsIndex, final, overload -from typing_extensions import Never - -import numpy as np -from numpy.typing import NDArray - -# ruff: noqa: PYI021 - -area: np.ufunc -"""area(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -boundary: np.ufunc -"""boundary(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -bounds: np.ufunc -"""bounds(x, /, out=None, *, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj, axes, axis])""" - -box: np.ufunc -"""box(x1, x2, x3, x4, x5, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -buffer: np.ufunc -"""buffer(x1, x2, x3, x4, x5, x6, x7, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -build_area: np.ufunc -"""build_area(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -centroid: np.ufunc -"""centroid(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -clip_by_rect: np.ufunc -"""clip_by_rect(x1, x2, x3, x4, x5, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -concave_hull: np.ufunc -"""concave_hull(x1, x2, x3, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -contains: np.ufunc -"""contains(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -contains_properly: np.ufunc -"""contains_properly(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -contains_xy: np.ufunc -"""contains_xy(x1, x2, x3, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -convex_hull: np.ufunc -"""convex_hull(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -coverage_union: np.ufunc -"""coverage_union(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -covered_by: np.ufunc -"""covered_by(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -covers: np.ufunc -"""covers(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -create_collection: np.ufunc -"""create_collection(x1, x2, /, out=None, *, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj, axes, axis])""" - -crosses: np.ufunc -"""crosses(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -delaunay_triangles: np.ufunc -"""delaunay_triangles(x1, x2, x3, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -destroy_prepared: np.ufunc -"""destroy_prepared(x, /, out=(), *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -difference: np.ufunc -"""difference(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -difference_prec: np.ufunc -"""difference_prec(x1, x2, x3, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -disjoint: np.ufunc -"""disjoint(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -distance: np.ufunc -"""distance(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -dwithin: np.ufunc -"""dwithin(x1, x2, x3, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -envelope: np.ufunc -"""envelope(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -equals: np.ufunc -"""equals(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -equals_exact: np.ufunc -"""equals_exact(x1, x2, x3, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -extract_unique_points: np.ufunc -"""extract_unique_points(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -force_2d: np.ufunc -"""force_2d(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -force_3d: np.ufunc -"""force_3d(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -frechet_distance: np.ufunc -"""frechet_distance(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -frechet_distance_densify: np.ufunc -"""frechet_distance_densify(x1, x2, x3, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -from_geojson: np.ufunc -"""from_geojson(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -from_wkb: np.ufunc -"""from_wkb(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -from_wkt: np.ufunc -"""from_wkt(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -get_coordinate_dimension: np.ufunc -"""get_coordinate_dimension(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -get_dimensions: np.ufunc -"""get_dimensions(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -get_exterior_ring: np.ufunc -"""get_exterior_ring(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -get_geometry: np.ufunc -"""get_geometry(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -get_interior_ring: np.ufunc -"""get_interior_ring(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -get_num_coordinates: np.ufunc -"""get_num_coordinates(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -get_num_geometries: np.ufunc -"""get_num_geometries(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -get_num_interior_rings: np.ufunc -"""get_num_interior_rings(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -get_num_points: np.ufunc -"""get_num_points(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -get_point: np.ufunc -"""get_point(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -get_precision: np.ufunc -"""get_precision(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -get_srid: np.ufunc -"""get_srid(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -get_type_id: np.ufunc -"""get_type_id(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -get_x: np.ufunc -"""get_x(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -get_y: np.ufunc -"""get_y(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -get_z: np.ufunc -"""get_z(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -has_z: np.ufunc -"""has_z(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -hausdorff_distance: np.ufunc -"""hausdorff_distance(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -hausdorff_distance_densify: np.ufunc -"""hausdorff_distance_densify(x1, x2, x3, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -intersection: np.ufunc -"""intersection(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -intersection_all: np.ufunc -"""intersection_all(x, /, out=None, *, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj, axes, axis])""" - -intersection_prec: np.ufunc -"""intersection_prec(x1, x2, x3, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -intersects: np.ufunc -"""intersects(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -intersects_xy: np.ufunc -"""intersects_xy(x1, x2, x3, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -is_ccw: np.ufunc -"""is_ccw(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -is_closed: np.ufunc -"""is_closed(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -is_empty: np.ufunc -"""is_empty(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -is_geometry: np.ufunc -"""is_geometry(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -is_missing: np.ufunc -"""is_missing(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -is_prepared: np.ufunc -"""is_prepared(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -is_ring: np.ufunc -"""is_ring(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -is_simple: np.ufunc -"""is_simple(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -is_valid: np.ufunc -"""is_valid(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -is_valid_input: np.ufunc -"""is_valid_input(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -is_valid_reason: np.ufunc -"""is_valid_reason(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -length: np.ufunc -"""length(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -line_interpolate_point: np.ufunc -"""line_interpolate_point(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -line_interpolate_point_normalized: np.ufunc -"""line_interpolate_point_normalized(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -line_locate_point: np.ufunc -"""line_locate_point(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -line_locate_point_normalized: np.ufunc -"""line_locate_point_normalized(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -line_merge: np.ufunc -"""line_merge(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -line_merge_directed: np.ufunc -"""line_merge_directed(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -linearrings: np.ufunc -"""linearrings(x, /, out=None, *, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj, axes, axis])""" - -linestrings: np.ufunc -"""linestrings(x, /, out=None, *, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj, axes, axis])""" - -make_valid: np.ufunc -"""make_valid(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -minimum_bounding_circle: np.ufunc -"""minimum_bounding_circle(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -minimum_bounding_radius: np.ufunc -"""minimum_bounding_radius(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -minimum_clearance: np.ufunc -"""minimum_clearance(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -node: np.ufunc -"""node(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -normalize: np.ufunc -"""normalize(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -offset_curve: np.ufunc -"""offset_curve(x1, x2, x3, x4, x5, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -oriented_envelope: np.ufunc -"""oriented_envelope(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -overlaps: np.ufunc -"""overlaps(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -point_on_surface: np.ufunc -"""point_on_surface(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -points: np.ufunc -"""points(x, /, out=None, *, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj, axes, axis])""" - -polygonize: np.ufunc -"""polygonize(x, /, out=None, *, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj, axes, axis])""" - -polygonize_full: np.ufunc -"""polygonize_full(x[, out1, out2, out3, out4], / [, out=(None, None, None, None)], *, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj, axes, axis])""" - -polygons: np.ufunc -"""polygons(x1, x2, /, out=None, *, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj, axes, axis])""" - -prepare: np.ufunc -"""prepare(x, /, out=(), *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -relate: np.ufunc -"""relate(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -relate_pattern: np.ufunc -"""relate_pattern(x1, x2, x3, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -remove_repeated_points: np.ufunc -"""remove_repeated_points(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -reverse: np.ufunc -"""reverse(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -segmentize: np.ufunc -"""segmentize(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -set_precision: np.ufunc -"""set_precision(x1, x2, x3, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -set_srid: np.ufunc -"""set_srid(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -shared_paths: np.ufunc -"""shared_paths(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -shortest_line: np.ufunc -"""shortest_line(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -simplify: np.ufunc -"""simplify(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -simplify_preserve_topology: np.ufunc -"""simplify_preserve_topology(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -snap: np.ufunc -"""snap(x1, x2, x3, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -symmetric_difference: np.ufunc -"""symmetric_difference(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -symmetric_difference_all: np.ufunc -"""symmetric_difference_all(x, /, out=None, *, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj, axes, axis])""" - -symmetric_difference_prec: np.ufunc -"""symmetric_difference_prec(x1, x2, x3, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -to_geojson: np.ufunc -"""to_geojson(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -to_wkb: np.ufunc -"""to_wkb(x1, x2, x3, x4, x5, x6, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -to_wkt: np.ufunc -"""to_wkt(x1, x2, x3, x4, x5, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -touches: np.ufunc -"""touches(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -unary_union: np.ufunc -"""unary_union(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -unary_union_prec: np.ufunc -"""unary_union_prec(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -union: np.ufunc -"""union(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -union_prec: np.ufunc -"""union_prec(x1, x2, x3, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -voronoi_polygons: np.ufunc -"""voronoi_polygons(x1, x2, x3, x4, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -within: np.ufunc -"""within(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])""" - -geos_capi_version: tuple[int, int, int] -geos_capi_version_string: str -geos_version: tuple[int, int, int] -geos_version_string: str -registry: list[type[Geometry]] - -class Geometry: - """Geometry type""" - - def __hash__(self) -> int: ... - def __eq__(self, other: object) -> bool: ... - def __ne__(self, other: object) -> bool: ... - def __ge__(self, other: Never) -> bool: ... - def __gt__(self, other: Never) -> bool: ... - def __le__(self, other: Never) -> bool: ... - def __lt__(self, other: Never) -> bool: ... - -@final -class STRtree: - """A query-only R-tree created using the Sort-Tile-Recursive (STR) algorithm.""" - - count: int - """The number of geometries inside the tree""" - def __init__(self, geoms: NDArray[np.object_], node_capacity: SupportsIndex, /, **kwargs: object) -> None: ... - def dwithin(self, geoms: NDArray[np.object_], distances: NDArray[np.float64], /) -> NDArray[np.int64]: - """Queries the index for all item(s) in the tree within given distance of search geometries""" - def nearest(self, geoms: NDArray[np.object_], /) -> NDArray[np.int64]: - """Queries the index for the nearest item to each of the given search geometries""" - def query(self, geoms: NDArray[np.object_], predicate: SupportsIndex, /) -> NDArray[np.int64]: - """Queries the index for all items whose extents intersect the given search geometries, and optionally tests them against predicate function if provided.""" - def query_nearest( - self, geoms: NDArray[np.object_], max_distance: float, exclusive: SupportsIndex, all_matches: SupportsIndex, / - ) -> tuple[NDArray[np.int64], NDArray[np.float64]]: - """Queries the index for all nearest item(s) to each of the given search geometries""" - -class ShapelyError(Exception): ... -class GEOSException(ShapelyError): ... - -def count_coordinates(geoms: NDArray[np.object_], /) -> int: - """Counts the total amount of coordinates in a array with geometry objects""" - -@overload -def get_coordinates(arr: NDArray[np.object_], include_z: bool, return_index: Literal[False], /) -> NDArray[np.float64]: ... -@overload -def get_coordinates( - arr: NDArray[np.object_], include_z: bool, return_index: Literal[True], / -) -> tuple[NDArray[np.float64], NDArray[np.int64]]: ... -@overload -def get_coordinates( - arr: NDArray[np.object_], include_z: bool, return_index: bool, / -) -> NDArray[np.float64] | tuple[NDArray[np.float64], NDArray[np.int64]]: - """Gets the coordinates as an (N, 2) shaped ndarray of floats""" - -def set_coordinates(geoms: NDArray[np.object_], coords: NDArray[np.float64], /) -> NDArray[np.object_]: - """Sets coordinates to a geometry array""" diff --git a/stubs/shapely-stubs/linear.pyi b/stubs/shapely-stubs/linear.pyi deleted file mode 100644 index 224ba0b..0000000 --- a/stubs/shapely-stubs/linear.pyi +++ /dev/null @@ -1,69 +0,0 @@ -from typing import overload - -import numpy as np -from numpy.typing import NDArray - -from shapely._typing import ArrayLike, ArrayLikeSeq, GeoArray, OptGeoArrayLike, OptGeoArrayLikeSeq -from shapely.geometry import GeometryCollection, LineString, MultiLineString, Point -from shapely.lib import Geometry - -__all__ = ["line_interpolate_point", "line_locate_point", "line_merge", "shared_paths", "shortest_line"] - -@overload -def line_interpolate_point(line: None, distance: float, normalized: bool = False, **kwargs) -> None: ... -@overload -def line_interpolate_point( - line: None, distance: ArrayLikeSeq[float], normalized: bool = False, **kwargs -) -> NDArray[np.object_]: ... # Array of None -@overload -def line_interpolate_point( - line: LineString | MultiLineString | GeometryCollection, distance: float, normalized: bool = False, **kwargs -) -> Point: ... -@overload -def line_interpolate_point( - line: LineString | MultiLineString | GeometryCollection, distance: ArrayLikeSeq[float], normalized: bool = False, **kwargs -) -> GeoArray: ... -@overload -def line_interpolate_point( - line: OptGeoArrayLikeSeq, distance: ArrayLike[float], normalized: bool = False, **kwargs -) -> GeoArray: ... -@overload -def line_locate_point( - line: LineString | MultiLineString | GeometryCollection | None, other: Point | None, normalized: bool = False, **kwargs -) -> float: ... -@overload -def line_locate_point( - line: LineString | MultiLineString | GeometryCollection | None, other: OptGeoArrayLikeSeq, normalized: bool = False, **kwargs -) -> NDArray[np.float64]: ... -@overload -def line_locate_point( - line: OptGeoArrayLikeSeq, other: OptGeoArrayLike, normalized: bool = False, **kwargs -) -> NDArray[np.float64]: ... -@overload -def line_merge(line: None, directed: bool = False, **kwargs) -> None: ... -@overload -def line_merge(line: Geometry, directed: bool = False, **kwargs) -> LineString | MultiLineString | GeometryCollection: ... -@overload -def line_merge(line: OptGeoArrayLikeSeq, directed: bool = False, **kwargs) -> GeoArray: ... -@overload -def shared_paths(a: LineString | MultiLineString | None, b: None, **kwargs) -> None: ... -@overload -def shared_paths(a: None, b: LineString | MultiLineString | None, **kwargs) -> None: ... -@overload -def shared_paths( - a: LineString | MultiLineString, b: LineString | MultiLineString, **kwargs -) -> GeometryCollection[MultiLineString]: ... -@overload -def shared_paths(a: LineString | MultiLineString | None, b: OptGeoArrayLikeSeq, **kwargs) -> GeoArray: ... -@overload -def shared_paths(a: OptGeoArrayLikeSeq, b: OptGeoArrayLike, **kwargs) -> GeoArray: ... -@overload -def shortest_line(a: Geometry | None, b: None, **kwargs) -> None: ... -@overload -def shortest_line(a: None, b: Geometry | None, **kwargs) -> None: ... -@overload -def shortest_line(a: Geometry, b: Geometry, **kwargs) -> LineString: ... -@overload -def shortest_line(a: Geometry | None, b: OptGeoArrayLikeSeq, **kwargs) -> GeoArray: ... -@overload -def shortest_line(a: OptGeoArrayLikeSeq, b: OptGeoArrayLike, **kwargs) -> GeoArray: ... diff --git a/stubs/shapely-stubs/measurement.pyi b/stubs/shapely-stubs/measurement.pyi deleted file mode 100644 index 3cd79ce..0000000 --- a/stubs/shapely-stubs/measurement.pyi +++ /dev/null @@ -1,68 +0,0 @@ -from typing import overload - -import numpy as np -from numpy.typing import NDArray - -from shapely._typing import ArrayLike, ArrayLikeSeq, OptGeoArrayLike, OptGeoArrayLikeSeq -from shapely.lib import Geometry - -__all__ = [ - "area", - "distance", - "bounds", - "total_bounds", - "length", - "hausdorff_distance", - "frechet_distance", - "minimum_clearance", - "minimum_bounding_radius", -] - -@overload -def area(geometry: Geometry | None, **kwargs) -> float: ... -@overload -def area(geometry: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.float64]: ... -@overload -def distance(a: Geometry | None, b: Geometry | None, **kwargs) -> float: ... -@overload -def distance(a: OptGeoArrayLikeSeq, b: OptGeoArrayLike, **kwargs) -> NDArray[np.float64]: ... -@overload -def distance(a: OptGeoArrayLike, b: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.float64]: ... -def bounds(geometry: OptGeoArrayLike, **kwargs) -> NDArray[np.float64]: ... -def total_bounds(geometry: OptGeoArrayLike, **kwargs) -> NDArray[np.float64]: ... -@overload -def length(geometry: Geometry | None, **kwargs) -> float: ... -@overload -def length(geometry: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.float64]: ... -@overload -def hausdorff_distance(a: Geometry | None, b: Geometry | None, densify: float | None = None, **kwargs) -> float: ... -@overload -def hausdorff_distance(a: OptGeoArrayLike, b: OptGeoArrayLike, densify: ArrayLikeSeq[float], **kwargs) -> NDArray[np.float64]: ... -@overload -def hausdorff_distance( - a: OptGeoArrayLikeSeq, b: OptGeoArrayLike, densify: ArrayLike[float] | None = None, **kwargs -) -> NDArray[np.float64]: ... -@overload -def hausdorff_distance( - a: OptGeoArrayLike, b: OptGeoArrayLikeSeq, densify: ArrayLike[float] | None = None, **kwargs -) -> NDArray[np.float64]: ... -@overload -def frechet_distance(a: Geometry | None, b: Geometry | None, densify: float | None = None, **kwargs) -> float: ... -@overload -def frechet_distance(a: OptGeoArrayLike, b: OptGeoArrayLike, densify: ArrayLikeSeq[float], **kwargs) -> NDArray[np.float64]: ... -@overload -def frechet_distance( - a: OptGeoArrayLikeSeq, b: OptGeoArrayLike, densify: ArrayLike[float] | None = None, **kwargs -) -> NDArray[np.float64]: ... -@overload -def frechet_distance( - a: OptGeoArrayLike, b: OptGeoArrayLikeSeq, densify: ArrayLike[float] | None = None, **kwargs -) -> NDArray[np.float64]: ... -@overload -def minimum_clearance(geometry: Geometry | None, **kwargs) -> float: ... -@overload -def minimum_clearance(geometry: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.float64]: ... -@overload -def minimum_bounding_radius(geometry: Geometry | None, **kwargs) -> float: ... -@overload -def minimum_bounding_radius(geometry: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.float64]: ... diff --git a/stubs/shapely-stubs/ops.pyi b/stubs/shapely-stubs/ops.pyi deleted file mode 100644 index 87db7ec..0000000 --- a/stubs/shapely-stubs/ops.pyi +++ /dev/null @@ -1,106 +0,0 @@ -from collections.abc import Callable, Iterable -from typing import Any, Literal, overload -from typing_extensions import deprecated - -from shapely._typing import GeoT, OptGeoArrayLike, SupportsGeoInterface -from shapely.algorithms.polylabel import polylabel as polylabel -from shapely.geometry import GeometryCollection, LineString, MultiLineString, Point, Polygon -from shapely.geometry.base import BaseGeometry, BaseMultipartGeometry, GeometrySequence -from shapely.geometry.linestring import _ConvertibleToLineString -from shapely.lib import Geometry - -__all__ = [ - "cascaded_union", - "linemerge", - "operator", - "polygonize", - "polygonize_full", - "transform", - "unary_union", - "triangulate", - "voronoi_diagram", - "split", - "nearest_points", - "validate", - "snap", - "shared_paths", - "clip_by_rect", - "orient", - "substring", -] - -class CollectionOperator: - @overload - def shapeup(self, ob: GeoT) -> GeoT: ... # type: ignore[overload-overlap] - @overload - def shapeup(self, ob: dict[str, Any] | SupportsGeoInterface) -> BaseGeometry: ... # type: ignore[overload-overlap] - @overload - def shapeup(self, ob: _ConvertibleToLineString) -> LineString: ... - def polygonize( - self, lines: OptGeoArrayLike | Iterable[_ConvertibleToLineString | None] - ) -> GeometrySequence[GeometryCollection[Polygon]]: ... - def polygonize_full( - self, lines: OptGeoArrayLike | Iterable[_ConvertibleToLineString | None] - ) -> tuple[ - GeometryCollection[Polygon], GeometryCollection[LineString], GeometryCollection[LineString], GeometryCollection[Polygon] - ]: ... - def linemerge( - self, lines: MultiLineString | BaseMultipartGeometry | Iterable[_ConvertibleToLineString], directed: bool = False - ) -> LineString | MultiLineString: ... - @deprecated("The `cascaded_union()` function is deprecated. Use `unary_union()` instead.") - def cascaded_union(self, geoms: OptGeoArrayLike) -> BaseGeometry: ... - def unary_union(self, geoms: OptGeoArrayLike) -> BaseGeometry: ... - -operator: CollectionOperator -polygonize = operator.polygonize -polygonize_full = operator.polygonize_full -linemerge = operator.linemerge -unary_union = operator.unary_union - -# This is also an alias to operator method but we want to mark it as deprecated -@deprecated("The `cascaded_union()` function is deprecated. Use `unary_union()` instead.") -def cascaded_union(geoms: OptGeoArrayLike) -> BaseGeometry: ... -@overload # edges false -def triangulate(geom: Geometry, tolerance: float = 0.0, edges: Literal[False] = False) -> list[Polygon]: ... -@overload # edges true (keyword) -def triangulate(geom: Geometry, tolerance: float = 0.0, *, edges: Literal[True]) -> list[LineString]: ... -@overload # edges true (positional) -def triangulate(geom: Geometry, tolerance: float, edges: Literal[True]) -> list[LineString]: ... -@overload # fallback -def triangulate(geom: Geometry, tolerance: float = 0.0, edges: bool = False) -> list[Polygon] | list[LineString]: ... -@overload -def voronoi_diagram( - geom: Geometry, envelope: Geometry | None = None, tolerance: float = 0.0, edges: Literal[False] = False -) -> GeometryCollection[Polygon]: ... -@overload -def voronoi_diagram( - geom: Geometry, envelope: Geometry | None, tolerance: float, edges: Literal[True] -) -> GeometryCollection[LineString | MultiLineString]: ... -@overload -def voronoi_diagram( - geom: Geometry, envelope: Geometry | None = None, tolerance: float = 0.0, *, edges: Literal[True] -) -> GeometryCollection[LineString | MultiLineString]: ... -@overload -def voronoi_diagram( - geom: Geometry, envelope: Geometry | None = None, tolerance: float = 0.0, edges: bool = False -) -> GeometryCollection[Polygon | LineString | MultiLineString]: ... -@overload -def validate(geom: None) -> None: ... -@overload -def validate(geom: Geometry) -> str: ... -@overload -def validate(geom: Geometry | None) -> str | None: ... -def transform(func: Callable[[float, float, float | None], tuple[float, ...]], geom: GeoT) -> GeoT: ... -def nearest_points(g1: Geometry, g2: Geometry) -> tuple[Point, Point]: ... -def snap(g1: GeoT, g2: Geometry, tolerance: float) -> GeoT: ... -def shared_paths(g1: LineString, g2: LineString) -> GeometryCollection[MultiLineString]: ... - -class SplitOp: - @staticmethod - def split(geom: Geometry, splitter: Geometry) -> GeometryCollection: ... - -split = SplitOp.split - -def substring(geom: LineString, start_dist: float, end_dist: float, normalized: bool = False) -> Point | LineString: ... -def clip_by_rect(geom: Geometry, xmin: float, ymin: float, xmax: float, ymax: float) -> BaseGeometry: ... -def orient(geom: GeoT, sign: float = 1.0) -> GeoT: ... diff --git a/stubs/shapely-stubs/plotting.pyi b/stubs/shapely-stubs/plotting.pyi deleted file mode 100644 index aef51c4..0000000 --- a/stubs/shapely-stubs/plotting.pyi +++ /dev/null @@ -1,76 +0,0 @@ -from typing import Any, Literal, overload - -from matplotlib.axes import Axes -from matplotlib.lines import Line2D -from matplotlib.patches import PathPatch -from matplotlib.typing import ColorType - -from shapely.geometry import LinearRing, LineString, MultiLineString, MultiPolygon, Polygon -from shapely.lib import Geometry - -def patch_from_polygon(polygon: Polygon | MultiPolygon, **kwargs: Any) -> PathPatch: ... -@overload -def plot_polygon( - polygon: Polygon | MultiPolygon, - ax: Axes | None = None, - add_points: Literal[True] = True, - color: ColorType | None = None, - facecolor: ColorType | None = None, - edgecolor: ColorType | None = None, - linewidth: float | None = None, - **kwargs: Any, -) -> tuple[PathPatch, Line2D]: ... -@overload -def plot_polygon( - polygon: Polygon | MultiPolygon, - ax: Axes | None = None, - *, - add_points: Literal[False], - color: ColorType | None = None, - facecolor: ColorType | None = None, - edgecolor: ColorType | None = None, - linewidth: float | None = None, - **kwargs: Any, -) -> PathPatch: ... -@overload -def plot_polygon( - polygon: Polygon | MultiPolygon, - ax: Axes | None, - add_points: Literal[False], - color: ColorType | None = None, - facecolor: ColorType | None = None, - edgecolor: ColorType | None = None, - linewidth: float | None = None, - **kwargs: Any, -) -> PathPatch: ... -@overload -def plot_line( - line: LineString | LinearRing | MultiLineString, - ax: Axes | None = None, - add_points: Literal[True] = True, - color: ColorType | None = None, - linewidth: float = 2, - **kwargs: Any, -) -> tuple[PathPatch, Line2D]: ... -@overload -def plot_line( - line: LineString | LinearRing | MultiLineString, - ax: Axes | None = None, - *, - add_points: Literal[False], - color: ColorType | None = None, - linewidth: float = 2, - **kwargs: Any, -) -> PathPatch: ... -@overload -def plot_line( - line: LineString | LinearRing | MultiLineString, - ax: Axes | None, - add_points: Literal[False], - color: ColorType | None = None, - linewidth: float = 2, - **kwargs: Any, -) -> PathPatch: ... -def plot_points( - geom: Geometry, ax: Axes | None = None, color: ColorType | None = None, marker: str = "o", **kwargs: Any -) -> Line2D: ... diff --git a/stubs/shapely-stubs/predicates.pyi b/stubs/shapely-stubs/predicates.pyi deleted file mode 100644 index b34d203..0000000 --- a/stubs/shapely-stubs/predicates.pyi +++ /dev/null @@ -1,214 +0,0 @@ -from typing import Any, Literal, overload -from typing_extensions import TypeGuard - -import numpy as np -from numpy.typing import NDArray - -from shapely._typing import ArrayLike, ArrayLikeSeq, OptGeoArrayLike, OptGeoArrayLikeSeq -from shapely.geometry.base import BaseGeometry -from shapely.lib import Geometry - -__all__ = [ - "has_z", - "is_ccw", - "is_closed", - "is_empty", - "is_geometry", - "is_missing", - "is_prepared", - "is_ring", - "is_simple", - "is_valid", - "is_valid_input", - "is_valid_reason", - "crosses", - "contains", - "contains_xy", - "contains_properly", - "covered_by", - "covers", - "disjoint", - "dwithin", - "equals", - "intersects", - "intersects_xy", - "overlaps", - "touches", - "within", - "equals_exact", - "relate", - "relate_pattern", -] - -@overload -def has_z(geometry: Geometry | None, **kwargs) -> bool: ... -@overload -def has_z(geometry: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.bool_]: ... -@overload -def is_ccw(geometry: Geometry | None, **kwargs) -> bool: ... -@overload -def is_ccw(geometry: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.bool_]: ... -@overload -def is_closed(geometry: Geometry | None, **kwargs) -> bool: ... -@overload -def is_closed(geometry: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.bool_]: ... -@overload -def is_empty(geometry: Geometry | None, **kwargs) -> bool: ... -@overload -def is_empty(geometry: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.bool_]: ... -@overload -def is_geometry(geometry: Geometry, **kwargs) -> Literal[True]: ... -@overload -def is_geometry(geometry: ArrayLikeSeq[Any], **kwargs) -> NDArray[np.bool_]: ... # type: ignore[overload-overlap] -@overload -def is_geometry(geometry: object, **kwargs) -> TypeGuard[BaseGeometry]: ... -@overload -def is_missing(geometry: Geometry, **kwargs) -> Literal[True]: ... -@overload -def is_missing(geometry: ArrayLikeSeq[Any], **kwargs) -> NDArray[np.bool_]: ... # type: ignore[overload-overlap] -@overload -def is_missing(geometry: object, **kwargs) -> TypeGuard[BaseGeometry]: ... -@overload -def is_prepared(geometry: Geometry | None, **kwargs) -> bool: ... -@overload -def is_prepared(geometry: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.bool_]: ... -@overload -def is_valid_input(geometry: Geometry | None, **kwargs) -> Literal[True]: ... -@overload -def is_valid_input(geometry: ArrayLikeSeq[Any], **kwargs) -> NDArray[np.bool_]: ... # type: ignore[overload-overlap] -@overload -def is_valid_input(geometry: object, **kwargs) -> TypeGuard[BaseGeometry | None]: ... -@overload -def is_ring(geometry: Geometry | None, **kwargs) -> bool: ... -@overload -def is_ring(geometry: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.bool_]: ... -@overload -def is_simple(geometry: Geometry | None, **kwargs) -> bool: ... -@overload -def is_simple(geometry: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.bool_]: ... -@overload -def is_valid(geometry: Geometry | None, **kwargs) -> bool: ... -@overload -def is_valid(geometry: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.bool_]: ... -@overload -def is_valid_reason(geometry: None, **kwargs) -> None: ... -@overload -def is_valid_reason(geometry: Geometry, **kwargs) -> str: ... -@overload -def is_valid_reason(geometry: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.object_]: ... -@overload -def crosses(a: Geometry | None, b: Geometry | None, **kwargs) -> bool: ... -@overload -def crosses(a: OptGeoArrayLikeSeq, b: OptGeoArrayLike, **kwargs) -> NDArray[np.bool_]: ... -@overload -def crosses(a: OptGeoArrayLike, b: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.bool_]: ... -@overload -def contains(a: Geometry | None, b: Geometry | None, **kwargs) -> bool: ... -@overload -def contains(a: OptGeoArrayLikeSeq, b: OptGeoArrayLike, **kwargs) -> NDArray[np.bool_]: ... -@overload -def contains(a: OptGeoArrayLike, b: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.bool_]: ... -@overload -def contains_properly(a: Geometry | None, b: Geometry | None, **kwargs) -> bool: ... -@overload -def contains_properly(a: OptGeoArrayLikeSeq, b: OptGeoArrayLike, **kwargs) -> NDArray[np.bool_]: ... -@overload -def contains_properly(a: OptGeoArrayLike, b: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.bool_]: ... -@overload -def covered_by(a: Geometry | None, b: Geometry | None, **kwargs) -> bool: ... -@overload -def covered_by(a: OptGeoArrayLikeSeq, b: OptGeoArrayLike, **kwargs) -> NDArray[np.bool_]: ... -@overload -def covered_by(a: OptGeoArrayLike, b: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.bool_]: ... -@overload -def covers(a: Geometry | None, b: Geometry | None, **kwargs) -> bool: ... -@overload -def covers(a: OptGeoArrayLikeSeq, b: OptGeoArrayLike, **kwargs) -> NDArray[np.bool_]: ... -@overload -def covers(a: OptGeoArrayLike, b: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.bool_]: ... -@overload -def disjoint(a: Geometry | None, b: Geometry | None, **kwargs) -> bool: ... -@overload -def disjoint(a: OptGeoArrayLikeSeq, b: OptGeoArrayLike, **kwargs) -> NDArray[np.bool_]: ... -@overload -def disjoint(a: OptGeoArrayLike, b: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.bool_]: ... -@overload -def equals(a: Geometry | None, b: Geometry | None, **kwargs) -> bool: ... -@overload -def equals(a: OptGeoArrayLikeSeq, b: OptGeoArrayLike, **kwargs) -> NDArray[np.bool_]: ... -@overload -def equals(a: OptGeoArrayLike, b: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.bool_]: ... -@overload -def intersects(a: Geometry | None, b: Geometry | None, **kwargs) -> bool: ... -@overload -def intersects(a: OptGeoArrayLikeSeq, b: OptGeoArrayLike, **kwargs) -> NDArray[np.bool_]: ... -@overload -def intersects(a: OptGeoArrayLike, b: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.bool_]: ... -@overload -def overlaps(a: Geometry | None, b: Geometry | None, **kwargs) -> bool: ... -@overload -def overlaps(a: OptGeoArrayLikeSeq, b: OptGeoArrayLike, **kwargs) -> NDArray[np.bool_]: ... -@overload -def overlaps(a: OptGeoArrayLike, b: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.bool_]: ... -@overload -def touches(a: Geometry | None, b: Geometry | None, **kwargs) -> bool: ... -@overload -def touches(a: OptGeoArrayLikeSeq, b: OptGeoArrayLike, **kwargs) -> NDArray[np.bool_]: ... -@overload -def touches(a: OptGeoArrayLike, b: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.bool_]: ... -@overload -def within(a: Geometry | None, b: Geometry | None, **kwargs) -> bool: ... -@overload -def within(a: OptGeoArrayLikeSeq, b: OptGeoArrayLike, **kwargs) -> NDArray[np.bool_]: ... -@overload -def within(a: OptGeoArrayLike, b: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.bool_]: ... -@overload -def equals_exact(a: Geometry | None, b: Geometry | None, tolerance: float = 0.0, **kwargs) -> bool: ... -@overload -def equals_exact(a: OptGeoArrayLike, b: OptGeoArrayLike, tolerance: ArrayLikeSeq[float], **kwargs) -> NDArray[np.bool_]: ... -@overload -def equals_exact(a: OptGeoArrayLikeSeq, b: OptGeoArrayLike, tolerance: ArrayLike[float] = 0.0, **kwargs) -> NDArray[np.bool_]: ... -@overload -def equals_exact(a: OptGeoArrayLike, b: OptGeoArrayLikeSeq, tolerance: ArrayLike[float] = 0.0, **kwargs) -> NDArray[np.bool_]: ... -@overload -def relate(a: Geometry | None, b: None, **kwargs) -> None: ... -@overload -def relate(a: None, b: Geometry | None, **kwargs) -> None: ... -@overload -def relate(a: Geometry, b: Geometry, **kwargs) -> str: ... -@overload -def relate(a: OptGeoArrayLikeSeq, b: OptGeoArrayLike, **kwargs) -> NDArray[np.object_]: ... -@overload -def relate(a: OptGeoArrayLike, b: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.object_]: ... -@overload -def relate_pattern(a: Geometry | None, b: Geometry | None, pattern: str, **kwargs) -> bool: ... -@overload -def relate_pattern(a: OptGeoArrayLikeSeq, b: OptGeoArrayLike, pattern: str, **kwargs) -> NDArray[np.bool_]: ... -@overload -def relate_pattern(a: OptGeoArrayLike, b: OptGeoArrayLikeSeq, pattern: str, **kwargs) -> NDArray[np.bool_]: ... -@overload -def dwithin(a: Geometry | None, b: Geometry | None, distance: float, **kwargs) -> bool: ... -@overload -def dwithin(a: OptGeoArrayLikeSeq, b: OptGeoArrayLike, distance: float, **kwargs) -> NDArray[np.bool_]: ... -@overload -def dwithin(a: OptGeoArrayLike, b: OptGeoArrayLikeSeq, distance: float, **kwargs) -> NDArray[np.bool_]: ... -@overload -def contains_xy(geom: Geometry | None, x: float, y: float, **kwargs) -> bool: ... -@overload -def contains_xy(geom: OptGeoArrayLike, x: ArrayLikeSeq[float], y: None = None, **kwargs) -> NDArray[np.bool_]: ... -@overload -def contains_xy(geom: Geometry | None, x: ArrayLike[float], y: ArrayLikeSeq[float], **kwargs) -> NDArray[np.bool_]: ... -@overload -def contains_xy(geom: Geometry | None, x: ArrayLikeSeq[float], y: ArrayLike[float], **kwargs) -> NDArray[np.bool_]: ... -@overload -def contains_xy(geom: OptGeoArrayLikeSeq, x: ArrayLike[float], y: ArrayLike[float], **kwargs) -> NDArray[np.bool_]: ... -@overload -def intersects_xy(geom: Geometry | None, x: float, y: float, **kwargs) -> bool: ... -@overload -def intersects_xy(geom: OptGeoArrayLike, x: ArrayLikeSeq[float], y: None = None, **kwargs) -> NDArray[np.bool_]: ... -@overload -def intersects_xy(geom: Geometry | None, x: ArrayLike[float], y: ArrayLikeSeq[float], **kwargs) -> NDArray[np.bool_]: ... -@overload -def intersects_xy(geom: Geometry | None, x: ArrayLikeSeq[float], y: ArrayLike[float], **kwargs) -> NDArray[np.bool_]: ... -@overload -def intersects_xy(geom: OptGeoArrayLikeSeq, x: ArrayLike[float], y: ArrayLike[float], **kwargs) -> NDArray[np.bool_]: ... diff --git a/stubs/shapely-stubs/prepared.pyi b/stubs/shapely-stubs/prepared.pyi deleted file mode 100644 index ddce637..0000000 --- a/stubs/shapely-stubs/prepared.pyi +++ /dev/null @@ -1,20 +0,0 @@ -from typing import Generic, Literal - -from shapely._typing import GeoT -from shapely.lib import Geometry - -class PreparedGeometry(Generic[GeoT]): - context: GeoT - prepared: Literal[True] - def __init__(self, context: GeoT | PreparedGeometry[GeoT]) -> None: ... - def contains(self, other: Geometry | None) -> bool: ... - def contains_properly(self, other: Geometry | None) -> bool: ... - def covers(self, other: Geometry | None) -> bool: ... - def crosses(self, other: Geometry | None) -> bool: ... - def disjoint(self, other: Geometry | None) -> bool: ... - def intersects(self, other: Geometry | None) -> bool: ... - def overlaps(self, other: Geometry | None) -> bool: ... - def touches(self, other: Geometry | None) -> bool: ... - def within(self, other: Geometry | None) -> bool: ... - -def prep(ob: GeoT | PreparedGeometry[GeoT]) -> PreparedGeometry[GeoT]: ... diff --git a/stubs/shapely-stubs/set_operations.pyi b/stubs/shapely-stubs/set_operations.pyi deleted file mode 100644 index d735b6c..0000000 --- a/stubs/shapely-stubs/set_operations.pyi +++ /dev/null @@ -1,86 +0,0 @@ -from typing import overload - -from shapely._typing import GeoArray, OptGeoArrayLike, OptGeoArrayLikeSeq -from shapely.geometry.base import BaseGeometry -from shapely.lib import Geometry - -__all__ = [ - "difference", - "intersection", - "intersection_all", - "symmetric_difference", - "symmetric_difference_all", - "unary_union", - "union", - "union_all", - "coverage_union", - "coverage_union_all", -] - -@overload -def difference(a: Geometry, b: Geometry, grid_size: float | None = None, **kwargs) -> BaseGeometry: ... -@overload -def difference(a: None, b: Geometry | None, grid_size: float | None = None, **kwargs) -> None: ... -@overload -def difference(a: Geometry | None, b: None, grid_size: float | None = None, **kwargs) -> None: ... -@overload -def difference(a: OptGeoArrayLikeSeq, b: OptGeoArrayLike, grid_size: float | None = None, **kwargs) -> GeoArray: ... -@overload -def difference(a: OptGeoArrayLike, b: OptGeoArrayLikeSeq, grid_size: float | None = None, **kwargs) -> GeoArray: ... -@overload -def intersection(a: Geometry, b: Geometry, grid_size: float | None = None, **kwargs) -> BaseGeometry: ... -@overload -def intersection(a: None, b: Geometry | None, grid_size: float | None = None, **kwargs) -> None: ... -@overload -def intersection(a: Geometry | None, b: None, grid_size: float | None = None, **kwargs) -> None: ... -@overload -def intersection(a: OptGeoArrayLikeSeq, b: OptGeoArrayLike, grid_size: float | None = None, **kwargs) -> GeoArray: ... -@overload -def intersection(a: OptGeoArrayLike, b: OptGeoArrayLikeSeq, grid_size: float | None = None, **kwargs) -> GeoArray: ... -@overload -def intersection_all(geometries: OptGeoArrayLike, axis: None = None, **kwargs) -> BaseGeometry: ... -@overload -def intersection_all(geometries: OptGeoArrayLikeSeq, axis: int, **kwargs) -> BaseGeometry | GeoArray: ... -@overload -def symmetric_difference(a: Geometry, b: Geometry, grid_size: float | None = None, **kwargs) -> BaseGeometry: ... -@overload -def symmetric_difference(a: None, b: Geometry | None, grid_size: float | None = None, **kwargs) -> None: ... -@overload -def symmetric_difference(a: Geometry | None, b: None, grid_size: float | None = None, **kwargs) -> None: ... -@overload -def symmetric_difference(a: OptGeoArrayLikeSeq, b: OptGeoArrayLike, grid_size: float | None = None, **kwargs) -> GeoArray: ... -@overload -def symmetric_difference(a: OptGeoArrayLike, b: OptGeoArrayLikeSeq, grid_size: float | None = None, **kwargs) -> GeoArray: ... -@overload -def symmetric_difference_all(geometries: OptGeoArrayLike, axis: None = None, **kwargs) -> BaseGeometry: ... -@overload -def symmetric_difference_all(geometries: OptGeoArrayLikeSeq, axis: int, **kwargs) -> BaseGeometry | GeoArray: ... -@overload -def union(a: Geometry, b: Geometry, grid_size: float | None = None, **kwargs) -> BaseGeometry: ... -@overload -def union(a: None, b: Geometry | None, grid_size: float | None = None, **kwargs) -> None: ... -@overload -def union(a: Geometry | None, b: None, grid_size: float | None = None, **kwargs) -> None: ... -@overload -def union(a: OptGeoArrayLikeSeq, b: OptGeoArrayLike, grid_size: float | None = None, **kwargs) -> GeoArray: ... -@overload -def union(a: OptGeoArrayLike, b: OptGeoArrayLikeSeq, grid_size: float | None = None, **kwargs) -> GeoArray: ... -@overload -def union_all(geometries: OptGeoArrayLike, grid_size: float | None = None, axis: None = None, **kwargs) -> BaseGeometry: ... -@overload -def union_all( - geometries: OptGeoArrayLikeSeq, grid_size: float | None = None, *, axis: int, **kwargs -) -> BaseGeometry | GeoArray: ... -@overload -def union_all(geometries: OptGeoArrayLikeSeq, grid_size: float | None, axis: int, **kwargs) -> BaseGeometry | GeoArray: ... - -unary_union = union_all - -@overload -def coverage_union(a: OptGeoArrayLike, b: OptGeoArrayLike, *, axis: None = None, **kwargs) -> BaseGeometry: ... -@overload -def coverage_union(a: OptGeoArrayLike, b: OptGeoArrayLike, *, axis: int, **kwargs) -> BaseGeometry | GeoArray: ... -@overload -def coverage_union_all(geometries: OptGeoArrayLike, axis: None = None, **kwargs) -> BaseGeometry: ... -@overload -def coverage_union_all(geometries: OptGeoArrayLikeSeq, axis: int, **kwargs) -> BaseGeometry | GeoArray: ... diff --git a/stubs/shapely-stubs/speedups.pyi b/stubs/shapely-stubs/speedups.pyi deleted file mode 100644 index c2b505f..0000000 --- a/stubs/shapely-stubs/speedups.pyi +++ /dev/null @@ -1,12 +0,0 @@ -from typing import Final -from typing_extensions import deprecated - -__all__ = ["available", "enable", "disable", "enabled"] - -available: Final = True -enabled: Final = True - -@deprecated("Function `enable` is deprecated and no longer has any effect. Speedups are always available.") -def enable() -> None: ... -@deprecated("Function `disable` is deprecated and no longer has any effect. Speedups are always available.") -def disable() -> None: ... diff --git a/stubs/shapely-stubs/strtree.pyi b/stubs/shapely-stubs/strtree.pyi deleted file mode 100644 index 1e5d5a0..0000000 --- a/stubs/shapely-stubs/strtree.pyi +++ /dev/null @@ -1,82 +0,0 @@ -from typing import Any, Literal, SupportsIndex, overload -from typing_extensions import TypeAlias - -import numpy as np -from numpy.typing import NDArray - -from shapely._enum import ParamEnum -from shapely._typing import ArrayLike, GeoArray, GeoArrayLikeSeq, OptGeoArrayLike -from shapely.lib import Geometry - -__all__ = ["STRtree"] - -_BinaryPredicate: TypeAlias = Literal[ - "intersects", "within", "contains", "overlaps", "crosses", "touches", "covers", "covered_by", "contains_properly" -] - -class BinaryPredicate(ParamEnum): - intersects: int - within: int - contains: int - overlaps: int - crosses: int - touches: int - covers: int - covered_by: int - contains_properly: int - -class STRtree: - def __init__(self, geoms: GeoArrayLikeSeq, node_capacity: SupportsIndex = 10) -> None: ... - def __len__(self) -> int: ... - @property - def geometries(self) -> GeoArray: ... - @overload - def query( - self, geometry: OptGeoArrayLike, predicate: Literal["dwithin"], distance: ArrayLike[float] - ) -> NDArray[np.int64]: ... - @overload - def query( - self, geometry: OptGeoArrayLike, predicate: _BinaryPredicate | None = None, distance: object = None - ) -> NDArray[np.int64]: ... - # nearest may return `None` if the tree is empty, use the "Any trick" - @overload - def nearest(self, geometry: Geometry) -> int | Any: ... - @overload - def nearest(self, geometry: GeoArrayLikeSeq) -> NDArray[np.int64] | Any: ... - @overload # return_distance=False - def query_nearest( - self, - geometry: OptGeoArrayLike, - max_distance: float | None = None, - return_distance: Literal[False] = False, - exclusive: bool = False, - all_matches: bool = True, - ) -> NDArray[np.int64]: ... - @overload # return_distance=True keyword - def query_nearest( - self, - geometry: OptGeoArrayLike, - max_distance: float | None = None, - *, - return_distance: Literal[True], - exclusive: bool = False, - all_matches: bool = True, - ) -> tuple[NDArray[np.int64], NDArray[np.float64]]: ... - @overload # return_distance=True positional - def query_nearest( - self, - geometry: OptGeoArrayLike, - max_distance: float | None, - return_distance: Literal[True], - exclusive: bool = False, - all_matches: bool = True, - ) -> tuple[NDArray[np.int64], NDArray[np.float64]]: ... - @overload # return_distance=bool fallback - def query_nearest( - self, - geometry: OptGeoArrayLike, - max_distance: float | None = None, - return_distance: bool = False, - exclusive: bool = False, - all_matches: bool = True, - ) -> NDArray[np.int64] | tuple[NDArray[np.int64], NDArray[np.float64]]: ... diff --git a/stubs/shapely-stubs/testing.pyi b/stubs/shapely-stubs/testing.pyi deleted file mode 100644 index c7df817..0000000 --- a/stubs/shapely-stubs/testing.pyi +++ /dev/null @@ -1,14 +0,0 @@ -from shapely._typing import ArrayLike, OptGeoArrayLike - -__all__ = ["assert_geometries_equal"] - -def assert_geometries_equal( - x: OptGeoArrayLike, - y: OptGeoArrayLike, - tolerance: ArrayLike[float] = 1e-7, - equal_none: bool = True, - equal_nan: bool = True, - normalize: bool = False, - err_msg: str = "", - verbose: bool = True, -) -> None: ... diff --git a/stubs/shapely-stubs/validation.pyi b/stubs/shapely-stubs/validation.pyi deleted file mode 100644 index 9a2ed28..0000000 --- a/stubs/shapely-stubs/validation.pyi +++ /dev/null @@ -1,7 +0,0 @@ -from shapely.geometry.base import BaseGeometry -from shapely.lib import Geometry - -__all__ = ["explain_validity", "make_valid"] - -def explain_validity(ob: Geometry) -> str: ... -def make_valid(ob: Geometry) -> BaseGeometry: ... diff --git a/stubs/shapely-stubs/vectorized/__init__.pyi b/stubs/shapely-stubs/vectorized/__init__.pyi deleted file mode 100644 index 995e9e6..0000000 --- a/stubs/shapely-stubs/vectorized/__init__.pyi +++ /dev/null @@ -1,37 +0,0 @@ -from typing import overload - -import numpy as np -from numpy.typing import NDArray - -from shapely._typing import ArrayLike, ArrayLikeSeq -from shapely.lib import Geometry -from shapely.prepared import PreparedGeometry - -@overload -def contains(geometry: Geometry | PreparedGeometry[Geometry], x: float, y: float) -> bool: ... -@overload -def contains( - geometry: Geometry | PreparedGeometry[Geometry], x: ArrayLikeSeq[float], y: ArrayLike[float] -) -> NDArray[np.bool_]: ... -@overload -def contains( - geometry: Geometry | PreparedGeometry[Geometry], x: ArrayLike[float], y: ArrayLikeSeq[float] -) -> NDArray[np.bool_]: ... -@overload -def contains( - geometry: Geometry | PreparedGeometry[Geometry], x: ArrayLike[float], y: ArrayLike[float] -) -> bool | NDArray[np.bool_]: ... -@overload -def touches(geometry: Geometry | PreparedGeometry[Geometry], x: float, y: float) -> bool: ... -@overload -def touches( - geometry: Geometry | PreparedGeometry[Geometry], x: ArrayLikeSeq[float], y: ArrayLike[float] -) -> NDArray[np.bool_]: ... -@overload -def touches( - geometry: Geometry | PreparedGeometry[Geometry], x: ArrayLike[float], y: ArrayLikeSeq[float] -) -> NDArray[np.bool_]: ... -@overload -def touches( - geometry: Geometry | PreparedGeometry[Geometry], x: ArrayLike[float], y: ArrayLike[float] -) -> bool | NDArray[np.bool_]: ... diff --git a/stubs/shapely-stubs/wkb.pyi b/stubs/shapely-stubs/wkb.pyi deleted file mode 100644 index 999b760..0000000 --- a/stubs/shapely-stubs/wkb.pyi +++ /dev/null @@ -1,16 +0,0 @@ -from typing import Literal, overload - -from shapely._typing import SupportsRead, SupportsWrite -from shapely.geometry.base import BaseGeometry -from shapely.lib import Geometry - -def loads(data: str | bytes, hex: bool = False) -> BaseGeometry: ... -def load(fp: SupportsRead[str] | SupportsRead[bytes], hex: bool = False) -> BaseGeometry: ... -@overload -def dumps(ob: Geometry, hex: Literal[False] = False, srid: int | None = None, **kw) -> bytes: ... -@overload -def dumps(ob: Geometry, hex: Literal[True], srid: int | None = None, **kw) -> str: ... -@overload -def dump(ob: Geometry, fp: SupportsWrite[bytes], hex: Literal[False] = False, *, srid: int | None = None, **kw) -> None: ... -@overload -def dump(ob: Geometry, fp: SupportsWrite[str], hex: Literal[True], *, srid: int | None = None, **kw) -> None: ... diff --git a/stubs/shapely-stubs/wkt.pyi b/stubs/shapely-stubs/wkt.pyi deleted file mode 100644 index 25529dd..0000000 --- a/stubs/shapely-stubs/wkt.pyi +++ /dev/null @@ -1,8 +0,0 @@ -from shapely._typing import SupportsRead, SupportsWrite -from shapely.geometry.base import BaseGeometry -from shapely.lib import Geometry - -def loads(data: str) -> BaseGeometry: ... -def load(fp: SupportsRead[str]) -> BaseGeometry: ... -def dumps(ob: Geometry, trim: bool = False, rounding_precision: int = -1, **kw) -> str: ... -def dump(ob: Geometry, fp: SupportsWrite[str], *, trim: bool = False, rounding_precision: int = -1, **kw) -> None: ... diff --git a/stubtest_allowlist.txt b/stubtest_allowlist.txt index 7326a29..2d23b64 100644 --- a/stubtest_allowlist.txt +++ b/stubtest_allowlist.txt @@ -1,13 +1,3 @@ -# Shapely -# ======= -# Stub missing -shapely\.geometry\.conftest -shapely\.tests.* - -# Runtime missing -shapely\._typing - - # Geopandas # ========= diff --git a/tests/shapely/test_io.py b/tests/shapely/test_io.py index 97ab9b4..dd77daa 100644 --- a/tests/shapely/test_io.py +++ b/tests/shapely/test_io.py @@ -144,7 +144,7 @@ def test_wkt_module() -> None: check(assert_type(shapely.wkt.dump(P, file), None), NoneType) class WktReader: - def read(self) -> str: + def read(self, length=1) -> str: # TODO length is not required return P_WKT class WktWriter: @@ -166,11 +166,11 @@ def test_wkb_module() -> None: check(assert_type(shapely.wkb.dump(P, file), None), NoneType) class WkbReader: - def read(self) -> bytes: + def read(self, length=1) -> bytes: # TODO length is not required return P_WKB class WkbHexReader: - def read(self) -> str: + def read(self, length=1) -> str: # TODO length is not required return P_WKB_HEX class WkbWriter: From 5ebe29677a4b7a9aee367ff6b929e9e21407b628 Mon Sep 17 00:00:00 2001 From: Ali Hamdan Date: Wed, 29 May 2024 20:51:49 +0200 Subject: [PATCH 2/2] Revert tests change for shaeply regression --- requirements-tests.txt | 2 +- tests/shapely/test_io.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/requirements-tests.txt b/requirements-tests.txt index b4e5bcc..ca65637 100644 --- a/requirements-tests.txt +++ b/requirements-tests.txt @@ -12,7 +12,7 @@ geopandas>=0.14.4,<1.0 # Transient dependencies # ---------------------- # geopandas -types-shapely>=2.0 +types-shapely>=2.0.0.20240527 pandas-stubs>=2.2.2.240514 matplotlib>=3.8.0 folium>=0.16.0 diff --git a/tests/shapely/test_io.py b/tests/shapely/test_io.py index dd77daa..97ab9b4 100644 --- a/tests/shapely/test_io.py +++ b/tests/shapely/test_io.py @@ -144,7 +144,7 @@ def test_wkt_module() -> None: check(assert_type(shapely.wkt.dump(P, file), None), NoneType) class WktReader: - def read(self, length=1) -> str: # TODO length is not required + def read(self) -> str: return P_WKT class WktWriter: @@ -166,11 +166,11 @@ def test_wkb_module() -> None: check(assert_type(shapely.wkb.dump(P, file), None), NoneType) class WkbReader: - def read(self, length=1) -> bytes: # TODO length is not required + def read(self) -> bytes: return P_WKB class WkbHexReader: - def read(self, length=1) -> str: # TODO length is not required + def read(self) -> str: return P_WKB_HEX class WkbWriter: