From f209fdb490a47f4b3f7f60c1b089360871900a94 Mon Sep 17 00:00:00 2001 From: Ali Hamdan Date: Sat, 4 May 2024 20:48:30 +0200 Subject: [PATCH] . --- README.md | 2 +- stubs/shapely-stubs/geometry/base.pyi | 4 ++-- stubs/shapely-stubs/geometry/collection.pyi | 6 +++--- tests/test_shapely/test_ops.py | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index a691a5f..f5568ab 100644 --- a/README.md +++ b/README.md @@ -83,7 +83,7 @@ This project is licensed under the MIT License. GitHub Complete - No + Partially shapely diff --git a/stubs/shapely-stubs/geometry/base.pyi b/stubs/shapely-stubs/geometry/base.pyi index 5dc6ef7..876e288 100644 --- a/stubs/shapely-stubs/geometry/base.pyi +++ b/stubs/shapely-stubs/geometry/base.pyi @@ -257,9 +257,9 @@ class BaseGeometry(Geometry): def segmentize(self, max_segment_length: ArrayLikeSeq[float]) -> GeoArray: ... def reverse(self) -> Self: ... -_GeoT = TypeVar("_GeoT", bound=Geometry, default=BaseGeometry, covariant=True) +_GeoT_co = TypeVar("_GeoT_co", bound=Geometry, default=BaseGeometry, covariant=True) -class BaseMultipartGeometry(BaseGeometry, Generic[_GeoT]): +class BaseMultipartGeometry(BaseGeometry, Generic[_GeoT_co]): @property def coords(self) -> NoReturn: ... @property diff --git a/stubs/shapely-stubs/geometry/collection.pyi b/stubs/shapely-stubs/geometry/collection.pyi index 9ae2462..2cba5ba 100644 --- a/stubs/shapely-stubs/geometry/collection.pyi +++ b/stubs/shapely-stubs/geometry/collection.pyi @@ -2,13 +2,13 @@ from collections.abc import Collection from typing_extensions import Self, overload from shapely._typing import OptGeoArrayLike -from shapely.geometry.base import BaseMultipartGeometry, GeometrySequence, _GeoT +from shapely.geometry.base import BaseMultipartGeometry, GeometrySequence, _GeoT_co -class GeometryCollection(BaseMultipartGeometry[_GeoT]): +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] | GeometrySequence[BaseMultipartGeometry[_GeoT]] | Collection[_GeoT] + self, geoms: BaseMultipartGeometry[_GeoT_co] | GeometrySequence[BaseMultipartGeometry[_GeoT_co]] | Collection[_GeoT_co] ) -> Self: ... @overload def __new__(self, geoms: OptGeoArrayLike = None) -> Self: ... diff --git a/tests/test_shapely/test_ops.py b/tests/test_shapely/test_ops.py index 4e4d4d8..416b250 100644 --- a/tests/test_shapely/test_ops.py +++ b/tests/test_shapely/test_ops.py @@ -49,7 +49,7 @@ def test_polygonize() -> None: dtype=Polygon, ) check(assert_type(poly[0], Polygon), Polygon) - check(assert_type(poly[:], GeometryCollection[Polygon]), GeometryCollection) + check(assert_type(poly[:], "GeometryCollection[Polygon]"), GeometryCollection) check(assert_type(list(poly), list[Polygon]), list, dtype=Polygon) check(assert_type(len(poly), int), int)