From 1d7ac13c87097f8ef6ca72781fbcff2f0306d764 Mon Sep 17 00:00:00 2001 From: Taku Fukada Date: Mon, 23 Jan 2023 21:48:21 +0900 Subject: [PATCH 1/4] Fix overloading of GeoDjango Layer.get_geoms --- django-stubs/contrib/gis/gdal/layer.pyi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/django-stubs/contrib/gis/gdal/layer.pyi b/django-stubs/contrib/gis/gdal/layer.pyi index 61536322f..da3884579 100644 --- a/django-stubs/contrib/gis/gdal/layer.pyi +++ b/django-stubs/contrib/gis/gdal/layer.pyi @@ -41,7 +41,7 @@ class Layer(GDALBase): spatial_filter: OGRGeometry | None def get_fields(self, field_name: str) -> list[Any]: ... @overload - def get_geoms(self, geos: Literal[True] = ...) -> OGRGeometry: ... + def get_geoms(self, geos: Literal[True] = ...) -> list[GEOSGeometry]: ... @overload - def get_geoms(self, geos: Literal[False]) -> GEOSGeometry: ... + def get_geoms(self, geos: Literal[False]) -> list[OGRGeometry]: ... def test_capability(self, capability: AnyStr) -> bool: ... From 41e0babef6ddfc9dd61c28506ce812362eb8048a Mon Sep 17 00:00:00 2001 From: Taku Fukada Date: Mon, 23 Jan 2023 22:33:24 +0900 Subject: [PATCH 2/4] geometry's wkb is memoryview, not bytes --- django-stubs/contrib/gis/gdal/geometries.pyi | 2 +- django-stubs/contrib/gis/geos/geometry.pyi | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/django-stubs/contrib/gis/gdal/geometries.pyi b/django-stubs/contrib/gis/gdal/geometries.pyi index d55a0aa73..dc6d2a12f 100644 --- a/django-stubs/contrib/gis/gdal/geometries.pyi +++ b/django-stubs/contrib/gis/gdal/geometries.pyi @@ -60,7 +60,7 @@ class OGRGeometry(GDALBase): @property def wkb_size(self) -> int: ... @property - def wkb(self) -> bytes: ... + def wkb(self) -> memoryview: ... @property def wkt(self) -> str: ... @property diff --git a/django-stubs/contrib/gis/geos/geometry.pyi b/django-stubs/contrib/gis/geos/geometry.pyi index 460d906a4..cf36cf948 100644 --- a/django-stubs/contrib/gis/geos/geometry.pyi +++ b/django-stubs/contrib/gis/geos/geometry.pyi @@ -82,7 +82,7 @@ class GEOSGeometryBase(GEOSBase): def json(self) -> str: ... geojson: str @property - def wkb(self) -> bytes: ... + def wkb(self) -> memoryview: ... @property def ewkb(self) -> bytes: ... @property From 6bdb822a45e7c5f1f385792a5df17239a36d2cf5 Mon Sep 17 00:00:00 2001 From: Taku Fukada Date: Mon, 23 Jan 2023 22:41:58 +0900 Subject: [PATCH 3/4] Fix default value for geos param --- django-stubs/contrib/gis/gdal/layer.pyi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/django-stubs/contrib/gis/gdal/layer.pyi b/django-stubs/contrib/gis/gdal/layer.pyi index da3884579..b1666e92e 100644 --- a/django-stubs/contrib/gis/gdal/layer.pyi +++ b/django-stubs/contrib/gis/gdal/layer.pyi @@ -41,7 +41,7 @@ class Layer(GDALBase): spatial_filter: OGRGeometry | None def get_fields(self, field_name: str) -> list[Any]: ... @overload - def get_geoms(self, geos: Literal[True] = ...) -> list[GEOSGeometry]: ... + def get_geoms(self, geos: Literal[False] = ...) -> list[OGRGeometry]: ... @overload - def get_geoms(self, geos: Literal[False]) -> list[OGRGeometry]: ... + def get_geoms(self, geos: Literal[True]) -> list[GEOSGeometry]: ... def test_capability(self, capability: AnyStr) -> bool: ... From b324b9e8ca59f0736cf0d3fef8a1c1536bbce8a5 Mon Sep 17 00:00:00 2001 From: Taku Fukada Date: Tue, 24 Jan 2023 00:00:19 +0900 Subject: [PATCH 4/4] ewkb is also memoryview --- django-stubs/contrib/gis/geos/geometry.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/django-stubs/contrib/gis/geos/geometry.pyi b/django-stubs/contrib/gis/geos/geometry.pyi index cf36cf948..9a190c56d 100644 --- a/django-stubs/contrib/gis/geos/geometry.pyi +++ b/django-stubs/contrib/gis/geos/geometry.pyi @@ -84,7 +84,7 @@ class GEOSGeometryBase(GEOSBase): @property def wkb(self) -> memoryview: ... @property - def ewkb(self) -> bytes: ... + def ewkb(self) -> memoryview: ... @property def kml(self) -> str: ... @property