summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
Diffstat (limited to 'django')
-rw-r--r--django/contrib/gis/db/backends/oracle/models.py14
-rw-r--r--django/contrib/gis/db/backends/oracle/operations.py12
-rw-r--r--django/contrib/gis/db/backends/postgis/adapter.py2
-rw-r--r--django/contrib/gis/db/backends/postgis/models.py2
-rw-r--r--django/contrib/gis/db/backends/spatialite/models.py2
-rw-r--r--django/contrib/gis/gdal/__init__.py34
-rw-r--r--django/contrib/gis/gdal/datasource.py53
-rw-r--r--django/contrib/gis/gdal/envelope.py19
-rw-r--r--django/contrib/gis/gdal/error.py6
-rw-r--r--django/contrib/gis/gdal/geometries.py70
-rw-r--r--django/contrib/gis/gdal/prototypes/ds.py6
-rw-r--r--django/contrib/gis/gdal/prototypes/errcheck.py4
-rw-r--r--django/contrib/gis/gdal/prototypes/generation.py4
-rw-r--r--django/contrib/gis/gdal/srs.py51
-rw-r--r--django/contrib/gis/geos/collections.py4
-rw-r--r--django/contrib/gis/geos/coordseq.py6
-rw-r--r--django/contrib/gis/geos/error.py1
-rw-r--r--django/contrib/gis/geos/geometry.py4
-rw-r--r--django/contrib/gis/geos/libgeos.py10
-rw-r--r--django/contrib/gis/geos/prototypes/__init__.py6
-rw-r--r--django/contrib/gis/geos/prototypes/coordseq.py2
-rw-r--r--django/contrib/gis/geos/prototypes/errcheck.py2
-rw-r--r--django/contrib/gis/geos/prototypes/geom.py3
-rw-r--r--django/contrib/gis/geos/prototypes/misc.py4
-rw-r--r--django/contrib/gis/geos/prototypes/predicates.py6
-rw-r--r--django/contrib/gis/geos/prototypes/topology.py5
-rw-r--r--django/contrib/gis/utils/__init__.py2
-rw-r--r--django/contrib/gis/utils/layermapping.py8
-rw-r--r--django/core/cache/backends/base.py1
-rw-r--r--django/core/cache/backends/db.py1
-rw-r--r--django/core/cache/backends/filebased.py1
-rw-r--r--django/core/cache/backends/locmem.py1
-rw-r--r--django/forms/forms.py1
-rw-r--r--django/template/context.py1
34 files changed, 184 insertions, 164 deletions
diff --git a/django/contrib/gis/db/backends/oracle/models.py b/django/contrib/gis/db/backends/oracle/models.py
index af749c3435..7a69fbc4d0 100644
--- a/django/contrib/gis/db/backends/oracle/models.py
+++ b/django/contrib/gis/db/backends/oracle/models.py
@@ -1,11 +1,11 @@
"""
- The GeometryColumns and SpatialRefSys models for the Oracle spatial
- backend.
+The GeometryColumns and SpatialRefSys models for the Oracle spatial
+backend.
- It should be noted that Oracle Spatial does not have database tables
- named according to the OGC standard, so the closest analogs are used.
- For example, the `USER_SDO_GEOM_METADATA` is used for the GeometryColumns
- model and the `SDO_COORD_REF_SYS` is used for the SpatialRefSys model.
+It should be noted that Oracle Spatial does not have database tables
+named according to the OGC standard, so the closest analogs are used.
+For example, the `USER_SDO_GEOM_METADATA` is used for the GeometryColumns
+model and the `SDO_COORD_REF_SYS` is used for the SpatialRefSys model.
"""
from django.contrib.gis.db import models
@@ -14,6 +14,7 @@ from django.contrib.gis.db.backends.base.models import SpatialRefSysMixin
class OracleGeometryColumns(models.Model):
"Maps to the Oracle USER_SDO_GEOM_METADATA table."
+
table_name = models.CharField(max_length=32)
column_name = models.CharField(max_length=1024)
srid = models.IntegerField(primary_key=True)
@@ -46,6 +47,7 @@ class OracleGeometryColumns(models.Model):
class OracleSpatialRefSys(models.Model, SpatialRefSysMixin):
"Maps to the Oracle MDSYS.CS_SRS table."
+
cs_name = models.CharField(max_length=68)
srid = models.IntegerField(primary_key=True)
auth_srid = models.IntegerField()
diff --git a/django/contrib/gis/db/backends/oracle/operations.py b/django/contrib/gis/db/backends/oracle/operations.py
index adc0a0a860..b8618ae593 100644
--- a/django/contrib/gis/db/backends/oracle/operations.py
+++ b/django/contrib/gis/db/backends/oracle/operations.py
@@ -1,11 +1,11 @@
"""
- This module contains the spatial lookup types, and the `get_geo_where_clause`
- routine for Oracle Spatial.
+This module contains the spatial lookup types, and the `get_geo_where_clause`
+routine for Oracle Spatial.
- Please note that WKT support is broken on the XE version, and thus
- this backend will not work on such platforms. Specifically, XE lacks
- support for an internal JVM, and Java libraries are required to use
- the WKT constructors.
+Please note that WKT support is broken on the XE version, and thus
+this backend will not work on such platforms. Specifically, XE lacks
+support for an internal JVM, and Java libraries are required to use
+the WKT constructors.
"""
import re
diff --git a/django/contrib/gis/db/backends/postgis/adapter.py b/django/contrib/gis/db/backends/postgis/adapter.py
index c9715e1756..581fc23b0b 100644
--- a/django/contrib/gis/db/backends/postgis/adapter.py
+++ b/django/contrib/gis/db/backends/postgis/adapter.py
@@ -1,5 +1,5 @@
"""
- This object provides quoting for GEOS geometries into PostgreSQL/PostGIS.
+This object provides quoting for GEOS geometries into PostgreSQL/PostGIS.
"""
from django.contrib.gis.db.backends.postgis.pgraster import to_pgraster
diff --git a/django/contrib/gis/db/backends/postgis/models.py b/django/contrib/gis/db/backends/postgis/models.py
index e35ef75ce9..c3747d7353 100644
--- a/django/contrib/gis/db/backends/postgis/models.py
+++ b/django/contrib/gis/db/backends/postgis/models.py
@@ -1,5 +1,5 @@
"""
- The GeometryColumns and SpatialRefSys models for the PostGIS backend.
+The GeometryColumns and SpatialRefSys models for the PostGIS backend.
"""
from django.contrib.gis.db.backends.base.models import SpatialRefSysMixin
diff --git a/django/contrib/gis/db/backends/spatialite/models.py b/django/contrib/gis/db/backends/spatialite/models.py
index 0f5f7b55ef..1d564b0ac0 100644
--- a/django/contrib/gis/db/backends/spatialite/models.py
+++ b/django/contrib/gis/db/backends/spatialite/models.py
@@ -1,5 +1,5 @@
"""
- The GeometryColumns and SpatialRefSys models for the SpatiaLite backend.
+The GeometryColumns and SpatialRefSys models for the SpatiaLite backend.
"""
from django.contrib.gis.db.backends.base.models import SpatialRefSysMixin
diff --git a/django/contrib/gis/gdal/__init__.py b/django/contrib/gis/gdal/__init__.py
index e63808d39d..37c9273666 100644
--- a/django/contrib/gis/gdal/__init__.py
+++ b/django/contrib/gis/gdal/__init__.py
@@ -1,29 +1,29 @@
"""
- This module houses ctypes interfaces for GDAL objects. The following GDAL
- objects are supported:
+This module houses ctypes interfaces for GDAL objects. The following GDAL
+objects are supported:
- CoordTransform: Used for coordinate transformations from one spatial
- reference system to another.
+CoordTransform: Used for coordinate transformations from one spatial
+ reference system to another.
- Driver: Wraps an OGR data source driver.
+Driver: Wraps an OGR data source driver.
- DataSource: Wrapper for the OGR data source object, supports
- OGR-supported data sources.
+DataSource: Wrapper for the OGR data source object, supports
+ OGR-supported data sources.
- Envelope: A ctypes structure for bounding boxes (GDAL library
- not required).
+Envelope: A ctypes structure for bounding boxes (GDAL library
+ not required).
- OGRGeometry: Object for accessing OGR Geometry functionality.
+OGRGeometry: Object for accessing OGR Geometry functionality.
- OGRGeomType: A class for representing the different OGR Geometry
- types (GDAL library not required).
+OGRGeomType: A class for representing the different OGR Geometry
+ types (GDAL library not required).
- SpatialReference: Represents OSR Spatial Reference objects.
+SpatialReference: Represents OSR Spatial Reference objects.
- The GDAL library will be imported from the system path using the default
- library name for the current OS. The default library path may be overridden
- by setting `GDAL_LIBRARY_PATH` in your settings with the path to the GDAL C
- library on your system.
+The GDAL library will be imported from the system path using the default
+library name for the current OS. The default library path may be overridden
+by setting `GDAL_LIBRARY_PATH` in your settings with the path to the GDAL C
+library on your system.
"""
from django.contrib.gis.gdal.datasource import DataSource
diff --git a/django/contrib/gis/gdal/datasource.py b/django/contrib/gis/gdal/datasource.py
index 2ce859ad13..2c9d47918f 100644
--- a/django/contrib/gis/gdal/datasource.py
+++ b/django/contrib/gis/gdal/datasource.py
@@ -1,37 +1,37 @@
"""
- DataSource is a wrapper for the OGR Data Source object, which provides
- an interface for reading vector geometry data from many different file
- formats (including ESRI shapefiles).
+DataSource is a wrapper for the OGR Data Source object, which provides
+an interface for reading vector geometry data from many different file
+formats (including ESRI shapefiles).
- When instantiating a DataSource object, use the filename of a
- GDAL-supported data source. For example, a SHP file or a
- TIGER/Line file from the government.
+When instantiating a DataSource object, use the filename of a
+GDAL-supported data source. For example, a SHP file or a
+TIGER/Line file from the government.
- The ds_driver keyword is used internally when a ctypes pointer
- is passed in directly.
+The ds_driver keyword is used internally when a ctypes pointer
+is passed in directly.
- Example:
- ds = DataSource('/home/foo/bar.shp')
- for layer in ds:
- for feature in layer:
- # Getting the geometry for the feature.
- g = feature.geom
+Example:
+ ds = DataSource('/home/foo/bar.shp')
+ for layer in ds:
+ for feature in layer:
+ # Getting the geometry for the feature.
+ g = feature.geom
- # Getting the 'description' field for the feature.
- desc = feature['description']
+ # Getting the 'description' field for the feature.
+ desc = feature['description']
- # We can also increment through all of the fields
- # attached to this feature.
- for field in feature:
- # Get the name of the field (e.g. 'description')
- nm = field.name
+ # We can also increment through all of the fields
+ # attached to this feature.
+ for field in feature:
+ # Get the name of the field (e.g. 'description')
+ nm = field.name
- # Get the type (integer) of the field, e.g. 0 => OFTInteger
- t = field.type
+ # Get the type (integer) of the field, e.g. 0 => OFTInteger
+ t = field.type
- # Returns the value the field; OFTIntegers return ints,
- # OFTReal returns floats, all else returns string.
- val = field.value
+ # Returns the value the field; OFTIntegers return ints,
+ # OFTReal returns floats, all else returns string.
+ val = field.value
"""
from pathlib import Path
@@ -50,6 +50,7 @@ from django.utils.encoding import force_bytes, force_str
# The OGR_DS_* routines are relevant here.
class DataSource(GDALBase):
"Wraps an OGR Data Source object."
+
destructor = capi.destroy_ds
def __init__(self, ds_input, ds_driver=False, write=False, encoding="utf-8"):
diff --git a/django/contrib/gis/gdal/envelope.py b/django/contrib/gis/gdal/envelope.py
index 05832bd7cc..24383de196 100644
--- a/django/contrib/gis/gdal/envelope.py
+++ b/django/contrib/gis/gdal/envelope.py
@@ -1,14 +1,14 @@
"""
- The GDAL/OGR library uses an Envelope structure to hold the bounding
- box information for a geometry. The envelope (bounding box) contains
- two pairs of coordinates, one for the lower left coordinate and one
- for the upper right coordinate:
+The GDAL/OGR library uses an Envelope structure to hold the bounding
+box information for a geometry. The envelope (bounding box) contains
+two pairs of coordinates, one for the lower left coordinate and one
+for the upper right coordinate:
- +----------o Upper right; (max_x, max_y)
- | |
- | |
- | |
- Lower left (min_x, min_y) o----------+
+ +----------o Upper right; (max_x, max_y)
+ | |
+ | |
+ | |
+Lower left (min_x, min_y) o----------+
"""
from ctypes import Structure, c_double
@@ -21,6 +21,7 @@ from django.contrib.gis.gdal.error import GDALException
# https://gdal.org/doxygen/ogr__core_8h_source.html
class OGREnvelope(Structure):
"Represent the OGREnvelope C Structure."
+
_fields_ = [
("MinX", c_double),
("MaxX", c_double),
diff --git a/django/contrib/gis/gdal/error.py b/django/contrib/gis/gdal/error.py
index df19c2e4a7..08ad5c36b7 100644
--- a/django/contrib/gis/gdal/error.py
+++ b/django/contrib/gis/gdal/error.py
@@ -1,7 +1,7 @@
"""
- This module houses the GDAL & SRS Exception objects, and the
- check_err() routine which checks the status code returned by
- GDAL/OGR methods.
+This module houses the GDAL & SRS Exception objects, and the
+check_err() routine which checks the status code returned by
+GDAL/OGR methods.
"""
diff --git a/django/contrib/gis/gdal/geometries.py b/django/contrib/gis/gdal/geometries.py
index b65d35bc44..fb72fcd5ac 100644
--- a/django/contrib/gis/gdal/geometries.py
+++ b/django/contrib/gis/gdal/geometries.py
@@ -1,42 +1,42 @@
"""
- The OGRGeometry is a wrapper for using the OGR Geometry class
- (see https://gdal.org/api/ogrgeometry_cpp.html#_CPPv411OGRGeometry).
- OGRGeometry may be instantiated when reading geometries from OGR Data Sources
- (e.g. SHP files), or when given OGC WKT (a string).
+The OGRGeometry is a wrapper for using the OGR Geometry class
+(see https://gdal.org/api/ogrgeometry_cpp.html#_CPPv411OGRGeometry).
+OGRGeometry may be instantiated when reading geometries from OGR Data Sources
+(e.g. SHP files), or when given OGC WKT (a string).
- While the 'full' API is not present yet, the API is "pythonic" unlike
- the traditional and "next-generation" OGR Python bindings. One major
- advantage OGR Geometries have over their GEOS counterparts is support
- for spatial reference systems and their transformation.
+While the 'full' API is not present yet, the API is "pythonic" unlike
+the traditional and "next-generation" OGR Python bindings. One major
+advantage OGR Geometries have over their GEOS counterparts is support
+for spatial reference systems and their transformation.
- Example:
- >>> from django.contrib.gis.gdal import OGRGeometry, OGRGeomType, SpatialReference
- >>> wkt1, wkt2 = 'POINT(-90 30)', 'POLYGON((0 0, 5 0, 5 5, 0 5)'
- >>> pnt = OGRGeometry(wkt1)
- >>> print(pnt)
- POINT (-90 30)
- >>> mpnt = OGRGeometry(OGRGeomType('MultiPoint'), SpatialReference('WGS84'))
- >>> mpnt.add(wkt1)
- >>> mpnt.add(wkt1)
- >>> print(mpnt)
- MULTIPOINT (-90 30,-90 30)
- >>> print(mpnt.srs.name)
- WGS 84
- >>> print(mpnt.srs.proj)
- +proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs
- >>> mpnt.transform(SpatialReference('NAD27'))
- >>> print(mpnt.proj)
- +proj=longlat +ellps=clrk66 +datum=NAD27 +no_defs
- >>> print(mpnt)
- MULTIPOINT (-89.99993037860248 29.99979788655764,-89.99993037860248 29.99979788655764)
+Example:
+ >>> from django.contrib.gis.gdal import OGRGeometry, OGRGeomType, SpatialReference
+ >>> wkt1, wkt2 = 'POINT(-90 30)', 'POLYGON((0 0, 5 0, 5 5, 0 5)'
+ >>> pnt = OGRGeometry(wkt1)
+ >>> print(pnt)
+ POINT (-90 30)
+ >>> mpnt = OGRGeometry(OGRGeomType('MultiPoint'), SpatialReference('WGS84'))
+ >>> mpnt.add(wkt1)
+ >>> mpnt.add(wkt1)
+ >>> print(mpnt)
+ MULTIPOINT (-90 30,-90 30)
+ >>> print(mpnt.srs.name)
+ WGS 84
+ >>> print(mpnt.srs.proj)
+ +proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs
+ >>> mpnt.transform(SpatialReference('NAD27'))
+ >>> print(mpnt.proj)
+ +proj=longlat +ellps=clrk66 +datum=NAD27 +no_defs
+ >>> print(mpnt)
+ MULTIPOINT (-89.99993037860248 29.99979788655764,-89.99993037860248 29.99979788655764)
- The OGRGeomType class is to make it easy to specify an OGR geometry type:
- >>> from django.contrib.gis.gdal import OGRGeomType
- >>> gt1 = OGRGeomType(3) # Using an integer for the type
- >>> gt2 = OGRGeomType('Polygon') # Using a string
- >>> gt3 = OGRGeomType('POLYGON') # It's case-insensitive
- >>> print(gt1 == 3, gt1 == 'Polygon') # Equivalence works w/non-OGRGeomType objects
- True True
+ The OGRGeomType class is to make it easy to specify an OGR geometry type:
+ >>> from django.contrib.gis.gdal import OGRGeomType
+ >>> gt1 = OGRGeomType(3) # Using an integer for the type
+ >>> gt2 = OGRGeomType('Polygon') # Using a string
+ >>> gt3 = OGRGeomType('POLYGON') # It's case-insensitive
+ >>> print(gt1 == 3, gt1 == 'Polygon') # Equivalence works w/non-OGRGeomType objects
+ True True
"""
import sys
diff --git a/django/contrib/gis/gdal/prototypes/ds.py b/django/contrib/gis/gdal/prototypes/ds.py
index 71148f1b55..0434bc5125 100644
--- a/django/contrib/gis/gdal/prototypes/ds.py
+++ b/django/contrib/gis/gdal/prototypes/ds.py
@@ -1,7 +1,7 @@
"""
- This module houses the ctypes function prototypes for OGR DataSource
- related data structures. OGR_Dr_*, OGR_DS_*, OGR_L_*, OGR_F_*,
- OGR_Fld_* routines are relevant here.
+This module houses the ctypes function prototypes for OGR DataSource
+related data structures. OGR_Dr_*, OGR_DS_*, OGR_L_*, OGR_F_*,
+OGR_Fld_* routines are relevant here.
"""
from ctypes import POINTER, c_char_p, c_double, c_int, c_long, c_uint, c_void_p
diff --git a/django/contrib/gis/gdal/prototypes/errcheck.py b/django/contrib/gis/gdal/prototypes/errcheck.py
index d37e81cdf6..d970b2e4d2 100644
--- a/django/contrib/gis/gdal/prototypes/errcheck.py
+++ b/django/contrib/gis/gdal/prototypes/errcheck.py
@@ -1,6 +1,6 @@
"""
- This module houses the error-checking routines used by the GDAL
- ctypes prototypes.
+This module houses the error-checking routines used by the GDAL
+ctypes prototypes.
"""
from ctypes import c_void_p, string_at
diff --git a/django/contrib/gis/gdal/prototypes/generation.py b/django/contrib/gis/gdal/prototypes/generation.py
index 4d34a96e70..42665a2661 100644
--- a/django/contrib/gis/gdal/prototypes/generation.py
+++ b/django/contrib/gis/gdal/prototypes/generation.py
@@ -1,6 +1,6 @@
"""
- This module contains functions that generate ctypes prototypes for the
- GDAL routines.
+This module contains functions that generate ctypes prototypes for the
+GDAL routines.
"""
from ctypes import POINTER, c_bool, c_char_p, c_double, c_int, c_int64, c_void_p
diff --git a/django/contrib/gis/gdal/srs.py b/django/contrib/gis/gdal/srs.py
index 0a8d95c1fc..8bf72ab63d 100644
--- a/django/contrib/gis/gdal/srs.py
+++ b/django/contrib/gis/gdal/srs.py
@@ -1,30 +1,30 @@
"""
- The Spatial Reference class, represents OGR Spatial Reference objects.
+The Spatial Reference class, represents OGR Spatial Reference objects.
- Example:
- >>> from django.contrib.gis.gdal import SpatialReference
- >>> srs = SpatialReference('WGS84')
- >>> print(srs)
- GEOGCS["WGS 84",
- DATUM["WGS_1984",
- SPHEROID["WGS 84",6378137,298.257223563,
- AUTHORITY["EPSG","7030"]],
- TOWGS84[0,0,0,0,0,0,0],
- AUTHORITY["EPSG","6326"]],
- PRIMEM["Greenwich",0,
- AUTHORITY["EPSG","8901"]],
- UNIT["degree",0.01745329251994328,
- AUTHORITY["EPSG","9122"]],
- AUTHORITY["EPSG","4326"]]
- >>> print(srs.proj)
- +proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs
- >>> print(srs.ellipsoid)
- (6378137.0, 6356752.3142451793, 298.25722356300003)
- >>> print(srs.projected, srs.geographic)
- False True
- >>> srs.import_epsg(32140)
- >>> print(srs.name)
- NAD83 / Texas South Central
+Example:
+>>> from django.contrib.gis.gdal import SpatialReference
+>>> srs = SpatialReference('WGS84')
+>>> print(srs)
+GEOGCS["WGS 84",
+ DATUM["WGS_1984",
+ SPHEROID["WGS 84",6378137,298.257223563,
+ AUTHORITY["EPSG","7030"]],
+ TOWGS84[0,0,0,0,0,0,0],
+ AUTHORITY["EPSG","6326"]],
+ PRIMEM["Greenwich",0,
+ AUTHORITY["EPSG","8901"]],
+ UNIT["degree",0.01745329251994328,
+ AUTHORITY["EPSG","9122"]],
+ AUTHORITY["EPSG","4326"]]
+>>> print(srs.proj)
++proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs
+>>> print(srs.ellipsoid)
+(6378137.0, 6356752.3142451793, 298.25722356300003)
+>>> print(srs.projected, srs.geographic)
+False True
+>>> srs.import_epsg(32140)
+>>> print(srs.name)
+NAD83 / Texas South Central
"""
from ctypes import byref, c_char_p, c_int
@@ -345,6 +345,7 @@ class SpatialReference(GDALBase):
class CoordTransform(GDALBase):
"The coordinate system transformation object."
+
destructor = capi.destroy_ct
def __init__(self, source, target):
diff --git a/django/contrib/gis/geos/collections.py b/django/contrib/gis/geos/collections.py
index 35262a5622..41a647f234 100644
--- a/django/contrib/gis/geos/collections.py
+++ b/django/contrib/gis/geos/collections.py
@@ -1,6 +1,6 @@
"""
- This module houses the Geometry Collection objects:
- GeometryCollection, MultiPoint, MultiLineString, and MultiPolygon
+This module houses the Geometry Collection objects:
+GeometryCollection, MultiPoint, MultiLineString, and MultiPolygon
"""
from django.contrib.gis.geos import prototypes as capi
diff --git a/django/contrib/gis/geos/coordseq.py b/django/contrib/gis/geos/coordseq.py
index 15400e08fe..484b53ab5f 100644
--- a/django/contrib/gis/geos/coordseq.py
+++ b/django/contrib/gis/geos/coordseq.py
@@ -1,7 +1,7 @@
"""
- This module houses the GEOSCoordSeq object, which is used internally
- by GEOSGeometry to house the actual coordinates of the Point,
- LineString, and LinearRing geometries.
+This module houses the GEOSCoordSeq object, which is used internally
+by GEOSGeometry to house the actual coordinates of the Point,
+LineString, and LinearRing geometries.
"""
from ctypes import byref, c_byte, c_double, c_uint
diff --git a/django/contrib/gis/geos/error.py b/django/contrib/gis/geos/error.py
index af2ac2fd42..970f42effb 100644
--- a/django/contrib/gis/geos/error.py
+++ b/django/contrib/gis/geos/error.py
@@ -1,3 +1,4 @@
class GEOSException(Exception):
"The base GEOS exception, indicates a GEOS-related error."
+
pass
diff --git a/django/contrib/gis/geos/geometry.py b/django/contrib/gis/geos/geometry.py
index c8c451d99f..564b0be16e 100644
--- a/django/contrib/gis/geos/geometry.py
+++ b/django/contrib/gis/geos/geometry.py
@@ -1,6 +1,6 @@
"""
- This module contains the 'base' GEOSGeometry object -- all GEOS Geometries
- inherit from this object.
+This module contains the 'base' GEOSGeometry object -- all GEOS Geometries
+inherit from this object.
"""
import re
diff --git a/django/contrib/gis/geos/libgeos.py b/django/contrib/gis/geos/libgeos.py
index b883c6c090..2707fef283 100644
--- a/django/contrib/gis/geos/libgeos.py
+++ b/django/contrib/gis/geos/libgeos.py
@@ -1,10 +1,10 @@
"""
- This module houses the ctypes initialization procedures, as well
- as the notice and error handler function callbacks (get called
- when an error occurs in GEOS).
+This module houses the ctypes initialization procedures, as well
+as the notice and error handler function callbacks (get called
+when an error occurs in GEOS).
- This module also houses GEOS Pointer utilities, including
- get_pointer_arr(), and GEOM_PTR.
+This module also houses GEOS Pointer utilities, including
+get_pointer_arr(), and GEOM_PTR.
"""
import logging
diff --git a/django/contrib/gis/geos/prototypes/__init__.py b/django/contrib/gis/geos/prototypes/__init__.py
index 94dcee31f1..6b0da37ee6 100644
--- a/django/contrib/gis/geos/prototypes/__init__.py
+++ b/django/contrib/gis/geos/prototypes/__init__.py
@@ -1,7 +1,7 @@
"""
- This module contains all of the GEOS ctypes function prototypes. Each
- prototype handles the interaction between the GEOS library and Python
- via ctypes.
+This module contains all of the GEOS ctypes function prototypes. Each
+prototype handles the interaction between the GEOS library and Python
+via ctypes.
"""
from django.contrib.gis.geos.prototypes.coordseq import ( # NOQA
diff --git a/django/contrib/gis/geos/prototypes/coordseq.py b/django/contrib/gis/geos/prototypes/coordseq.py
index ed05de99f4..cfc242c00d 100644
--- a/django/contrib/gis/geos/prototypes/coordseq.py
+++ b/django/contrib/gis/geos/prototypes/coordseq.py
@@ -23,6 +23,7 @@ def check_cs_get(result, func, cargs):
# ## Coordinate sequence prototype factory classes. ##
class CsInt(GEOSFuncFactory):
"For coordinate sequence routines that return an integer."
+
argtypes = [CS_PTR, POINTER(c_uint)]
restype = c_int
errcheck = staticmethod(check_cs_get)
@@ -30,6 +31,7 @@ class CsInt(GEOSFuncFactory):
class CsOperation(GEOSFuncFactory):
"For coordinate sequence operations."
+
restype = c_int
def __init__(self, *args, ordinate=False, get=False, **kwargs):
diff --git a/django/contrib/gis/geos/prototypes/errcheck.py b/django/contrib/gis/geos/prototypes/errcheck.py
index 42b24c2891..5ee43999fa 100644
--- a/django/contrib/gis/geos/prototypes/errcheck.py
+++ b/django/contrib/gis/geos/prototypes/errcheck.py
@@ -1,5 +1,5 @@
"""
- Error checking functions for GEOS ctypes prototype functions.
+Error checking functions for GEOS ctypes prototype functions.
"""
from ctypes import c_void_p, string_at
diff --git a/django/contrib/gis/geos/prototypes/geom.py b/django/contrib/gis/geos/prototypes/geom.py
index a456acd0c1..3996544033 100644
--- a/django/contrib/gis/geos/prototypes/geom.py
+++ b/django/contrib/gis/geos/prototypes/geom.py
@@ -25,12 +25,14 @@ class geos_char_p(c_char_p):
# ### ctypes factory classes ###
class GeomOutput(GEOSFuncFactory):
"For GEOS routines that return a geometry."
+
restype = GEOM_PTR
errcheck = staticmethod(check_geom)
class IntFromGeom(GEOSFuncFactory):
"Argument is a geometry, return type is an integer."
+
argtypes = [GEOM_PTR]
restype = c_int
errcheck = staticmethod(check_minus_one)
@@ -38,6 +40,7 @@ class IntFromGeom(GEOSFuncFactory):
class StringFromGeom(GEOSFuncFactory):
"Argument is a Geometry, return type is a string."
+
argtypes = [GEOM_PTR]
restype = geos_char_p
errcheck = staticmethod(check_string)
diff --git a/django/contrib/gis/geos/prototypes/misc.py b/django/contrib/gis/geos/prototypes/misc.py
index bd5859e79b..a59186976b 100644
--- a/django/contrib/gis/geos/prototypes/misc.py
+++ b/django/contrib/gis/geos/prototypes/misc.py
@@ -1,6 +1,6 @@
"""
- This module is for the miscellaneous GEOS routines, particularly the
- ones that return the area, distance, and length.
+This module is for the miscellaneous GEOS routines, particularly the
+ones that return the area, distance, and length.
"""
from ctypes import POINTER, c_double, c_int
diff --git a/django/contrib/gis/geos/prototypes/predicates.py b/django/contrib/gis/geos/prototypes/predicates.py
index e5c2298d4e..9afcb4872a 100644
--- a/django/contrib/gis/geos/prototypes/predicates.py
+++ b/django/contrib/gis/geos/prototypes/predicates.py
@@ -1,6 +1,6 @@
"""
- This module houses the GEOS ctypes prototype functions for the
- unary and binary predicate operations on geometries.
+This module houses the GEOS ctypes prototype functions for the
+unary and binary predicate operations on geometries.
"""
from ctypes import c_byte, c_char_p, c_double
@@ -12,6 +12,7 @@ from django.contrib.gis.geos.prototypes.errcheck import check_predicate
# ## Binary & unary predicate factories ##
class UnaryPredicate(GEOSFuncFactory):
"For GEOS unary predicate functions."
+
argtypes = [GEOM_PTR]
restype = c_byte
errcheck = staticmethod(check_predicate)
@@ -19,6 +20,7 @@ class UnaryPredicate(GEOSFuncFactory):
class BinaryPredicate(UnaryPredicate):
"For GEOS binary predicate functions."
+
argtypes = [GEOM_PTR, GEOM_PTR]
diff --git a/django/contrib/gis/geos/prototypes/topology.py b/django/contrib/gis/geos/prototypes/topology.py
index 9323bb2d16..541c954c02 100644
--- a/django/contrib/gis/geos/prototypes/topology.py
+++ b/django/contrib/gis/geos/prototypes/topology.py
@@ -1,6 +1,6 @@
"""
- This module houses the GEOS ctypes prototype functions for the
- topological operations on geometries.
+This module houses the GEOS ctypes prototype functions for the
+topological operations on geometries.
"""
from ctypes import c_double, c_int
@@ -16,6 +16,7 @@ from django.contrib.gis.geos.prototypes.geom import geos_char_p
class Topology(GEOSFuncFactory):
"For GEOS unary topology functions."
+
argtypes = [GEOM_PTR]
restype = GEOM_PTR
errcheck = staticmethod(check_geom)
diff --git a/django/contrib/gis/utils/__init__.py b/django/contrib/gis/utils/__init__.py
index f42fa90226..92ff64dee7 100644
--- a/django/contrib/gis/utils/__init__.py
+++ b/django/contrib/gis/utils/__init__.py
@@ -1,5 +1,5 @@
"""
- This module contains useful utilities for GeoDjango.
+This module contains useful utilities for GeoDjango.
"""
from django.contrib.gis.utils.ogrinfo import ogrinfo
diff --git a/django/contrib/gis/utils/layermapping.py b/django/contrib/gis/utils/layermapping.py
index d1fe7c5721..137dd6b7f7 100644
--- a/django/contrib/gis/utils/layermapping.py
+++ b/django/contrib/gis/utils/layermapping.py
@@ -1,10 +1,10 @@
# LayerMapping -- A Django Model/OGR Layer Mapping Utility
"""
- The LayerMapping class provides a way to map the contents of OGR
- vector files (e.g. SHP files) to Geographic-enabled Django models.
+The LayerMapping class provides a way to map the contents of OGR
+vector files (e.g. SHP files) to Geographic-enabled Django models.
- For more information, please consult the GeoDjango documentation:
- https://docs.djangoproject.com/en/dev/ref/contrib/gis/layermapping/
+For more information, please consult the GeoDjango documentation:
+ https://docs.djangoproject.com/en/dev/ref/contrib/gis/layermapping/
"""
import sys
from decimal import Decimal
diff --git a/django/core/cache/backends/base.py b/django/core/cache/backends/base.py
index 09b0a5f9c8..1111fdb41f 100644
--- a/django/core/cache/backends/base.py
+++ b/django/core/cache/backends/base.py
@@ -1,4 +1,5 @@
"Base Cache class."
+
import time
import warnings
diff --git a/django/core/cache/backends/db.py b/django/core/cache/backends/db.py
index d231d66b2f..b3f4eab7c1 100644
--- a/django/core/cache/backends/db.py
+++ b/django/core/cache/backends/db.py
@@ -1,4 +1,5 @@
"Database cache backend."
+
import base64
import pickle
from datetime import UTC, datetime
diff --git a/django/core/cache/backends/filebased.py b/django/core/cache/backends/filebased.py
index cbf47e4e16..862a8b57d9 100644
--- a/django/core/cache/backends/filebased.py
+++ b/django/core/cache/backends/filebased.py
@@ -1,4 +1,5 @@
"File-based cache backend"
+
import glob
import os
import pickle
diff --git a/django/core/cache/backends/locmem.py b/django/core/cache/backends/locmem.py
index cbc8dba51e..b62fedbbd9 100644
--- a/django/core/cache/backends/locmem.py
+++ b/django/core/cache/backends/locmem.py
@@ -1,4 +1,5 @@
"Thread-safe in-memory cache backend."
+
import pickle
import time
from collections import OrderedDict
diff --git a/django/forms/forms.py b/django/forms/forms.py
index 844f15f9f2..d05bf4bb9e 100644
--- a/django/forms/forms.py
+++ b/django/forms/forms.py
@@ -431,6 +431,7 @@ class BaseForm(RenderableFormMixin):
class Form(BaseForm, metaclass=DeclarativeFieldsMetaclass):
"A collection of Fields, plus their associated data."
+
# This is a separate class from BaseForm in order to abstract the way
# self.fields is specified. This class (Form) is the one that does the
# fancy metaclass stuff purely for the semantic sugar -- it allows one
diff --git a/django/template/context.py b/django/template/context.py
index 90825fcdb5..bacce88173 100644
--- a/django/template/context.py
+++ b/django/template/context.py
@@ -7,6 +7,7 @@ _builtin_context_processors = ("django.template.context_processors.csrf",)
class ContextPopException(Exception):
"pop() has been called more times than push()"
+
pass