diff --git a/django/conf/global_settings.py b/django/conf/global_settings.py index bd758bfcc4..25ac49becf 100644 --- a/django/conf/global_settings.py +++ b/django/conf/global_settings.py @@ -223,7 +223,7 @@ FORM_RENDERER = "django.forms.renderers.DjangoTemplates" DEFAULT_FROM_EMAIL = "webmaster@localhost" # Subject-line prefix for email messages send with django.core.mail.mail_admins -# or ...mail_managers. Make sure to include the trailing space. +# or ...mail_managers. Make sure to include the trailing space. EMAIL_SUBJECT_PREFIX = "[Django] " # Whether to append trailing slashes to URLs. @@ -533,9 +533,8 @@ LOGOUT_REDIRECT_URL = None # The number of seconds a password reset link is valid for (default: 3 days). PASSWORD_RESET_TIMEOUT = 60 * 60 * 24 * 3 -# the first hasher in this list is the preferred algorithm. any -# password using different algorithms will be converted automatically -# upon login +# The first hasher in this list is the preferred algorithm. Any password using +# different algorithms will be converted automatically upon login. PASSWORD_HASHERS = [ "django.contrib.auth.hashers.PBKDF2PasswordHasher", "django.contrib.auth.hashers.PBKDF2SHA1PasswordHasher", diff --git a/django/contrib/admin/checks.py b/django/contrib/admin/checks.py index 4bfbe25f22..0b3d3f159a 100644 --- a/django/contrib/admin/checks.py +++ b/django/contrib/admin/checks.py @@ -1026,7 +1026,7 @@ class ModelAdminChecks(BaseModelAdminChecks): return must_inherit_from( parent="ListFilter", option=label, obj=obj, id="admin.E113" ) - # ... but not a FieldListFilter. + # ... but not a FieldListFilter. elif issubclass(item, FieldListFilter): return [ checks.Error( diff --git a/django/contrib/admin/options.py b/django/contrib/admin/options.py index 1ab136062c..fc1c3f1eda 100644 --- a/django/contrib/admin/options.py +++ b/django/contrib/admin/options.py @@ -250,7 +250,7 @@ class BaseModelAdmin(metaclass=forms.MediaDefiningClass): def get_field_queryset(self, db, db_field, request): """ If the ModelAdmin specifies ordering, the queryset should respect that - ordering. Otherwise don't specify the queryset, let the field decide + ordering. Otherwise don't specify the queryset, let the field decide (return None in that case). """ try: @@ -1047,7 +1047,7 @@ class ModelAdmin(BaseModelAdmin): def get_action_choices(self, request, default_choices=models.BLANK_CHOICE_DASH): """ - Return a list of choices for use in a form object. Each choice is a + Return a list of choices for use in a form object. Each choice is a tuple (name, description). """ choices = [*default_choices] @@ -1059,7 +1059,7 @@ class ModelAdmin(BaseModelAdmin): def get_action(self, action): """ Return a given action from a parameter, which can either be a callable, - or the name of a method on the ModelAdmin. Return is a tuple of + or the name of a method on the ModelAdmin. Return is a tuple of (callable, name, description). """ # If the action is a callable, just use it. diff --git a/django/contrib/admin/tests.py b/django/contrib/admin/tests.py index d711f13010..98eca091ce 100644 --- a/django/contrib/admin/tests.py +++ b/django/contrib/admin/tests.py @@ -118,7 +118,7 @@ class AdminSeleniumTestCase(SeleniumTestCase, StaticLiveServerTestCase): def wait_page_ready(self, timeout=10): """ - Block until the page is ready. + Block until the page is ready. """ self.wait_until( lambda driver: driver.execute_script("return document.readyState;") diff --git a/django/contrib/admindocs/utils.py b/django/contrib/admindocs/utils.py index 5b28a8d2c6..c119a1a9ad 100644 --- a/django/contrib/admindocs/utils.py +++ b/django/contrib/admindocs/utils.py @@ -30,7 +30,7 @@ def get_view_name(view_func): def parse_docstring(docstring): """ - Parse out the parts of a docstring. Return (title, body, metadata). + Parse out the parts of a docstring. Return (title, body, metadata). """ if not docstring: return "", "", {} diff --git a/django/contrib/auth/backends.py b/django/contrib/auth/backends.py index 8352530665..e72a18981c 100644 --- a/django/contrib/auth/backends.py +++ b/django/contrib/auth/backends.py @@ -254,7 +254,7 @@ class RemoteUserBackend(ModelBackend): is handling authentication outside of Django. By default, the ``authenticate`` method creates ``User`` objects for - usernames that don't already exist in the database. Subclasses can disable + usernames that don't already exist in the database. Subclasses can disable this behavior by setting the ``create_unknown_user`` attribute to ``False``. """ @@ -318,7 +318,7 @@ class RemoteUserBackend(ModelBackend): def clean_username(self, username): """ Perform any cleaning on the "username" prior to using it to get or - create the user object. Return the cleaned username. + create the user object. Return the cleaned username. By default, return the username unchanged. """ diff --git a/django/contrib/auth/hashers.py b/django/contrib/auth/hashers.py index aa183c3904..29eb1f1b77 100644 --- a/django/contrib/auth/hashers.py +++ b/django/contrib/auth/hashers.py @@ -314,7 +314,7 @@ class PBKDF2PasswordHasher(BasePasswordHasher): Secure password hashing using the PBKDF2 algorithm (recommended) Configured to use PBKDF2 + HMAC + SHA256. - The result is a 64 byte binary string. Iterations may be changed + The result is a 64 byte binary string. Iterations may be changed safely but you must rename the algorithm if you change SHA256. """ @@ -486,7 +486,7 @@ class BCryptSHA256PasswordHasher(BasePasswordHasher): Secure password hashing using the bcrypt algorithm (recommended) This is considered by many to be the most secure algorithm but you - must first install the bcrypt library. Please be warned that + must first install the bcrypt library. Please be warned that this library depends on native C code and might cause portability issues. """ @@ -559,7 +559,7 @@ class BCryptPasswordHasher(BCryptSHA256PasswordHasher): Secure password hashing using the bcrypt algorithm This is considered by many to be the most secure algorithm but you - must first install the bcrypt library. Please be warned that + must first install the bcrypt library. Please be warned that this library depends on native C code and might cause portability issues. diff --git a/django/contrib/auth/management/__init__.py b/django/contrib/auth/management/__init__.py index a8639cb258..e816357b2b 100644 --- a/django/contrib/auth/management/__init__.py +++ b/django/contrib/auth/management/__init__.py @@ -80,7 +80,7 @@ def create_permissions( ) # Find all the Permissions that have a content_type for a model we're - # looking for. We don't need to check for codenames since we already have + # looking for. We don't need to check for codenames since we already have # a list of the ones we're going to create. all_perms = set( Permission.objects.using(using) diff --git a/django/contrib/auth/middleware.py b/django/contrib/auth/middleware.py index 6be3552cad..297a8a83b2 100644 --- a/django/contrib/auth/middleware.py +++ b/django/contrib/auth/middleware.py @@ -137,7 +137,7 @@ class RemoteUserMiddleware: if not hasattr(request, "user"): raise ImproperlyConfigured( "The Django remote user auth middleware requires the" - " authentication middleware to be installed. Edit your" + " authentication middleware to be installed. Edit your" " MIDDLEWARE setting to insert" " 'django.contrib.auth.middleware.AuthenticationMiddleware'" " before the RemoteUserMiddleware class." @@ -166,7 +166,7 @@ class RemoteUserMiddleware: # to authenticate the user. user = auth.authenticate(request, remote_user=username) if user: - # User is valid. Set request.user and persist user in the session + # User is valid. Set request.user and persist user in the session # by logging the user in. request.user = user auth.login(request, user) @@ -194,7 +194,7 @@ class RemoteUserMiddleware: if not hasattr(request, "user"): raise ImproperlyConfigured( "The Django remote user auth middleware requires the" - " authentication middleware to be installed. Edit your" + " authentication middleware to be installed. Edit your" " MIDDLEWARE setting to insert" " 'django.contrib.auth.middleware.AuthenticationMiddleware'" " before the RemoteUserMiddleware class." @@ -226,7 +226,7 @@ class RemoteUserMiddleware: # to authenticate the user. user = await auth.aauthenticate(request, remote_user=username) if user: - # User is valid. Set request.user and persist user in the session + # User is valid. Set request.user and persist user in the session # by logging the user in. request.user = user await auth.alogin(request, user) diff --git a/django/contrib/gis/db/backends/base/operations.py b/django/contrib/gis/db/backends/base/operations.py index 23e7fd2c25..5c09aaa8bc 100644 --- a/django/contrib/gis/db/backends/base/operations.py +++ b/django/contrib/gis/db/backends/base/operations.py @@ -117,7 +117,7 @@ class BaseSpatialOperations: def get_geom_placeholder(self, f, value, compiler): """ Return the placeholder for the given geometry field with the given - value. Depending on the spatial backend, the placeholder may contain a + value. Depending on the spatial backend, the placeholder may contain a stored procedure call to the transformation function of the spatial backend. """ diff --git a/django/contrib/gis/db/backends/oracle/models.py b/django/contrib/gis/db/backends/oracle/models.py index 7a69fbc4d0..b5fc7bf7de 100644 --- a/django/contrib/gis/db/backends/oracle/models.py +++ b/django/contrib/gis/db/backends/oracle/models.py @@ -54,7 +54,7 @@ class OracleSpatialRefSys(models.Model, SpatialRefSysMixin): auth_name = models.CharField(max_length=256) wktext = models.CharField(max_length=2046) # Optional geometry representing the bounds of this coordinate - # system. By default, all are NULL in the table. + # system. By default, all are NULL in the table. cs_bounds = models.PolygonField(null=True) class Meta: diff --git a/django/contrib/gis/db/backends/oracle/operations.py b/django/contrib/gis/db/backends/oracle/operations.py index 3d5dcc7294..77cb8e034c 100644 --- a/django/contrib/gis/db/backends/oracle/operations.py +++ b/django/contrib/gis/db/backends/oracle/operations.py @@ -3,7 +3,7 @@ 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 +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. """ @@ -95,7 +95,7 @@ class OracleOperations(BaseSpatialOperations, DatabaseOperations): # We want to get SDO Geometries as WKT because it is much easier to # instantiate GEOS proxies from WKT than SDO_GEOMETRY(...) strings. # However, this adversely affects performance (i.e., Java is called - # to convert to WKT on every query). If someone wishes to write a + # to convert to WKT on every query). If someone wishes to write a # SDO_GEOMETRY(...) parser in Python, let me know =) select = "SDO_UTIL.TO_WKBGEOMETRY(%s)" diff --git a/django/contrib/gis/db/backends/postgis/introspection.py b/django/contrib/gis/db/backends/postgis/introspection.py index c448bc37a2..7c96c2cb04 100644 --- a/django/contrib/gis/db/backends/postgis/introspection.py +++ b/django/contrib/gis/db/backends/postgis/introspection.py @@ -37,7 +37,7 @@ class PostGISIntrospection(DatabaseIntrospection): """ The geometry type OID used by PostGIS does not indicate the particular type of field that a geometry column is (e.g., whether it's a - PointField or a PolygonField). Thus, this routine queries the PostGIS + PointField or a PolygonField). Thus, this routine queries the PostGIS metadata tables to determine the geometry type. """ with self.connection.cursor() as cursor: diff --git a/django/contrib/gis/db/backends/postgis/operations.py b/django/contrib/gis/db/backends/postgis/operations.py index bd1e79a6d6..303e039958 100644 --- a/django/contrib/gis/db/backends/postgis/operations.py +++ b/django/contrib/gis/db/backends/postgis/operations.py @@ -185,7 +185,7 @@ class PostGISOperations(BaseSpatialOperations, DatabaseOperations): def spatial_version(self): """Determine the version of the PostGIS library.""" # Trying to get the PostGIS version because the function - # signatures will depend on the version used. The cost + # signatures will depend on the version used. The cost # here is a database query to determine the version, which # can be mitigated by setting `POSTGIS_VERSION` with a 3-tuple # comprising user-supplied values for the major, minor, and @@ -267,7 +267,7 @@ class PostGISOperations(BaseSpatialOperations, DatabaseOperations): This is the most complex implementation of the spatial backends due to what is supported on geodetic geometry columns vs. what's available on - projected geometry columns. In addition, it has to take into account + projected geometry columns. In addition, it has to take into account the geography column type. """ # Getting the distance parameter @@ -330,7 +330,7 @@ class PostGISOperations(BaseSpatialOperations, DatabaseOperations): """ Helper routine for calling PostGIS functions and returning their result. """ - # Close out the connection. See #9437. + # Close out the connection. See #9437. with self.connection.temporary_connection() as cursor: cursor.execute("SELECT %s()" % func) return cursor.fetchone()[0] diff --git a/django/contrib/gis/db/models/fields.py b/django/contrib/gis/db/models/fields.py index 812029de49..4542e19040 100644 --- a/django/contrib/gis/db/models/fields.py +++ b/django/contrib/gis/db/models/fields.py @@ -33,7 +33,7 @@ def get_srid_info(srid, connection): """ Return the units, unit name, and spheroid WKT associated with the given SRID from the `spatial_ref_sys` (or equivalent) spatial database - table for the given database connection. These results are cached. + table for the given database connection. These results are cached. """ from django.contrib.gis.gdal import SpatialReference @@ -89,7 +89,7 @@ class BaseSpatialField(Field): Defaults to 4326 (WGS84). spatial_index: - Indicates whether to create a spatial index. Defaults to True. + Indicates whether to create a spatial index. Defaults to True. Set this instead of 'db_index' for geographic fields since index creation is different for geometry columns. """ @@ -97,7 +97,7 @@ class BaseSpatialField(Field): # Setting the index flag with the value of the `spatial_index` keyword. self.spatial_index = spatial_index - # Setting the SRID and getting the units. Unit information must be + # Setting the SRID and getting the units. Unit information must be # easily available in the field instance for distance queries. self.srid = srid @@ -251,16 +251,16 @@ class GeometryField(BaseSpatialField): arguments: dim: - The number of dimensions for this geometry. Defaults to 2. + The number of dimensions for this geometry. Defaults to 2. extent: Customize the extent, in a 4-tuple of WGS 84 coordinates, for the - geometry field entry in the `USER_SDO_GEOM_METADATA` table. Defaults + geometry field entry in the `USER_SDO_GEOM_METADATA` table. Defaults to (-180.0, -90.0, 180.0, 90.0). tolerance: Define the tolerance, in meters, to use for the geometry field - entry in the `USER_SDO_GEOM_METADATA` table. Defaults to 0.05. + entry in the `USER_SDO_GEOM_METADATA` table. Defaults to 0.05. """ # Setting the dimension of the geometry field. self.dim = dim diff --git a/django/contrib/gis/feeds.py b/django/contrib/gis/feeds.py index ebd4511889..03a5456d42 100644 --- a/django/contrib/gis/feeds.py +++ b/django/contrib/gis/feeds.py @@ -35,7 +35,7 @@ class GeoFeedMixin: geom = item.get("geometry") if geom is not None: if isinstance(geom, (list, tuple)): - # Special case if a tuple/list was passed in. The tuple may be + # Special case if a tuple/list was passed in. The tuple may be # a point or a box box_coords = None if isinstance(geom[0], (list, tuple)): diff --git a/django/contrib/gis/forms/fields.py b/django/contrib/gis/forms/fields.py index 1fd31530c1..3c73e12dea 100644 --- a/django/contrib/gis/forms/fields.py +++ b/django/contrib/gis/forms/fields.py @@ -9,8 +9,8 @@ from .widgets import OpenLayersWidget class GeometryField(forms.Field): """ - This is the basic form field for a Geometry. Any textual input that is - accepted by GEOSGeometry is accepted by this form. By default, + This is the basic form field for a Geometry. Any textual input that is + accepted by GEOSGeometry is accepted by this form. By default, this includes WKT, HEXEWKB, WKB (in a buffer), and GeoJSON. """ diff --git a/django/contrib/gis/gdal/__init__.py b/django/contrib/gis/gdal/__init__.py index 37c9273666..10da8b4189 100644 --- a/django/contrib/gis/gdal/__init__.py +++ b/django/contrib/gis/gdal/__init__.py @@ -1,5 +1,5 @@ """ -This module houses ctypes interfaces for GDAL objects. The following GDAL +This module houses ctypes interfaces for GDAL objects. The following GDAL objects are supported: CoordTransform: Used for coordinate transformations from one spatial diff --git a/django/contrib/gis/gdal/datasource.py b/django/contrib/gis/gdal/datasource.py index 2c9d47918f..5e644c142c 100644 --- a/django/contrib/gis/gdal/datasource.py +++ b/django/contrib/gis/gdal/datasource.py @@ -4,7 +4,7 @@ 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 +GDAL-supported data source. For example, an SHP file or a TIGER/Line file from the government. The ds_driver keyword is used internally when a ctypes pointer diff --git a/django/contrib/gis/gdal/envelope.py b/django/contrib/gis/gdal/envelope.py index 24383de196..8293aa499d 100644 --- a/django/contrib/gis/gdal/envelope.py +++ b/django/contrib/gis/gdal/envelope.py @@ -1,6 +1,6 @@ """ The GDAL/OGR library uses an Envelope structure to hold the bounding -box information for a geometry. The envelope (bounding box) contains +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: @@ -17,8 +17,8 @@ from django.contrib.gis.gdal.error import GDALException # The OGR definition of an Envelope is a C structure containing four doubles. -# See the 'ogr_core.h' source file for more information: -# https://gdal.org/doxygen/ogr__core_8h_source.html +# See the 'ogr_core.h' source file for more information: +# https://gdal.org/doxygen/ogr__core_8h_source.html class OGREnvelope(Structure): "Represent the OGREnvelope C Structure." @@ -33,7 +33,7 @@ class OGREnvelope(Structure): class Envelope: """ The Envelope object is a C structure that contains the minimum and - maximum X, Y coordinates for a rectangle bounding box. The naming + maximum X, Y coordinates for a rectangle bounding box. The naming of the variables is compatible with the OGR Envelope structure. """ diff --git a/django/contrib/gis/gdal/feature.py b/django/contrib/gis/gdal/feature.py index 6f08969984..630af7f651 100644 --- a/django/contrib/gis/gdal/feature.py +++ b/django/contrib/gis/gdal/feature.py @@ -8,7 +8,7 @@ from django.utils.encoding import force_bytes, force_str # For more information, see the OGR C API source code: -# https://gdal.org/api/vector_c_api.html +# https://gdal.org/api/vector_c_api.html # # The OGR_F_* routines are relevant here. class Feature(GDALBase): @@ -31,7 +31,7 @@ class Feature(GDALBase): def __getitem__(self, index): """ Get the Field object at the specified index, which may be either - an integer or the Field's string label. Note that the Field object + an integer or the Field's string label. Note that the Field object is not the field's _value_ -- use the `get` method instead to retrieve the value (e.g. an integer) instead of a Field instance. """ @@ -106,7 +106,7 @@ class Feature(GDALBase): def get(self, field): """ Return the value of the field, instead of an instance of the Field - object. May take a string of the field name or a Field object as + object. May take a string of the field name or a Field object as parameters. """ field_name = getattr(field, "name", field) diff --git a/django/contrib/gis/gdal/field.py b/django/contrib/gis/gdal/field.py index 5374f6c3cb..c202c0a420 100644 --- a/django/contrib/gis/gdal/field.py +++ b/django/contrib/gis/gdal/field.py @@ -8,7 +8,7 @@ from django.utils.encoding import force_str # For more information, see the OGR C API source code: -# https://gdal.org/api/vector_c_api.html +# https://gdal.org/api/vector_c_api.html # # The OGR_Fld_* routines are relevant here. class Field(GDALBase): diff --git a/django/contrib/gis/gdal/geometries.py b/django/contrib/gis/gdal/geometries.py index fb72fcd5ac..63e6ef13a3 100644 --- a/django/contrib/gis/gdal/geometries.py +++ b/django/contrib/gis/gdal/geometries.py @@ -5,7 +5,7 @@ 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 +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. @@ -454,7 +454,7 @@ class OGRGeometry(GDALBase): """ Transform this geometry to a different spatial reference system. May take a CoordTransform object, a SpatialReference object, string - WKT or PROJ, and/or an integer SRID. By default, return nothing + WKT or PROJ, and/or an integer SRID. By default, return nothing and transform the geometry in-place. However, if the `clone` keyword is set, return a transformed clone of this geometry. """ diff --git a/django/contrib/gis/gdal/layer.py b/django/contrib/gis/gdal/layer.py index 1afa0469f6..0deb77e65c 100644 --- a/django/contrib/gis/gdal/layer.py +++ b/django/contrib/gis/gdal/layer.py @@ -27,8 +27,8 @@ class Layer(GDALBase): def __init__(self, layer_ptr, ds): """ Initialize on an OGR C pointer to the Layer and the `DataSource` object - that owns this layer. The `DataSource` object is required so that a - reference to it is kept with this Layer. This prevents garbage + that owns this layer. The `DataSource` object is required so that a + reference to it is kept with this Layer. This prevents garbage collection of the `DataSource` while this Layer is still active. """ if not layer_ptr: @@ -75,7 +75,7 @@ class Layer(GDALBase): def _make_feature(self, feat_id): """ Helper routine for __getitem__ that constructs a Feature from the given - Feature ID. If the OGR Layer does not support random-access reading, + Feature ID. If the OGR Layer does not support random-access reading, then each feature of the layer will be incremented through until the a Feature is found matching the given feature ID. """ @@ -150,7 +150,7 @@ class Layer(GDALBase): @property def field_types(self): """ - Return a list of the types of fields in this Layer. For example, + Return a list of the types of fields in this Layer. For example, return the list [OFTInteger, OFTReal, OFTString] for an OGR layer that has an integer, a floating-point, and string fields. """ @@ -226,7 +226,7 @@ class Layer(GDALBase): def test_capability(self, capability): """ Return a bool indicating whether the this Layer supports the given - capability (a string). Valid capability strings include: + capability (a string). Valid capability strings include: 'RandomRead', 'SequentialWrite', 'RandomWrite', 'FastSpatialFilter', 'FastFeatureCount', 'FastGetExtent', 'CreateField', 'Transactions', 'DeleteFeature', and 'FastSetNextByIndex'. diff --git a/django/contrib/gis/gdal/libgdal.py b/django/contrib/gis/gdal/libgdal.py index 49d6363878..6a942fb630 100644 --- a/django/contrib/gis/gdal/libgdal.py +++ b/django/contrib/gis/gdal/libgdal.py @@ -52,7 +52,7 @@ elif os.name == "posix": else: raise ImproperlyConfigured('GDAL is unsupported on OS "%s".' % os.name) -# Using the ctypes `find_library` utility to find the +# Using the ctypes `find_library` utility to find the # path to the GDAL library from the list of library names. if lib_names: for lib_name in lib_names: @@ -71,7 +71,7 @@ if lib_path is None: lgdal = CDLL(lib_path) # On Windows, the GDAL binaries have some OSR routines exported with -# STDCALL, while others are not. Thus, the library will also need to +# STDCALL, while others are not. Thus, the library will also need to # be loaded up as WinDLL for said OSR functions that require the # different calling convention. if os.name == "nt": diff --git a/django/contrib/gis/gdal/prototypes/errcheck.py b/django/contrib/gis/gdal/prototypes/errcheck.py index d970b2e4d2..82b1360687 100644 --- a/django/contrib/gis/gdal/prototypes/errcheck.py +++ b/django/contrib/gis/gdal/prototypes/errcheck.py @@ -37,9 +37,9 @@ def check_const_string(result, func, cargs, offset=None, cpl=False): def check_string(result, func, cargs, offset=-1, str_result=False): """ Check the string output returned from the given function, and free - the string pointer allocated by OGR. The `str_result` keyword + the string pointer allocated by OGR. The `str_result` keyword may be used when the result is the string pointer, otherwise - the OGR error code is assumed. The `offset` keyword may be used + the OGR error code is assumed. The `offset` keyword may be used to extract the string pointer passed in by-reference at the given slice offset in the function arguments. """ @@ -134,7 +134,7 @@ def check_pointer(result, func, cargs): def check_str_arg(result, func, cargs): """ This is for the OSRGet[Angular|Linear]Units functions, which - require that the returned string pointer not be freed. This + require that the returned string pointer not be freed. This returns both the double and string values. """ dbl = result diff --git a/django/contrib/gis/gdal/srs.py b/django/contrib/gis/gdal/srs.py index 8bf72ab63d..7062354bf2 100644 --- a/django/contrib/gis/gdal/srs.py +++ b/django/contrib/gis/gdal/srs.py @@ -113,8 +113,8 @@ class SpatialReference(GDALBase): def __getitem__(self, target): """ Return the value of the given string attribute node, None if the node - doesn't exist. Can also take a tuple as a parameter, (target, child), - where child is the index of the attribute in the WKT. For example: + doesn't exist. Can also take a tuple as a parameter, (target, child), + where child is the index of the attribute in the WKT. For example: >>> wkt = 'GEOGCS["WGS 84", DATUM["WGS_1984, ... AUTHORITY["EPSG","4326"]]' >>> srs = SpatialReference(wkt) # could also use 'WGS84', or 4326 diff --git a/django/contrib/gis/geoip2.py b/django/contrib/gis/geoip2.py index 1e4a464068..c902522379 100644 --- a/django/contrib/gis/geoip2.py +++ b/django/contrib/gis/geoip2.py @@ -81,7 +81,7 @@ class GeoIP2: * cache: The cache settings when opening up the GeoIP datasets. May be an integer in (0, 1, 2, 4, 8) corresponding to the MODE_AUTO, MODE_MMAP_EXT, MODE_MMAP, MODE_FILE, and MODE_MEMORY, - `GeoIPOptions` C API settings, respectively. Defaults to 0, + `GeoIPOptions` C API settings, respectively. Defaults to 0, meaning MODE_AUTO. * country: The name of the GeoIP country data file. Defaults to diff --git a/django/contrib/gis/geometry.py b/django/contrib/gis/geometry.py index 7aac8644ee..f298ab2648 100644 --- a/django/contrib/gis/geometry.py +++ b/django/contrib/gis/geometry.py @@ -2,7 +2,7 @@ import re from django.utils.regex_helper import _lazy_re_compile -# Regular expression for recognizing HEXEWKB and WKT. A prophylactic measure +# Regular expression for recognizing HEXEWKB and WKT. A prophylactic measure # to prevent potentially malicious input from reaching the underlying C # library. Not a substitute for good web security programming practices. hex_regex = _lazy_re_compile(r"^[0-9A-F]+$", re.I) diff --git a/django/contrib/gis/geos/__init__.py b/django/contrib/gis/geos/__init__.py index f50cd19856..060c75fdd9 100644 --- a/django/contrib/gis/geos/__init__.py +++ b/django/contrib/gis/geos/__init__.py @@ -1,5 +1,5 @@ """ -The GeoDjango GEOS module. Please consult the GeoDjango documentation +The GeoDjango GEOS module. Please consult the GeoDjango documentation for more details: https://docs.djangoproject.com/en/dev/ref/contrib/gis/geos/ """ diff --git a/django/contrib/gis/geos/geometry.py b/django/contrib/gis/geos/geometry.py index 477b7afa5e..cfc2d695ea 100644 --- a/django/contrib/gis/geos/geometry.py +++ b/django/contrib/gis/geos/geometry.py @@ -609,7 +609,7 @@ class GEOSGeometryBase(GEOSBase): def simplify(self, tolerance=0.0, preserve_topology=False): """ Return the Geometry, simplified using the Douglas-Peucker algorithm - to the specified tolerance (higher tolerance => less points). If no + to the specified tolerance (higher tolerance => less points). If no tolerance provided, defaults to 0. By default, don't preserve topology - e.g. polygons can be split, diff --git a/django/contrib/gis/geos/io.py b/django/contrib/gis/geos/io.py index 8dd3f289e6..3c84345da5 100644 --- a/django/contrib/gis/geos/io.py +++ b/django/contrib/gis/geos/io.py @@ -1,6 +1,6 @@ """ Module that holds classes for performing I/O operations on GEOS geometry -objects. Specifically, this has Python implementations of WKB/WKT +objects. Specifically, this has Python implementations of WKB/WKT reader and writer classes. """ diff --git a/django/contrib/gis/geos/libgeos.py b/django/contrib/gis/geos/libgeos.py index 2707fef283..501c28c6d3 100644 --- a/django/contrib/gis/geos/libgeos.py +++ b/django/contrib/gis/geos/libgeos.py @@ -41,7 +41,7 @@ def load_geos(): raise ImportError('Unsupported OS "%s"' % os.name) # Using the ctypes `find_library` utility to find the path to the GEOS - # shared library. This is better than manually specifying each library name + # shared library. This is better than manually specifying each library name # and extension (e.g., libgeos_c.[so|so.1|dylib].). if lib_names: for lib_name in lib_names: @@ -55,13 +55,13 @@ def load_geos(): 'Could not find the GEOS library (tried "%s"). ' "Try setting GEOS_LIBRARY_PATH in your settings." % '", "'.join(lib_names) ) - # Getting the GEOS C library. The C interface (CDLL) is used for + # Getting the GEOS C library. The C interface (CDLL) is used for # both *NIX and Windows. # See the GEOS C API source code for more details on the library function calls: # https://libgeos.org/doxygen/geos__c_8h_source.html _lgeos = CDLL(lib_path) # Here we set up the prototypes for the initGEOS_r and finishGEOS_r - # routines. These functions aren't actually called until they are + # routines. These functions aren't actually called until they are # attached to a GEOS context handle -- this actually occurs in # geos/prototypes/threadsafe.py. _lgeos.initGEOS_r.restype = CONTEXT_PTR diff --git a/django/contrib/gis/geos/linestring.py b/django/contrib/gis/geos/linestring.py index 78a265cebf..357084cc8d 100644 --- a/django/contrib/gis/geos/linestring.py +++ b/django/contrib/gis/geos/linestring.py @@ -14,7 +14,7 @@ class LineString(LinearGeometryMixin, GEOSGeometry): def __init__(self, *args, **kwargs): """ Initialize on the given sequence -- may take lists, tuples, NumPy arrays - of X,Y pairs, or Point objects. If Point objects are used, ownership is + of X,Y pairs, or Point objects. If Point objects are used, ownership is _not_ transferred to the LineString object. Examples: diff --git a/django/contrib/gis/geos/polygon.py b/django/contrib/gis/geos/polygon.py index 9e8d30647b..554447c73f 100644 --- a/django/contrib/gis/geos/polygon.py +++ b/django/contrib/gis/geos/polygon.py @@ -127,7 +127,7 @@ class Polygon(GEOSGeometry): def _get_single_internal(self, index): """ Return the ring at the specified index. The first index, 0, will - always return the exterior ring. Indices > 0 will return the + always return the exterior ring. Indices > 0 will return the interior ring at the given index (e.g., poly[1] and poly[2] would return the first and second interior ring, respectively). diff --git a/django/contrib/gis/geos/prototypes/geom.py b/django/contrib/gis/geos/prototypes/geom.py index 3996544033..89f8ad4d4a 100644 --- a/django/contrib/gis/geos/prototypes/geom.py +++ b/django/contrib/gis/geos/prototypes/geom.py @@ -14,7 +14,7 @@ c_uchar_p = POINTER(c_ubyte) # We create a simple subclass of c_char_p here because when the response # type is set to c_char_p, you get a _Python_ string and there's no way # to access the string's address inside the error checking function. -# In other words, you can't free the memory allocated inside GEOS. Previously, +# In other words, you can't free the memory allocated inside GEOS. Previously, # the return type would just be omitted and the integer address would be # used -- but this allows us to be specific in the function definition and # keeps the reference so it may be free'd. diff --git a/django/contrib/gis/geos/prototypes/io.py b/django/contrib/gis/geos/prototypes/io.py index def976329d..e86d82ad09 100644 --- a/django/contrib/gis/geos/prototypes/io.py +++ b/django/contrib/gis/geos/prototypes/io.py @@ -82,7 +82,7 @@ wkb_reader_destroy = GEOSFuncFactory("GEOSWKBReader_destroy", argtypes=[WKB_READ class WKBReadFunc(GEOSFuncFactory): # Although the function definitions take `const unsigned char *` # as their parameter, we use c_char_p here so the function may - # take Python strings directly as parameters. Inside Python there + # take Python strings directly as parameters. Inside Python there # is not a difference between signed and unsigned characters, so # it is not a problem. argtypes = [WKB_READ_PTR, c_char_p, c_size_t] @@ -318,7 +318,7 @@ class WKBWriter(IOBase): # `ThreadLocalIO` object holds instances of the WKT and WKB reader/writer -# objects that are local to the thread. The `GEOSGeometry` internals +# objects that are local to the thread. The `GEOSGeometry` internals # access these instances by calling the module-level functions, defined # below. class ThreadLocalIO(threading.local): diff --git a/django/contrib/gis/sitemaps/views.py b/django/contrib/gis/sitemaps/views.py index 17eb54e60c..725543f18e 100644 --- a/django/contrib/gis/sitemaps/views.py +++ b/django/contrib/gis/sitemaps/views.py @@ -18,7 +18,7 @@ def kml(request, label, model, field_name=None, compress=False, using=DEFAULT_DB klass = apps.get_model(label, model) except LookupError: raise Http404( - 'You must supply a valid app label and module name. Got "%s.%s"' + 'You must supply a valid app label and module name. Got "%s.%s"' % (label, model) ) diff --git a/django/contrib/gis/utils/layermapping.py b/django/contrib/gis/utils/layermapping.py index 137dd6b7f7..f5c5695b80 100644 --- a/django/contrib/gis/utils/layermapping.py +++ b/django/contrib/gis/utils/layermapping.py @@ -109,7 +109,7 @@ class LayerMapping: """ A LayerMapping object is initialized using the given Model (not an instance), a DataSource (or string path to an OGR-supported data file), and a mapping - dictionary. See the module level docstring for more details and keyword + dictionary. See the module level docstring for more details and keyword argument usage. """ # Getting the DataSource and the associated Layer. @@ -195,7 +195,7 @@ class LayerMapping: need to increment through each feature in the Layer. """ # The geometry field of the model is set here. - # TODO: Support more than one geometry field / model. However, this + # TODO: Support more than one geometry field / model. However, this # depends on the GDAL Driver in use. self.geom_field = False self.fields = {} @@ -263,7 +263,7 @@ class LayerMapping: ) # Setting the `geom_field` attribute w/the name of the model field - # that is a Geometry. Also setting the coordinate dimension + # that is a Geometry. Also setting the coordinate dimension # attribute. self.geom_field = field_name self.coord_dim = coord_dim @@ -570,7 +570,7 @@ class LayerMapping: fid_range: May be set with a slice or tuple of (begin, end) feature ID's to map - from the data source. In other words, this keyword enables the user + from the data source. In other words, this keyword enables the user to selectively import a subset range of features in the geographic data source. @@ -581,13 +581,13 @@ class LayerMapping: progress: When this keyword is set, status information will be printed giving - the number of features processed and successfully saved. By default, + the number of features processed and successfully saved. By default, progress information will pe printed every 1000 features processed, however, this default may be overridden by setting this keyword with an integer for the desired interval. stream: - Status information will be written to this file handle. Defaults to + Status information will be written to this file handle. Defaults to using `sys.stdout`, but any object with a `write` method is supported. silent: @@ -596,7 +596,7 @@ class LayerMapping: strict: Execution of the model mapping will cease upon the first error - encountered. The default behavior is to attempt to continue. + encountered. The default behavior is to attempt to continue. """ # Getting the default Feature ID range. default_range = self.check_fid_range(fid_range) diff --git a/django/contrib/gis/utils/ogrinspect.py b/django/contrib/gis/utils/ogrinspect.py index 76c8bfbcfa..88ce8aaff3 100644 --- a/django/contrib/gis/utils/ogrinspect.py +++ b/django/contrib/gis/utils/ogrinspect.py @@ -25,7 +25,7 @@ def mapping(data_source, geom_name="geom", layer_key=0, multi_geom=False): `geom_name` => The name of the geometry field to use for the model. `layer_key` => The key for specifying which layer in the DataSource to use; - defaults to 0 (the first layer). May be an integer index or a string + defaults to 0 (the first layer). May be an integer index or a string identifier for the layer. `multi_geom` => Boolean (default: False) - specify as multigeometry. @@ -91,10 +91,10 @@ def ogrinspect(*args, **kwargs): Otherwise will default to `geom` `layer_key` => The key for specifying which layer in the DataSource to use; - defaults to 0 (the first layer). May be an integer index or a string + defaults to 0 (the first layer). May be an integer index or a string identifier for the layer. - `srid` => The SRID to use for the Geometry Field. If it can be determined, + `srid` => The SRID to use for the Geometry Field. If it can be determined, the SRID of the datasource is used. `multi_geom` => Boolean (default: False) - specify as multigeometry. @@ -107,18 +107,18 @@ def ogrinspect(*args, **kwargs): autogenerated models thus avoiding duplicated imports when building more than one model by batching ogrinspect() - `decimal` => Boolean or sequence (default: False). When set to True + `decimal` => Boolean or sequence (default: False). When set to True all generated model fields corresponding to the `OFTReal` type will - be `DecimalField` instead of `FloatField`. A sequence of specific + be `DecimalField` instead of `FloatField`. A sequence of specific field names to generate as `DecimalField` may also be used. - `blank` => Boolean or sequence (default: False). When set to True all - generated model fields will have `blank=True`. If the user wants to + `blank` => Boolean or sequence (default: False). When set to True all + generated model fields will have `blank=True`. If the user wants to give specific fields to have blank, then a list/tuple of OGR field names may be used. `null` => Boolean (default: False) - When set to True all generated - model fields will have `null=True`. If the user wants to specify + model fields will have `null=True`. If the user wants to specify give specific fields to have null, then a list/tuple of OGR field names may be used. @@ -142,7 +142,7 @@ def _ogrinspect( ): """ Helper routine for `ogrinspect` that generates GeoDjango models corresponding - to the given data source. See the `ogrinspect` docstring for more details. + to the given data source. See the `ogrinspect` docstring for more details. """ # Getting the DataSource if isinstance(data_source, str): diff --git a/django/contrib/gis/utils/srs.py b/django/contrib/gis/utils/srs.py index 2204767923..94d141f1cb 100644 --- a/django/contrib/gis/utils/srs.py +++ b/django/contrib/gis/utils/srs.py @@ -8,7 +8,7 @@ def add_srs_entry( """ Take a GDAL SpatialReference system and add its information to the `spatial_ref_sys` table of the spatial backend. Doing this enables - database-level spatial transformations for the backend. Thus, this utility + database-level spatial transformations for the backend. Thus, this utility is useful for adding spatial reference systems not included by default with the backend: diff --git a/django/contrib/sessions/backends/file.py b/django/contrib/sessions/backends/file.py index 9710cd2769..8f085595cb 100644 --- a/django/contrib/sessions/backends/file.py +++ b/django/contrib/sessions/backends/file.py @@ -130,7 +130,7 @@ class SessionStore(SessionBase): session_file_name = self._key_to_file() try: - # Make sure the file exists. If it does not already exist, an + # Make sure the file exists. If it does not already exist, an # empty placeholder file is created. flags = os.O_WRONLY | getattr(os, "O_BINARY", 0) if must_create: @@ -145,7 +145,7 @@ class SessionStore(SessionBase): raise CreateError # Write the session file without interfering with other threads - # or processes. By writing to an atomically generated temporary + # or processes. By writing to an atomically generated temporary # file and then using the atomic os.rename() to make the complete # file visible, we avoid having to lock the session file, while # still maintaining its integrity. @@ -153,7 +153,7 @@ class SessionStore(SessionBase): # Note: Locking the session file was explored, but rejected in part # because in order to be atomic and cross-platform, it required a # long-lived lock file for each session, doubling the number of - # files in the session storage directory at any given time. This + # files in the session storage directory at any given time. This # rename solution is cleaner and avoids any additional overhead # when reading the session data, which is the more common case # unless SESSION_SAVE_EVERY_REQUEST = True. diff --git a/django/core/cache/__init__.py b/django/core/cache/__init__.py index 444d958e68..4354941cb0 100644 --- a/django/core/cache/__init__.py +++ b/django/core/cache/__init__.py @@ -3,7 +3,7 @@ Caching framework. This package defines set of cache backends that all conform to a simple API. In a nutshell, a cache is a set of values -- which can be any object that -may be pickled -- identified by string keys. For the complete API, see +may be pickled -- identified by string keys. For the complete API, see the abstract BaseCache class in django.core.cache.backends.base. Client code should use the `cache` variable defined here to access the default diff --git a/django/core/cache/backends/base.py b/django/core/cache/backends/base.py index 1111fdb41f..aef9986389 100644 --- a/django/core/cache/backends/base.py +++ b/django/core/cache/backends/base.py @@ -303,7 +303,7 @@ class BaseCache: def set_many(self, data, timeout=DEFAULT_TIMEOUT, version=None): """ Set a bunch of values in the cache at once from a dict of key/value - pairs. For certain backends (memcached), this is much more efficient + pairs. For certain backends (memcached), this is much more efficient than calling set() multiple times. If timeout is given, use that timeout for the key; otherwise use the diff --git a/django/core/files/images.py b/django/core/files/images.py index 7c1532ac8f..c7d71dc809 100644 --- a/django/core/files/images.py +++ b/django/core/files/images.py @@ -34,7 +34,7 @@ class ImageFile(File): def get_image_dimensions(file_or_path, close=False): """ - Return the (width, height) of an image, given an open file or a path. Set + Return the (width, height) of an image, given an open file or a path. Set 'close' to True to close the file at the end if it is initially in an open state. """ diff --git a/django/core/files/move.py b/django/core/files/move.py index 57508fab82..1605bebc1a 100644 --- a/django/core/files/move.py +++ b/django/core/files/move.py @@ -84,7 +84,7 @@ def file_move_safe( os.remove(old_file_name) except PermissionError as e: # Certain operating systems (Cygwin and Windows) - # fail when deleting opened files, ignore it. (For the + # fail when deleting opened files, ignore it. (For the # systems where this happens, temporary files will be auto-deleted # on close anyway.) if getattr(e, "winerror", 0) != 32: diff --git a/django/core/files/utils.py b/django/core/files/utils.py index c730ca17e8..a80faeb3cf 100644 --- a/django/core/files/utils.py +++ b/django/core/files/utils.py @@ -26,7 +26,7 @@ def validate_file_name(name, allow_relative_path=False): class FileProxyMixin: """ A mixin class used to forward file methods to an underlying file - object. The internal file object has to be called "file":: + object. The internal file object has to be called "file":: class FileProxy(FileProxyMixin): def __init__(self, file): diff --git a/django/core/management/base.py b/django/core/management/base.py index 12b4b42f61..92a3abb01e 100644 --- a/django/core/management/base.py +++ b/django/core/management/base.py @@ -214,7 +214,7 @@ class BaseCommand: SQL statements, will be wrapped in ``BEGIN`` and ``COMMIT``. 4. If ``handle()`` or ``execute()`` raised any exception (e.g. - ``CommandError``), ``run_from_argv()`` will instead print an error + ``CommandError``), ``run_from_argv()`` will instead print an error message to ``stderr``. Thus, the ``handle()`` method is typically the starting point for diff --git a/django/core/management/commands/makemessages.py b/django/core/management/commands/makemessages.py index 148565dab0..ac67a5bc9f 100644 --- a/django/core/management/commands/makemessages.py +++ b/django/core/management/commands/makemessages.py @@ -297,7 +297,7 @@ class Command(BaseCommand): nargs="?", help=( "Controls '#: filename:line' lines. If the option is 'full' " - "(the default if not given), the lines include both file name " + "(the default if not given), the lines include both file name " "and line number. If it's 'file', the line number is omitted. If " "it's 'never', the lines are suppressed (same as --no-location). " "--add-location requires gettext 0.19 or newer." diff --git a/django/core/serializers/__init__.py b/django/core/serializers/__init__.py index 480c54b79b..7e23769533 100644 --- a/django/core/serializers/__init__.py +++ b/django/core/serializers/__init__.py @@ -199,7 +199,7 @@ def sort_dependencies(app_list, allow_cycles=False): if hasattr(rel_model, "natural_key") and rel_model != model: deps.append(rel_model) # Also add a dependency for any simple M2M relation with a model - # that defines a natural key. M2M relations with explicit through + # that defines a natural key. M2M relations with explicit through # models don't count as dependencies. for field in model._meta.many_to_many: if field.remote_field.through._meta.auto_created: diff --git a/django/db/backends/oracle/base.py b/django/db/backends/oracle/base.py index 9fd82dd705..d00c28c3e9 100644 --- a/django/db/backends/oracle/base.py +++ b/django/db/backends/oracle/base.py @@ -309,7 +309,7 @@ class DatabaseWrapper(BaseDatabaseWrapper): # these are set in single statement it isn't clear what is supposed # to happen. cursor.execute("ALTER SESSION SET NLS_TERRITORY = 'AMERICA'") - # Set Oracle date to ANSI date format. This only needs to execute + # Set Oracle date to ANSI date format. This only needs to execute # once when we create a new connection. We also set the Territory # to 'AMERICA' which forces Sunday to evaluate to a '1' in # TO_CHAR(). @@ -578,8 +578,8 @@ class FormatStylePlaceholderCursor: return [p.force_bytes for p in params] def _fix_for_params(self, query, params, unify_by_values=False): - # oracledb wants no trailing ';' for SQL statements. For PL/SQL, it - # it does want a trailing ';' but not a trailing '/'. However, these + # oracledb wants no trailing ';' for SQL statements. For PL/SQL, it + # does want a trailing ';' but not a trailing '/'. However, these # characters must be included in the original query in case the query # is being passed to SQL*Plus. if query.endswith(";") or query.endswith("/"): diff --git a/django/db/backends/oracle/operations.py b/django/db/backends/oracle/operations.py index 3f4cf8156a..46a681a520 100644 --- a/django/db/backends/oracle/operations.py +++ b/django/db/backends/oracle/operations.py @@ -372,7 +372,7 @@ END; return value.read() def quote_name(self, name): - # SQL92 requires delimited (quoted) names to be case-sensitive. When + # SQL92 requires delimited (quoted) names to be case-sensitive. When # not quoted, Oracle has case-insensitive behavior for identifiers, but # always defaults to uppercase. # We simplify things by making Oracle identifiers always uppercase. diff --git a/django/db/models/deletion.py b/django/db/models/deletion.py index da2e934c96..9221364ff4 100644 --- a/django/db/models/deletion.py +++ b/django/db/models/deletion.py @@ -115,7 +115,7 @@ class Collector: def add(self, objs, source=None, nullable=False, reverse_dependency=False): """ - Add 'objs' to the collection of objects to be deleted. If the call is + Add 'objs' to the collection of objects to be deleted. If the call is the result of a cascade, 'source' should be the model that caused it, and 'nullable' should be set to True if the relation can be null. @@ -254,8 +254,8 @@ class Collector: ): """ Add 'objs' to the collection of objects to be deleted as well as all - parent instances. 'objs' must be a homogeneous iterable collection of - model instances (e.g. a QuerySet). If 'collect_related' is True, + parent instances. 'objs' must be a homogeneous iterable collection of + model instances (e.g. a QuerySet). If 'collect_related' is True, related objects will be handled by their respective on_delete handler. If the call is the result of a cascade, 'source' should be the model diff --git a/django/db/models/fields/files.py b/django/db/models/fields/files.py index 03c3939a4e..8f807b1156 100644 --- a/django/db/models/fields/files.py +++ b/django/db/models/fields/files.py @@ -388,10 +388,10 @@ class ImageFileDescriptor(FileDescriptor): # To prevent recalculating image dimensions when we are instantiating # an object from the database (bug #11084), only update dimensions if - # the field had a value before this assignment. Since the default + # the field had a value before this assignment. Since the default # value for FileField subclasses is an instance of field.attr_class, # previous_file will only be None when we are called from - # Model.__init__(). The ImageField.update_dimension_fields method + # Model.__init__(). The ImageField.update_dimension_fields method # hooked up to the post_init signal handles the Model.__init__() cases. # Assignment happening outside of Model.__init__() will trigger the # update right here. @@ -476,8 +476,8 @@ class ImageField(FileField): Update field's width and height fields, if defined. This method is hooked up to model's post_init signal to update - dimensions after instantiating a model instance. However, dimensions - won't be updated if the dimensions fields are already populated. This + dimensions after instantiating a model instance. However, dimensions + won't be updated if the dimensions fields are already populated. This avoids unnecessary recalculation when loading an object from the database. @@ -505,9 +505,9 @@ class ImageField(FileField): ) # When both dimension fields have values, we are most likely loading # data from the database or updating an image field that already had - # an image stored. In the first case, we don't want to update the + # an image stored. In the first case, we don't want to update the # dimension fields because we are already getting their values from the - # database. In the second case, we do want to update the dimensions + # database. In the second case, we do want to update the dimensions # fields and will skip this return because force will be True since we # were called from ImageFileDescriptor.__set__. if dimension_fields_filled and not force: diff --git a/django/db/models/query.py b/django/db/models/query.py index 63ab4a873a..8163b5b973 100644 --- a/django/db/models/query.py +++ b/django/db/models/query.py @@ -2326,7 +2326,7 @@ def prefetch_related_objects(model_instances, *related_lookups): return # nothing to do # We need to be able to dynamically add to the list of prefetch_related - # lookups that we look up (see below). So we need some book keeping to + # lookups that we look up (see below). So we need some book keeping to # ensure we don't do duplicate work. done_queries = {} # dictionary of things like 'foo__bar': [results] diff --git a/django/http/request.py b/django/http/request.py index daaf3748cc..ff5974770f 100644 --- a/django/http/request.py +++ b/django/http/request.py @@ -232,7 +232,7 @@ class HttpRequest: """ Attempt to return a signed cookie. If the signature fails or the cookie has expired, raise an exception, unless the `default` argument - is provided, in which case return that value. + is provided, in which case return that value. """ try: cookie_value = self.COOKIES[key] diff --git a/django/middleware/csrf.py b/django/middleware/csrf.py index 5ae1aae5c6..2e4b30ed54 100644 --- a/django/middleware/csrf.py +++ b/django/middleware/csrf.py @@ -100,7 +100,7 @@ def get_token(request): A side effect of calling this function is to make the csrf_protect decorator and the CsrfViewMiddleware add a CSRF cookie and a 'Vary: Cookie' - header to the outgoing response. For this reason, you may need to use this + header to the outgoing response. For this reason, you may need to use this function lazily, as is done by the csrf context processor. """ if "CSRF_COOKIE" in request.META: @@ -201,7 +201,7 @@ class CsrfViewMiddleware(MiddlewareMixin): # requires_csrf_token decorator. def _accept(self, request): # Avoid checking the request twice by adding a custom attribute to - # request. This will be relevant when both decorator and middleware + # request. This will be relevant when both decorator and middleware # are used. request.csrf_processing_done = True return None diff --git a/django/template/defaulttags.py b/django/template/defaulttags.py index a511f17310..17a97ec788 100644 --- a/django/template/defaulttags.py +++ b/django/template/defaulttags.py @@ -87,7 +87,7 @@ class CsrfTokenNode(Node): if settings.DEBUG: warnings.warn( "A {% csrf_token %} was used in a template, but the context " - "did not provide the value. This is usually caused by not " + "did not provide the value. This is usually caused by not " "using RequestContext." ) return "" @@ -205,7 +205,7 @@ class ForNode(Node): values = reversed(values) num_loopvars = len(self.loopvars) unpack = num_loopvars > 1 - # Create a forloop value in the context. We'll update counters on each + # Create a forloop value in the context. We'll update counters on each # iteration just below. loop_dict = context["forloop"] = { "parentloop": parentloop, @@ -720,7 +720,7 @@ def do_filter(parser, token): filter_name = getattr(func, "_filter_name", None) if filter_name in ("escape", "safe"): raise TemplateSyntaxError( - '"filter %s" is not permitted. Use the "autoescape" tag instead.' + '"filter %s" is not permitted. Use the "autoescape" tag instead.' % filter_name ) nodelist = parser.parse(("endfilter",)) diff --git a/django/template/library.py b/django/template/library.py index 3ec39ff572..1a65087e92 100644 --- a/django/template/library.py +++ b/django/template/library.py @@ -484,5 +484,5 @@ def import_library(name): return module.register except AttributeError: raise InvalidTemplateLibrary( - "Module %s does not have a variable named 'register'" % name, + "Module %s does not have a variable named 'register'" % name, ) diff --git a/django/template/smartif.py b/django/template/smartif.py index 6a6a03dd84..c1ed0ff065 100644 --- a/django/template/smartif.py +++ b/django/template/smartif.py @@ -3,7 +3,7 @@ Parser and utilities for the smart 'if' tag """ # Using a simple top down parser, as described here: -# https://11l-lang.org/archive/simple-top-down-parsing/ +# https://11l-lang.org/archive/simple-top-down-parsing/ # 'led' = left denotation # 'nud' = null denotation # 'bp' = binding power (left = lbp, right = rbp) @@ -60,7 +60,7 @@ def infix(bp, func): try: return func(context, self.first, self.second) except Exception: - # Templates shouldn't throw exceptions when rendering. We are + # Templates shouldn't throw exceptions when rendering. We are # most likely to get exceptions for things like {% if foo in bar # %} where 'bar' does not support 'in', so default to False return False diff --git a/django/templatetags/cache.py b/django/templatetags/cache.py index 1c48db7ce9..8c0b2722e1 100644 --- a/django/templatetags/cache.py +++ b/django/templatetags/cache.py @@ -77,7 +77,7 @@ def do_cache(parser, token): Optionally the cache to use may be specified thus:: - {% cache .... using="cachename" %} + {% cache .... using="cachename" %} Each unique set of arguments will result in a unique cache entry. """ diff --git a/django/test/client.py b/django/test/client.py index c733372130..fe4cb8f9d7 100644 --- a/django/test/client.py +++ b/django/test/client.py @@ -177,7 +177,7 @@ class ClientHandler(BaseHandler): request_started.connect(close_old_connections) request = WSGIRequest(environ) # sneaky little hack so that we can easily get round - # CsrfViewMiddleware. This makes life easier, and is probably + # CsrfViewMiddleware. This makes life easier, and is probably # required for backwards compatibility with external tests against # admin views. request._dont_enforce_csrf_checks = not self.enforce_csrf_checks diff --git a/django/utils/archive.py b/django/utils/archive.py index 56f34c0038..4042e89af9 100644 --- a/django/utils/archive.py +++ b/django/utils/archive.py @@ -101,7 +101,7 @@ class Archive: class BaseArchive: """ - Base Archive class. Implementations should inherit this class. + Base Archive class. Implementations should inherit this class. """ @staticmethod diff --git a/django/utils/crypto.py b/django/utils/crypto.py index 5134b854d6..4b8146695a 100644 --- a/django/utils/crypto.py +++ b/django/utils/crypto.py @@ -35,7 +35,7 @@ def salted_hmac(key_salt, value, secret=None, *, algorithm="sha1"): raise InvalidAlgorithm( "%r is not an algorithm accepted by the hashlib module." % algorithm ) from e - # We need to generate a derived key from our base key. We can do this by + # We need to generate a derived key from our base key. We can do this by # passing the key_salt and our base key through a pseudo-random function. key = hasher(key_salt + secret).digest() # If len(key_salt + secret) > block size of the hash algorithm, the above diff --git a/django/utils/timesince.py b/django/utils/timesince.py index 766b6f7030..a61b02d94d 100644 --- a/django/utils/timesince.py +++ b/django/utils/timesince.py @@ -39,7 +39,7 @@ def timesince(d, now=None, reversed=False, time_strings=None, depth=2): but also between 2007/08/10 and 2008/09/10 despite the delta being 393 days in the former case and 397 in the latter. - Up to `depth` adjacent units will be displayed. For example, + Up to `depth` adjacent units will be displayed. For example, "2 weeks, 3 days" and "1 year, 3 months" are possible outputs, but "2 weeks, 3 hours" and "1 year, 5 days" are not. diff --git a/django/views/decorators/csrf.py b/django/views/decorators/csrf.py index 4b8b8804b0..64c478b42e 100644 --- a/django/views/decorators/csrf.py +++ b/django/views/decorators/csrf.py @@ -9,7 +9,7 @@ csrf_protect = decorator_from_middleware(CsrfViewMiddleware) csrf_protect.__name__ = "csrf_protect" csrf_protect.__doc__ = """ This decorator adds CSRF protection in exactly the same way as -CsrfViewMiddleware, but it can be used on a per view basis. Using both, or +CsrfViewMiddleware, but it can be used on a per view basis. Using both, or using the decorator multiple times, is harmless and efficient. """ diff --git a/django/views/decorators/http.py b/django/views/decorators/http.py index efdaa21e30..408039937c 100644 --- a/django/views/decorators/http.py +++ b/django/views/decorators/http.py @@ -20,7 +20,7 @@ conditional_page = decorator_from_middleware(ConditionalGetMiddleware) def require_http_methods(request_method_list): """ - Decorator to make a view only accept particular request methods. Usage:: + Decorator to make a view only accept particular request methods. Usage:: @require_http_methods(["GET", "POST"]) def my_view(request): diff --git a/django/views/generic/edit.py b/django/views/generic/edit.py index ebd071cf00..d016b09634 100644 --- a/django/views/generic/edit.py +++ b/django/views/generic/edit.py @@ -123,7 +123,7 @@ class ModelFormMixin(FormMixin, SingleObjectMixin): url = self.object.get_absolute_url() except AttributeError: raise ImproperlyConfigured( - "No URL to redirect to. Either provide a url or define" + "No URL to redirect to. Either provide a url or define" " a get_absolute_url method on the Model." ) return url diff --git a/django/views/static.py b/django/views/static.py index b24f0e30f9..0a583a7405 100644 --- a/django/views/static.py +++ b/django/views/static.py @@ -37,7 +37,7 @@ def serve(request, path, document_root=None, show_indexes=False): in your URLconf. You must provide the ``document_root`` param. You may also set ``show_indexes`` to ``True`` if you'd like to serve a basic index - of the directory. This index view will use the template hardcoded below, + of the directory. This index view will use the template hardcoded below, but if you'd like to override it, you can create a template called ``static/directory_index.html``. """ @@ -105,7 +105,7 @@ def was_modified_since(header=None, mtime=0): Was something modified since the user last downloaded it? header - This is the value of the If-Modified-Since header. If this is None, + This is the value of the If-Modified-Since header. If this is None, I'll just return True. mtime diff --git a/docs/conf.py b/docs/conf.py index be79b9133c..eaee5cd503 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -198,23 +198,23 @@ suppress_warnings = ["app.add_directive", "epub.duplicated_toc_entry"] # -- Options for HTML output --------------------------------------------------- -# The theme to use for HTML and HTML Help pages. See the documentation for +# The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. html_theme = "djangodocs" # Theme options are theme-specific and customize the look and feel of a theme -# further. For a list of options available for each theme, see the +# further. For a list of options available for each theme, see the # documentation. # html_theme_options = {} # Add any paths that contain custom themes here, relative to this directory. html_theme_path = ["_theme"] -# The name for this set of Sphinx documents. If None, it defaults to +# The name for this set of Sphinx documents. If None, it defaults to # " v documentation". # html_title = None -# A shorter title for the navigation bar. Default is the same as html_title. +# A shorter title for the navigation bar. Default is the same as html_title. # html_short_title = None # The name of an image file (relative to this directory) to place at the top @@ -222,7 +222,7 @@ html_theme_path = ["_theme"] # html_logo = None # The name of an image file (within the static path) to use as favicon of the -# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 +# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. # html_favicon = None @@ -264,7 +264,7 @@ html_additional_pages = {} # html_show_copyright = True # If true, an OpenSearch description file will be output, and all pages will -# contain a tag referring to it. The value of this option must be the +# contain a tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. # html_use_opensearch = '' diff --git a/docs/ref/contrib/gis/install/geolibs.txt b/docs/ref/contrib/gis/install/geolibs.txt index 1153cc004c..502e687796 100644 --- a/docs/ref/contrib/gis/install/geolibs.txt +++ b/docs/ref/contrib/gis/install/geolibs.txt @@ -54,7 +54,7 @@ totally fine with GeoDjango. Your mileage may vary. .. note:: The GeoDjango interfaces to GEOS, GDAL, and GeoIP may be used - independently of Django. In other words, no database or settings file + independently of Django. In other words, no database or settings file required -- import them as normal from :mod:`django.contrib.gis`. .. _PROJ: https://proj.org/ diff --git a/docs/ref/contrib/gis/install/index.txt b/docs/ref/contrib/gis/install/index.txt index e7bc885d4b..f18f4438bb 100644 --- a/docs/ref/contrib/gis/install/index.txt +++ b/docs/ref/contrib/gis/install/index.txt @@ -50,7 +50,7 @@ spatial databases currently supported. open source spatial database. The geospatial libraries required for a GeoDjango installation depends -on the spatial database used. The following lists the library requirements, +on the spatial database used. The following lists the library requirements, supported versions, and any notes for each of the supported database backends: ================== ============================== ================== ========================================= @@ -108,7 +108,7 @@ If you can't find the solution to your problem here then participate in the community! You can: * Ask your question on the `GeoDjango`__ forum. -* File a ticket on the `Django trac`__ if you think there's a bug. Make +* File a ticket on the `Django trac`__ if you think there's a bug. Make sure to provide a complete description of the problem, versions used, and specify the component as "GIS". @@ -133,9 +133,9 @@ system. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ A user may set this environment variable to customize the library paths -they want to use. The typical library directory for software -built from source is ``/usr/local/lib``. Thus, ``/usr/local/lib`` needs -to be included in the ``LD_LIBRARY_PATH`` variable. For example, the user +they want to use. The typical library directory for software +built from source is ``/usr/local/lib``. Thus, ``/usr/local/lib`` needs +to be included in the ``LD_LIBRARY_PATH`` variable. For example, the user could place the following in their bash profile: .. code-block:: shell @@ -148,7 +148,7 @@ Setting system library path On GNU/Linux systems, there is typically a file in ``/etc/ld.so.conf``, which may include additional paths from files in another directory, such as ``/etc/ld.so.conf.d``. As the root user, add the custom library path (like ``/usr/local/lib``) on a -new line in ``ld.so.conf``. This is *one* example of how to do so: +new line in ``ld.so.conf``. This is *one* example of how to do so: .. code-block:: shell @@ -156,8 +156,8 @@ new line in ``ld.so.conf``. This is *one* example of how to do so: $ sudo ldconfig For OpenSolaris users, the system library path may be modified using the -``crle`` utility. Run ``crle`` with no options to see the current configuration -and use ``crle -l`` to set with the new library path. Be *very* careful when +``crle`` utility. Run ``crle`` with no options to see the current configuration +and use ``crle -l`` to set with the new library path. Be *very* careful when modifying the system library path: .. code-block:: shell @@ -170,9 +170,9 @@ Install ``binutils`` ~~~~~~~~~~~~~~~~~~~~ GeoDjango uses the ``find_library`` function (from the ``ctypes.util`` Python -module) to discover libraries. The ``find_library`` routine uses a program +module) to discover libraries. The ``find_library`` routine uses a program called ``objdump`` (part of the ``binutils`` package) to verify a shared -library on GNU/Linux systems. Thus, if ``binutils`` is not installed on your +library on GNU/Linux systems. Thus, if ``binutils`` is not installed on your Linux system then Python's ctypes may not be able to find your library even if your library path is set correctly and geospatial libraries were built perfectly. @@ -216,7 +216,7 @@ Python ~~~~~~ Although macOS comes with Python installed, users can use `framework -installers`__ provided by the Python Software Foundation. An advantage to +installers`__ provided by the Python Software Foundation. An advantage to using the installer is that macOS's Python will remain "pristine" for internal operating system use. @@ -293,7 +293,7 @@ MacPorts ~~~~~~~~ `MacPorts`__ may be used to install GeoDjango prerequisites on computers -running macOS. Because MacPorts still builds the software from source, +running macOS. Because MacPorts still builds the software from source, `Xcode`_ is required. Summary: @@ -344,7 +344,7 @@ PostgreSQL ~~~~~~~~~~ Download the latest `PostgreSQL 15.x installer`__ from the -`EnterpriseDB`__ website. After downloading, run the installer, follow the +`EnterpriseDB`__ website. After downloading, run the installer, follow the on-screen directions, and keep the default options unless you know the consequences of changing them. @@ -392,7 +392,7 @@ OSGeo4W The `OSGeo4W installer`_ helps to install the PROJ, GDAL, and GEOS libraries required by GeoDjango. First, download the `OSGeo4W installer`_, and -run it. Select :menuselection:`Express Web-GIS Install` and click next. In the +run it. Select :menuselection:`Express Web-GIS Install` and click next. In the 'Select Packages' list, ensure that GDAL is selected. If any other packages are enabled by default, they are not required by GeoDjango and may be unchecked safely. After clicking next and accepting the license agreements, the packages @@ -406,7 +406,7 @@ Modify Windows environment In order to use GeoDjango, you will need to add your OSGeo4W directories to your Windows system ``Path``, as well as create ``GDAL_DATA`` -and ``PROJ_LIB`` environment variables. The following set of commands, +and ``PROJ_LIB`` environment variables. The following set of commands, executable with ``cmd.exe``, will set this up. Restart your device once this is complete for new environment variables to be recognized: diff --git a/docs/ref/forms/validation.txt b/docs/ref/forms/validation.txt index 614b345b5a..b857795e7a 100644 --- a/docs/ref/forms/validation.txt +++ b/docs/ref/forms/validation.txt @@ -95,7 +95,7 @@ overridden: :ref:`ModelForm documentation ` for more information) -These methods are run in the order given above, one field at a time. That is, +These methods are run in the order given above, one field at a time. That is, for each field in the form (in the order they are declared in the form definition), the ``Field.clean()`` method (or its override) is run, then ``clean_()``. Finally, once those two methods are run for every diff --git a/docs/ref/forms/widgets.txt b/docs/ref/forms/widgets.txt index 38647aa1c2..2488ba66a3 100644 --- a/docs/ref/forms/widgets.txt +++ b/docs/ref/forms/widgets.txt @@ -225,7 +225,7 @@ foundation for custom widgets. .. class:: Widget(attrs=None) This abstract class cannot be rendered, but provides the basic attribute - :attr:`~Widget.attrs`. You may also implement or override the + :attr:`~Widget.attrs`. You may also implement or override the :meth:`~Widget.render()` method on custom widgets. .. attribute:: Widget.attrs diff --git a/docs/ref/models/expressions.txt b/docs/ref/models/expressions.txt index 060450b6d8..4e8bf266b5 100644 --- a/docs/ref/models/expressions.txt +++ b/docs/ref/models/expressions.txt @@ -830,7 +830,7 @@ an expression that's compatible in a window clause. The ``partition_by`` argument accepts an expression or a sequence of expressions (column names should be wrapped in an ``F``-object) that control -the partitioning of the rows. Partitioning narrows which rows are used to +the partitioning of the rows. Partitioning narrows which rows are used to compute the result set. The :ref:`output_field` is specified either as an argument or by diff --git a/docs/ref/models/instances.txt b/docs/ref/models/instances.txt index 674626b23f..da440f1ba9 100644 --- a/docs/ref/models/instances.txt +++ b/docs/ref/models/instances.txt @@ -31,7 +31,7 @@ need to :meth:`~Model.save()`. method. If you do so, however, take care not to change the calling signature as any change may prevent the model instance from being saved. Additionally, referring to model fields within ``__init__`` may potentially - result in infinite recursion errors in some circumstances. Rather than + result in infinite recursion errors in some circumstances. Rather than overriding ``__init__``, try using one of these approaches: #. Add a classmethod on the model class:: diff --git a/docs/ref/models/lookups.txt b/docs/ref/models/lookups.txt index e993f9b9a1..3d6600dc44 100644 --- a/docs/ref/models/lookups.txt +++ b/docs/ref/models/lookups.txt @@ -149,7 +149,7 @@ following methods: This class follows the :ref:`Query Expression API `, which implies that you can use ``____``. It's a specialized :ref:`Func() expression ` that only accepts - one argument. It can also be used on the right hand side of a filter or + one argument. It can also be used on the right hand side of a filter or directly as an annotation. .. attribute:: bilateral diff --git a/docs/ref/models/options.txt b/docs/ref/models/options.txt index 3433d0730f..30fa3cc374 100644 --- a/docs/ref/models/options.txt +++ b/docs/ref/models/options.txt @@ -181,7 +181,7 @@ not be looking at your Django code. For example:: includes #. Adding an automatic primary key field to the model if you don't - declare it. To avoid confusion for later code readers, it's + declare it. To avoid confusion for later code readers, it's recommended to specify all the columns from the database table you are modeling when using unmanaged models. diff --git a/tests/admin_custom_urls/models.py b/tests/admin_custom_urls/models.py index d1b92dd5ec..1e1bacae7c 100644 --- a/tests/admin_custom_urls/models.py +++ b/tests/admin_custom_urls/models.py @@ -32,7 +32,7 @@ class ActionAdmin(admin.ModelAdmin): def get_urls(self): # Add the URL of our custom 'add_view' view to the front of the URLs - # list. Remove the existing one(s) first + # list. Remove the existing one(s) first from django.urls import re_path def wrap(view): diff --git a/tests/auth_tests/test_context_processors.py b/tests/auth_tests/test_context_processors.py index ab621313e8..7e6c6a556e 100644 --- a/tests/auth_tests/test_context_processors.py +++ b/tests/auth_tests/test_context_processors.py @@ -133,7 +133,7 @@ class AuthContextProcessorTests(TestCase): """ The lazy objects returned behave just like the wrapped objects. """ - # These are 'functional' level tests for common use cases. Direct + # These are 'functional' level tests for common use cases. Direct # testing of the implementation (SimpleLazyObject) is in the 'utils' # tests. self.client.login(username="super", password="secret") @@ -148,7 +148,7 @@ class AuthContextProcessorTests(TestCase): # A Q() comparing a user and with another Q() (in an AND or OR fashion). Q(user=response.context["user"]) & Q(someflag=True) - # Tests for user equality. This is hard because User defines + # Tests for user equality. This is hard because User defines # equality in a non-duck-typing way # See bug #12060 self.assertEqual(response.context["user"], user) diff --git a/tests/auth_tests/test_views.py b/tests/auth_tests/test_views.py index c8f0be1be7..e6419de8e6 100644 --- a/tests/auth_tests/test_views.py +++ b/tests/auth_tests/test_views.py @@ -153,7 +153,7 @@ class PasswordResetTest(AuthViewsTestCase): self.assertEqual(len(mail.outbox), 1) self.assertIn("http://", mail.outbox[0].body) self.assertEqual(settings.DEFAULT_FROM_EMAIL, mail.outbox[0].from_email) - # optional multipart text/html email has been added. Make sure original, + # optional multipart text/html email has been added. Make sure original, # default functionality is 100% the same self.assertFalse(mail.outbox[0].message().is_multipart()) diff --git a/tests/csrf_tests/tests.py b/tests/csrf_tests/tests.py index 899e0f6ddd..765d950b85 100644 --- a/tests/csrf_tests/tests.py +++ b/tests/csrf_tests/tests.py @@ -338,12 +338,12 @@ class CsrfViewMiddlewareTestMixin(CsrfFunctionTestMixin): If get_token() is not called, the view middleware does not add a cookie. """ - # This is important to make pages cacheable. Pages which do call + # This is important to make pages cacheable. Pages which do call # get_token(), assuming they use the token, are not cacheable because # the token is specific to the user req = self._get_request() # non_token_view_using_request_processor does not call get_token(), but - # does use the csrf request processor. By using this, we are testing + # does use the csrf request processor. By using this, we are testing # that the view processor is properly lazy and doesn't call get_token() # until needed. mw = CsrfViewMiddleware(non_token_view_using_request_processor) diff --git a/tests/file_uploads/tests.py b/tests/file_uploads/tests.py index c46f5a490b..b6b4bb0c69 100644 --- a/tests/file_uploads/tests.py +++ b/tests/file_uploads/tests.py @@ -740,7 +740,7 @@ class FileUploadTests(TestCase): # Maybe this is a little more complicated that it needs to be; but if # the django.test.client.FakePayload.read() implementation changes then - # this test would fail. So we need to know exactly what kind of error + # this test would fail. So we need to know exactly what kind of error # it raises when there is an attempt to read more than the available bytes: try: client.FakePayload(b"a").read(2) diff --git a/tests/fixtures_regress/tests.py b/tests/fixtures_regress/tests.py index 43b5b7f0b7..96d33e2df7 100644 --- a/tests/fixtures_regress/tests.py +++ b/tests/fixtures_regress/tests.py @@ -722,7 +722,7 @@ class NaturalKeyFixtureTests(TestCase): def test_dependency_sorting(self): """ - It doesn't matter what order you mention the models, Store *must* be + It doesn't matter what order you mention the models, Store *must* be serialized before then Person, and both must be serialized before Book. """ sorted_deps = serializers.sort_dependencies( @@ -897,7 +897,7 @@ class M2MNaturalKeyFixtureTests(TestCase): def test_dependency_sorting_m2m_complex(self): """ M2M relations with explicit through models should NOT count as - dependencies. The through model itself will have dependencies, though. + dependencies. The through model itself will have dependencies, though. """ sorted_deps = serializers.sort_dependencies( [("fixtures_regress", [M2MComplexA, M2MComplexB, M2MThroughAB])] diff --git a/tests/generic_relations_regress/tests.py b/tests/generic_relations_regress/tests.py index a3d54be1da..c670f44680 100644 --- a/tests/generic_relations_regress/tests.py +++ b/tests/generic_relations_regress/tests.py @@ -48,7 +48,7 @@ class GenericRelationTests(TestCase): def test_reverse_relation_pk(self): """ The correct column name is used for the primary key on the - originating model of a query. See #12664. + originating model of a query. See #12664. """ p = Person.objects.create(account=23, name="Chef") Address.objects.create( diff --git a/tests/generic_views/test_edit.py b/tests/generic_views/test_edit.py index 09d887ae92..d66b316090 100644 --- a/tests/generic_views/test_edit.py +++ b/tests/generic_views/test_edit.py @@ -177,7 +177,7 @@ class CreateViewTests(TestCase): def test_create_without_redirect(self): msg = ( - "No URL to redirect to. Either provide a url or define a " + "No URL to redirect to. Either provide a url or define a " "get_absolute_url method on the Model." ) with self.assertRaisesMessage(ImproperlyConfigured, msg): @@ -339,7 +339,7 @@ class UpdateViewTests(TestCase): def test_update_without_redirect(self): msg = ( - "No URL to redirect to. Either provide a url or define a " + "No URL to redirect to. Either provide a url or define a " "get_absolute_url method on the Model." ) with self.assertRaisesMessage(ImproperlyConfigured, msg): diff --git a/tests/gis_tests/distapp/tests.py b/tests/gis_tests/distapp/tests.py index 84b58b345b..2b51e999f7 100644 --- a/tests/gis_tests/distapp/tests.py +++ b/tests/gis_tests/distapp/tests.py @@ -158,7 +158,7 @@ class DistanceTest(TestCase): """ Test distance lookups on geodetic coordinate systems. """ - # Line is from Canberra to Sydney. Query is for all other cities within + # Line is from Canberra to Sydney. Query is for all other cities within # a 100km of that line (which should exclude only Hobart & Adelaide). line = GEOSGeometry("LINESTRING(144.9630 -37.8143,151.2607 -33.8870)", 4326) dist_qs = AustraliaCity.objects.filter(point__distance_lte=(line, D(km=100))) @@ -670,7 +670,7 @@ class DistanceFunctionsTests(FuncTestMixin, TestCase): # Having our buffer in the SRID of the transformation and of the field # -- should get the same results. The first buffer has no need for # transformation SQL because it is the same SRID as what was given - # to `transform()`. The second buffer will need to be transformed, + # to `transform()`. The second buffer will need to be transformed, # however. buf1 = z.poly.centroid.buffer(100) buf2 = buf1.transform(4269, clone=True) diff --git a/tests/gis_tests/gdal_tests/test_ds.py b/tests/gis_tests/gdal_tests/test_ds.py index 30c011f126..ca7295be00 100644 --- a/tests/gis_tests/gdal_tests/test_ds.py +++ b/tests/gis_tests/gdal_tests/test_ds.py @@ -235,7 +235,7 @@ class DataSourceTest(SimpleTestCase): # See ticket #9448. def get_layer(): # This DataSource object is not accessible outside this - # scope. However, a reference should still be kept alive + # scope. However, a reference should still be kept alive # on the `Layer` returned. ds = DataSource(source.ds) return ds[0] @@ -332,7 +332,7 @@ class DataSourceTest(SimpleTestCase): self.assertEqual(1, len(feats)) self.assertEqual("Houston", feats[0].get("Name")) - # Clearing the spatial filter by setting it to None. Now + # Clearing the spatial filter by setting it to None. Now # should indicate that there are 3 features in the Layer. lyr.spatial_filter = None self.assertEqual(3, len(lyr)) diff --git a/tests/gis_tests/geo3d/tests.py b/tests/gis_tests/geo3d/tests.py index 6a9376f2f8..e51fb7507b 100644 --- a/tests/gis_tests/geo3d/tests.py +++ b/tests/gis_tests/geo3d/tests.py @@ -48,7 +48,7 @@ city_data = ( city_dict = {name: coords for name, coords in city_data} # 3D freeway data derived from the National Elevation Dataset: -# http://seamless.usgs.gov/products/9arc.php +# http://seamless.usgs.gov/products/9arc.php interstate_data = ( ( "I-45", @@ -137,7 +137,7 @@ class Geo3DTest(Geo3DLoadingHelper, TestCase): """ Only a subset of the PostGIS routines are 3D-enabled, and this TestCase tries to test the features that can handle 3D and that are also - available within GeoDjango. For more information, see the PostGIS docs + available within GeoDjango. For more information, see the PostGIS docs on the routines that support 3D: https://postgis.net/docs/PostGIS_Special_Functions_Index.html#PostGIS_3D_Functions diff --git a/tests/gis_tests/geoapp/feeds.py b/tests/gis_tests/geoapp/feeds.py index 26ee4a8172..1e32766249 100644 --- a/tests/gis_tests/geoapp/feeds.py +++ b/tests/gis_tests/geoapp/feeds.py @@ -20,7 +20,7 @@ class TestGeoRSS1(feeds.Feed): class TestGeoRSS2(TestGeoRSS1): def geometry(self, obj): # This should attach a element for the extent of - # of the cities in the database. This tuple came from + # the cities in the database. This tuple came from # calling `City.objects.aggregate(Extent())` -- we can't do that call # here because `Extent` is not implemented for MySQL/Oracle. return (-123.30, -41.32, 174.78, 48.46) diff --git a/tests/gis_tests/geoapp/tests.py b/tests/gis_tests/geoapp/tests.py index 7eb61eb8ef..395043e832 100644 --- a/tests/gis_tests/geoapp/tests.py +++ b/tests/gis_tests/geoapp/tests.py @@ -133,7 +133,7 @@ class GeoModelTest(TestCase): tx = Country.objects.get(mpoly__intersects=other_srid_pnt) self.assertEqual("Texas", tx.name) - # Creating San Antonio. Remember the Alamo. + # Creating San Antonio. Remember the Alamo. sa = City.objects.create(name="San Antonio", point=other_srid_pnt) # Now verifying that San Antonio was transformed correctly diff --git a/tests/gis_tests/layermap/tests.py b/tests/gis_tests/layermap/tests.py index 6cc903f3ad..c5ed84d39c 100644 --- a/tests/gis_tests/layermap/tests.py +++ b/tests/gis_tests/layermap/tests.py @@ -208,7 +208,7 @@ class LayerMapTest(TestCase): ) # If a mapping is specified as a collection, all OGR fields that - # are not collections will be converted into them. For example, + # are not collections will be converted into them. For example, # a Point column would be converted to MultiPoint. Other things being done # w/the keyword args: # `transform=False`: Specifies that no transform is to be done; this @@ -217,7 +217,7 @@ class LayerMapTest(TestCase): # # `unique='name'`: Creates models on the condition that they have # unique county names; geometries from each feature however will be - # appended to the geometry collection of the unique model. Thus, + # appended to the geometry collection of the unique model. Thus, # all of the various islands in Honolulu county will be in one # database record with a MULTIPOLYGON type. lm = LayerMapping(County, co_shp, co_mapping, transform=False, unique="name") @@ -270,7 +270,7 @@ class LayerMapTest(TestCase): lm.save(fid_range=slice(None, 1), silent=True, strict=True) # layer[:1] # Only Pueblo & Honolulu counties should be present because of - # the `unique` keyword. Have to set `order_by` on this QuerySet + # the `unique` keyword. Have to set `order_by` on this QuerySet # or else MySQL will return a different ordering than the other dbs. qs = County.objects.order_by("name") self.assertEqual(2, qs.count()) @@ -290,7 +290,7 @@ class LayerMapTest(TestCase): self.county_helper(county_feat=False) def test_model_inheritance(self): - "Tests LayerMapping on inherited models. See #12093." + "Tests LayerMapping on inherited models. See #12093." icity_mapping = { "name": "Name", "population": "Population", @@ -310,7 +310,7 @@ class LayerMapTest(TestCase): self.assertEqual(3, ICity2.objects.count()) def test_invalid_layer(self): - "Tests LayerMapping on invalid geometries. See #15378." + "Tests LayerMapping on invalid geometries. See #15378." invalid_mapping = {"point": "POINT"} lm = LayerMapping(Invalid, invalid_shp, invalid_mapping, source_srs=4326) lm.save(silent=True) diff --git a/tests/gis_tests/relatedapp/tests.py b/tests/gis_tests/relatedapp/tests.py index 2db635b0c0..86d7488341 100644 --- a/tests/gis_tests/relatedapp/tests.py +++ b/tests/gis_tests/relatedapp/tests.py @@ -77,7 +77,7 @@ class RelatedGeoModelTest(TestCase): aggs = City.objects.aggregate(Union("location__point")) # These are the points that are components of the aggregate geographic - # union that is returned. Each point # corresponds to City PK. + # union that is returned. Each point # corresponds to City PK. p1 = Point(-104.528056, 33.387222) p2 = Point(-97.516111, 33.058333) p3 = Point(-79.460734, 40.18476) @@ -133,7 +133,7 @@ class RelatedGeoModelTest(TestCase): ) # Now creating a second Parcel where the borders are the same, just - # in different coordinate systems. The center points are also the + # in different coordinate systems. The center points are also the # same (but in different coordinate systems), and this time they # actually correspond to the centroid of the border. c1 = b1.centroid @@ -210,7 +210,7 @@ class RelatedGeoModelTest(TestCase): def test09_pk_relations(self): "Ensuring correct primary key column is selected across relations. See #10757." # The expected ID values -- notice the last two location IDs - # are out of order. Dallas and Houston have location IDs that differ + # are out of order. Dallas and Houston have location IDs that differ # from their PKs -- this is done to ensure that the related location # ID column is selected instead of ID column for the city. city_ids = (1, 2, 3, 4, 5) @@ -262,7 +262,7 @@ class RelatedGeoModelTest(TestCase): @skipUnlessDBFeature("allows_group_by_lob") def test13c_count(self): - "Testing `Count` aggregate with `.values()`. See #15305." + "Testing `Count` aggregate with `.values()`. See #15305." qs = ( Location.objects.filter(id=5) .annotate(num_cities=Count("city")) @@ -427,12 +427,12 @@ class RelatedGeoModelTest(TestCase): """ qs = Article.objects.select_related("author__article") # This triggers TypeError when `get_default_columns` has no `local_only` - # keyword. The TypeError is swallowed if QuerySet is actually + # keyword. The TypeError is swallowed if QuerySet is actually # evaluated as list generation swallows TypeError in CPython. str(qs.query) def test16_annotated_date_queryset(self): - "Ensure annotated date querysets work if spatial backend is used. See #14648." + "Ensure annotated date querysets work if spatial backend is used. See #14648." birth_years = [ dt.year for dt in list( diff --git a/tests/migrate_signals/tests.py b/tests/migrate_signals/tests.py index 71a93d3ad6..13e8908750 100644 --- a/tests/migrate_signals/tests.py +++ b/tests/migrate_signals/tests.py @@ -55,7 +55,7 @@ class OneTimeReceiver: # We connect receiver here and not in unit test code because we need to -# connect receiver before test runner creates database. That is, sequence of +# connect receiver before test runner creates database. That is, sequence of # actions would be: # # 1. Test runner imports this module. diff --git a/tests/migrations/test_commands.py b/tests/migrations/test_commands.py index f1373eca1e..cd49a5a8fc 100644 --- a/tests/migrations/test_commands.py +++ b/tests/migrations/test_commands.py @@ -445,7 +445,7 @@ class MigrateTests(MigrationTestBase): @override_settings(MIGRATION_MODULES={"migrations": "migrations.test_migrations"}) def test_showmigrations_list(self): """ - showmigrations --list displays migrations and whether or not they're + showmigrations --list displays migrations and whether or not they're applied. """ out = io.StringIO() diff --git a/tests/model_fields/test_imagefield.py b/tests/model_fields/test_imagefield.py index 7265da598b..4458055189 100644 --- a/tests/model_fields/test_imagefield.py +++ b/tests/model_fields/test_imagefield.py @@ -71,7 +71,7 @@ class ImageFieldTestMixin(SerializeMixin): (if defined) the image field is caching to. Note, this method will check for dimension fields named by adding - "_width" or "_height" to the name of the ImageField. So, the + "_width" or "_height" to the name of the ImageField. So, the models used in these tests must have their fields named accordingly. @@ -294,7 +294,7 @@ class ImageFieldTwoDimensionsTests(ImageFieldTestMixin, TestCase): # Test dimensions after fetching from database. p = self.PersonModel.objects.get(name="Joe") # Bug 11084: Dimensions should not get recalculated if file is - # coming from the database. We test this by checking if the file + # coming from the database. We test this by checking if the file # was opened. self.assertIs(p.mugshot.was_opened, False) self.check_dimensions(p, 4, 8) @@ -442,7 +442,7 @@ class TwoImageFieldTests(ImageFieldTestMixin, TestCase): # Test dimensions after fetching from database. p = self.PersonModel.objects.get(name="Joe") # Bug 11084: Dimensions should not get recalculated if file is - # coming from the database. We test this by checking if the file + # coming from the database. We test this by checking if the file # was opened. self.assertIs(p.mugshot.was_opened, False) self.assertIs(p.headshot.was_opened, False) diff --git a/tests/model_forms/tests.py b/tests/model_forms/tests.py index 57249820ed..e96a897f4a 100644 --- a/tests/model_forms/tests.py +++ b/tests/model_forms/tests.py @@ -600,7 +600,7 @@ class ModelFormBaseTest(TestCase): def test_mixmodel_form(self): class MixModelForm(BaseCategoryForm): """Don't allow more than one 'model' definition in the - inheritance hierarchy. Technically, it would generate a valid + inheritance hierarchy. Technically, it would generate a valid form, but the fact that the resulting save method won't deal with multiple objects is likely to trip up people not familiar with the mechanics. diff --git a/tests/model_formsets/tests.py b/tests/model_formsets/tests.py index e5c026cee6..b3b8cdbc69 100644 --- a/tests/model_formsets/tests.py +++ b/tests/model_formsets/tests.py @@ -763,7 +763,7 @@ class ModelFormsetTest(TestCase): def test_inline_formsets_save_as_new(self): # The save_as_new parameter lets you re-associate the data to a new - # instance. This is used in the admin for save_as functionality. + # instance. This is used in the admin for save_as functionality. AuthorBooksFormSet = inlineformset_factory( Author, Book, can_delete=False, extra=2, fields="__all__" ) diff --git a/tests/modeladmin/tests.py b/tests/modeladmin/tests.py index 3d2e8d00fb..ecead78154 100644 --- a/tests/modeladmin/tests.py +++ b/tests/modeladmin/tests.py @@ -731,9 +731,9 @@ class ModelAdminTests(TestCase): ) def test_foreign_key_as_radio_field(self): - # Now specify all the fields as radio_fields. Widgets should now be + # Now specify all the fields as radio_fields. Widgets should now be # RadioSelect, and the choices list should have a first entry of 'None' if - # blank=True for the model field. Finally, the widget should have the + # blank=True for the model field. Finally, the widget should have the # 'radiolist' attr, and 'inline' as well if the field is specified HORIZONTAL. class ConcertAdmin(ModelAdmin): radio_fields = { diff --git a/tests/pagination/tests.py b/tests/pagination/tests.py index 3e86b88a81..0fa2099f08 100644 --- a/tests/pagination/tests.py +++ b/tests/pagination/tests.py @@ -55,7 +55,7 @@ class PaginationTests(SimpleTestCase): self.assertEqual( expected, got, - "For '%s', expected %s but got %s. Paginator parameters were: %s" + "For '%s', expected %s but got %s. Paginator parameters were: %s" % (name, expected, got, params), ) @@ -65,7 +65,7 @@ class PaginationTests(SimpleTestCase): self.assertEqual( expected, await got(), - "For '%s', expected %s but got %s. Paginator parameters were: %s" + "For '%s', expected %s but got %s. Paginator parameters were: %s" % (name, expected, got, params), ) diff --git a/tests/proxy_model_inheritance/tests.py b/tests/proxy_model_inheritance/tests.py index 5e2d1f2d8e..fc1826e9e9 100644 --- a/tests/proxy_model_inheritance/tests.py +++ b/tests/proxy_model_inheritance/tests.py @@ -15,7 +15,7 @@ from .models import ( class ProxyModelInheritanceTests(TransactionTestCase): """ Proxy model inheritance across apps can result in migrate not creating the table - for the proxied model (as described in #12286). This test creates two dummy + for the proxied model (as described in #12286). This test creates two dummy apps and calls migrate, then verifies that the table has been created. """ diff --git a/tests/serializers/test_yaml.py b/tests/serializers/test_yaml.py index 6db6f046fd..593ac9619e 100644 --- a/tests/serializers/test_yaml.py +++ b/tests/serializers/test_yaml.py @@ -25,7 +25,7 @@ class YamlImportModuleMock: In order to run tests that verify the behavior of the YAML serializer when run on a system that has yaml installed (like the django CI server), mock import_module, so that it raises an ImportError when the yaml - serializer is being imported. The importlib.import_module() call is + serializer is being imported. The importlib.import_module() call is being made in the serializers.register_serializer(). Refs: #12756 diff --git a/tests/settings_tests/tests.py b/tests/settings_tests/tests.py index 4fc35689d6..c1fe2d042d 100644 --- a/tests/settings_tests/tests.py +++ b/tests/settings_tests/tests.py @@ -105,7 +105,7 @@ class FullyDecoratedTestCase(TestCase): class ClassDecoratedTestCaseSuper(TestCase): """ Dummy class for testing max recursion error in child class call to - super(). Refs #17011. + super(). Refs #17011. """ def test_max_recursion_error(self): diff --git a/tests/template_tests/syntax_tests/i18n/test_blocktranslate.py b/tests/template_tests/syntax_tests/i18n/test_blocktranslate.py index 4c9036ba76..1425406960 100644 --- a/tests/template_tests/syntax_tests/i18n/test_blocktranslate.py +++ b/tests/template_tests/syntax_tests/i18n/test_blocktranslate.py @@ -575,7 +575,7 @@ class TranslationBlockTranslateTagTests(SimpleTestCase): rendered = t.render(Context()) self.assertEqual(rendered, "May") - # Existing context... using a literal + # Existing context... using a literal t = self.get_template( "{% load i18n %}" '{% blocktranslate context "month name" %}May{% endblocktranslate %}' diff --git a/tests/template_tests/test_callables.py b/tests/template_tests/test_callables.py index bd53de5ca5..d2f062e60d 100644 --- a/tests/template_tests/test_callables.py +++ b/tests/template_tests/test_callables.py @@ -142,7 +142,7 @@ class CallableVariablesTests(TestCase): c = Context({"my_doodad": my_doodad}) # Since ``my_doodad.do_not_call_in_templates`` is True, the template - # system will not try to call our doodad. We can access its attributes + # system will not try to call our doodad. We can access its attributes # as normal, and we don't have access to the dict that it returns when # called. t = self.engine.from_string("{{ my_doodad.value }}") diff --git a/tests/test_client_regress/tests.py b/tests/test_client_regress/tests.py index a480a2069b..325ad17cdb 100644 --- a/tests/test_client_regress/tests.py +++ b/tests/test_client_regress/tests.py @@ -822,7 +822,7 @@ class TemplateExceptionTests(SimpleTestCase): self.client.get("/no_such_view/") -# We need two different tests to check URLconf substitution - one to check +# We need two different tests to check URLconf substitution - one to check # it was changed, and another one (without self.urls) to check it was reverted on # teardown. This pair of tests relies upon the alphabetical ordering of test execution. @override_settings(ROOT_URLCONF="test_client_regress.urls") diff --git a/tests/test_sqlite.py b/tests/test_sqlite.py index f3ccf2c021..1cdc6976b3 100644 --- a/tests/test_sqlite.py +++ b/tests/test_sqlite.py @@ -9,7 +9,7 @@ # # The different databases that Django supports behave differently in certain # situations, so it is recommended to run the test suite against as many -# database backends as possible. You may want to create a separate settings +# database backends as possible. You may want to create a separate settings # file for each of the backends you test against. DATABASES = { diff --git a/tests/unmanaged_models/models.py b/tests/unmanaged_models/models.py index 0eefcafda2..74844ae334 100644 --- a/tests/unmanaged_models/models.py +++ b/tests/unmanaged_models/models.py @@ -5,7 +5,7 @@ is generated for the table on various manage.py operations. from django.db import models -# All of these models are created in the database by Django. +# All of these models are created in the database by Django. class A01(models.Model): diff --git a/tests/urlpatterns_reverse/tests.py b/tests/urlpatterns_reverse/tests.py index 59a48c9987..c396e24934 100644 --- a/tests/urlpatterns_reverse/tests.py +++ b/tests/urlpatterns_reverse/tests.py @@ -708,7 +708,7 @@ class ResolverTests(SimpleTestCase): self.assertEqual( len(e.args[0]["tried"]), len(url_types_names), - "Wrong number of tried URLs returned. Expected %s, got %s." + "Wrong number of tried URLs returned. Expected %s, got %s." % (len(url_types_names), len(e.args[0]["tried"])), ) for tried, expected in zip(e.args[0]["tried"], url_types_names): @@ -726,7 +726,7 @@ class ResolverTests(SimpleTestCase): self.assertEqual( t.name, e["name"], - 'Wrong URL name. Expected "%s", got "%s".' + 'Wrong URL name. Expected "%s", got "%s".' % (e["name"], t.name), )