From 7c884afe5acc00d1df83390848227f42918ec0d4 Mon Sep 17 00:00:00 2001 From: Mariusz Felisiak Date: Thu, 13 Oct 2022 19:49:57 +0200 Subject: [PATCH] Refs #23919 -- Updated obsolete buffer() references to memoryview(). Obsolete since 8cdc84726e13da4c796db614765658835d4786a1. --- django/contrib/gis/geos/geometry.py | 10 +++++----- docs/ref/contrib/gis/geos.txt | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/django/contrib/gis/geos/geometry.py b/django/contrib/gis/geos/geometry.py index bafb99a058..f030b7fc1d 100644 --- a/django/contrib/gis/geos/geometry.py +++ b/django/contrib/gis/geos/geometry.py @@ -417,7 +417,7 @@ class GEOSGeometryBase(GEOSBase): def wkb(self): """ Return the WKB (Well-Known Binary) representation of this Geometry - as a Python buffer. SRID and Z values are not included, use the + as a Python memoryview. SRID and Z values are not included, use the `ewkb` property instead. """ return wkb_w(3 if self.hasz else 2).write(self) @@ -425,7 +425,7 @@ class GEOSGeometryBase(GEOSBase): @property def ewkb(self): """ - Return the EWKB representation of this Geometry as a Python buffer. + Return the EWKB representation of this Geometry as a Python memoryview. This is an extension of the WKB specification that includes any SRID value that are a part of this geometry. """ @@ -535,7 +535,7 @@ class GEOSGeometryBase(GEOSBase): self, width, quadsegs=8, end_cap_style=1, join_style=1, mitre_limit=5.0 ): """ - Same as buffer() but allows customizing the style of the buffer. + Same as buffer() but allows customizing the style of the memoryview. End cap style can be round (1), flat (2), or square (3). Join style can be round (1), mitre (2), or bevel (3). @@ -721,7 +721,7 @@ class GEOSGeometry(GEOSGeometryBase, ListMixin): - WKT - HEXEWKB (a PostGIS-specific canonical form) - GeoJSON (requires GDAL) - * buffer: + * memoryview: - WKB The `srid` keyword specifies the Source Reference Identifier (SRID) @@ -751,7 +751,7 @@ class GEOSGeometry(GEOSGeometryBase, ListMixin): # When the input is a pointer to a geometry (GEOM_PTR). g = geo_input elif isinstance(geo_input, memoryview): - # When the input is a buffer (WKB). + # When the input is a memoryview (WKB). g = wkb_r().read(geo_input) elif isinstance(geo_input, GEOSGeometry): g = capi.geom_clone(geo_input.ptr) diff --git a/docs/ref/contrib/gis/geos.txt b/docs/ref/contrib/gis/geos.txt index 215f612b4a..8f32883cc1 100644 --- a/docs/ref/contrib/gis/geos.txt +++ b/docs/ref/contrib/gis/geos.txt @@ -181,7 +181,7 @@ Geometry Objects .. class:: GEOSGeometry(geo_input, srid=None) - :param geo_input: Geometry input value (string or buffer) + :param geo_input: Geometry input value (string or :class:`memoryview`) :param srid: spatial reference identifier :type srid: int @@ -206,14 +206,14 @@ The ``srid`` parameter, if given, is set as the SRID of the created geometry if The following input formats, along with their corresponding Python types, are accepted: -======================= ========== +======================= ============== Format Input Type -======================= ========== +======================= ============== WKT / EWKT ``str`` HEX / HEXEWKB ``str`` -WKB / EWKB ``buffer`` +WKB / EWKB ``memoryview`` :rfc:`GeoJSON <7946>` ``str`` -======================= ========== +======================= ============== For the GeoJSON format, the SRID is set based on the ``crs`` member. If ``crs`` isn't provided, the SRID defaults to 4326.