From f17e0748ee156376966118824ec424cd4c707b89 Mon Sep 17 00:00:00 2001 From: SaJH Date: Thu, 9 May 2024 13:44:37 +0900 Subject: [PATCH 1/3] 5.0: Update django.contrib.gis.db.backends.postgis.operations --- .../contrib/gis/db/backends/postgis/operations.pyi | 8 +++++++- scripts/stubtest/allowlist_todo.txt | 1 - 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/django-stubs/contrib/gis/db/backends/postgis/operations.pyi b/django-stubs/contrib/gis/db/backends/postgis/operations.pyi index eee045678..adb2bab92 100644 --- a/django-stubs/contrib/gis/db/backends/postgis/operations.pyi +++ b/django-stubs/contrib/gis/db/backends/postgis/operations.pyi @@ -1,8 +1,9 @@ -from typing import Any, Literal +from typing import Any, Literal, Mapping from django.contrib.gis.db.backends.base.operations import BaseSpatialOperations from django.contrib.gis.db.backends.utils import SpatialOperator from django.contrib.gis.db.models.fields import GeometryField +from django.contrib.gis.db.models.lookups import GISLookup from django.db.backends.postgresql.operations import DatabaseOperations from django.db.models import Func from django.utils.functional import cached_property @@ -14,6 +15,11 @@ class PostGISOperator(SpatialOperator): raster: bool | Literal["bilateral"] def __init__(self, geography: bool = ..., raster: bool | Literal["bilateral"] = ..., **kwargs: Any) -> None: ... def check_raster(self, lookup: Any, template_params: Any) -> Any: ... + def check_geography( + self, + lookup: GISLookup, + template_params: Mapping[str, Any], + ) -> Mapping[str, Any]: ... class ST_Polygon(Func): function: str diff --git a/scripts/stubtest/allowlist_todo.txt b/scripts/stubtest/allowlist_todo.txt index 45811f582..6ff7d6d85 100644 --- a/scripts/stubtest/allowlist_todo.txt +++ b/scripts/stubtest/allowlist_todo.txt @@ -220,7 +220,6 @@ django.contrib.gis.db.backends.postgis.features.DatabaseFeatures.empty_intersect django.contrib.gis.db.backends.postgis.features.DatabaseFeatures.supports_geography django.contrib.gis.db.backends.postgis.operations.PostGISOperations.convert_extent django.contrib.gis.db.backends.postgis.operations.PostGISOperations.convert_extent3d -django.contrib.gis.db.backends.postgis.operations.PostGISOperator.check_geography django.contrib.gis.db.backends.postgis.schema.PostGISSchemaEditor.rast_index_template django.contrib.gis.db.backends.spatialite.base.DatabaseWrapper.ops django.contrib.gis.db.backends.spatialite.features.DatabaseFeatures.can_alter_geometry_field From 0a81d2bf684f6f05964ea36e5716882bfa1d8ef8 Mon Sep 17 00:00:00 2001 From: SaJH Date: Sat, 11 May 2024 23:32:48 +0900 Subject: [PATCH 2/3] Update template_params to mutable mapping --- django-stubs/contrib/gis/db/backends/postgis/operations.pyi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/django-stubs/contrib/gis/db/backends/postgis/operations.pyi b/django-stubs/contrib/gis/db/backends/postgis/operations.pyi index adb2bab92..0f2c95b77 100644 --- a/django-stubs/contrib/gis/db/backends/postgis/operations.pyi +++ b/django-stubs/contrib/gis/db/backends/postgis/operations.pyi @@ -1,4 +1,4 @@ -from typing import Any, Literal, Mapping +from typing import Any, Literal, MutableMapping from django.contrib.gis.db.backends.base.operations import BaseSpatialOperations from django.contrib.gis.db.backends.utils import SpatialOperator @@ -18,8 +18,8 @@ class PostGISOperator(SpatialOperator): def check_geography( self, lookup: GISLookup, - template_params: Mapping[str, Any], - ) -> Mapping[str, Any]: ... + template_params: MutableMapping[str, Any], + ) -> MutableMapping[str, Any]: ... class ST_Polygon(Func): function: str From 1e2bd94f588395505886d1e1f593d562cdb9d111 Mon Sep 17 00:00:00 2001 From: SaJH Date: Mon, 13 May 2024 03:23:05 +0900 Subject: [PATCH 3/3] Update template_params type from parent class's as_sql argument. --- django-stubs/contrib/gis/db/backends/utils.pyi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/django-stubs/contrib/gis/db/backends/utils.pyi b/django-stubs/contrib/gis/db/backends/utils.pyi index 54e15f709..e83aca1c9 100644 --- a/django-stubs/contrib/gis/db/backends/utils.pyi +++ b/django-stubs/contrib/gis/db/backends/utils.pyi @@ -1,5 +1,5 @@ -from collections.abc import Mapping, Sequence -from typing import Any +from collections.abc import Sequence +from typing import Any, MutableMapping from django.contrib.gis.db.models.lookups import GISLookup from django.db.backends.base.base import BaseDatabaseWrapper @@ -16,6 +16,6 @@ class SpatialOperator: self, connection: BaseDatabaseWrapper, lookup: GISLookup, - template_params: Mapping[str, Any], + template_params: MutableMapping[str, Any], sql_params: Sequence[Any], ) -> _AsSqlType: ...