Skip to content

Commit

Permalink
5.0: Update django.contrib.gis.db.backends.postgis.operations (#2138)
Browse files Browse the repository at this point in the history
* 5.0: Update django.contrib.gis.db.backends.postgis.operations

* Update template_params to mutable mapping

* Update template_params type from parent class's as_sql argument.
  • Loading branch information
JaeHyuckSa authored May 13, 2024
1 parent 6ff16d9 commit a70e45c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
8 changes: 7 additions & 1 deletion django-stubs/contrib/gis/db/backends/postgis/operations.pyi
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from typing import Any, Literal
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
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
Expand All @@ -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: MutableMapping[str, Any],
) -> MutableMapping[str, Any]: ...

class ST_Polygon(Func):
function: str
Expand Down
6 changes: 3 additions & 3 deletions django-stubs/contrib/gis/db/backends/utils.pyi
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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: ...
1 change: 0 additions & 1 deletion scripts/stubtest/allowlist_todo.txt
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,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
Expand Down

0 comments on commit a70e45c

Please sign in to comment.