浏览代码

Applied Black's 2024 stable style.

https://github.com/psf/black/releases/tag/24.1.0
Mariusz Felisiak 1 年之前
父节点
当前提交
305757aec1
共有 100 个文件被更改,包括 286 次插入160 次删除
  1. 2 2
      .pre-commit-config.yaml
  2. 1 0
      django/__main__.py
  3. 1 0
      django/contrib/admin/filters.py
  4. 8 6
      django/contrib/admin/options.py
  5. 8 6
      django/contrib/admin/templatetags/admin_list.py
  6. 1 0
      django/contrib/admin/widgets.py
  7. 1 0
      django/contrib/auth/base_user.py
  8. 1 0
      django/contrib/auth/management/__init__.py
  9. 14 9
      django/contrib/auth/management/commands/createsuperuser.py
  10. 1 0
      django/contrib/gis/db/backends/oracle/models.py
  11. 1 0
      django/contrib/gis/db/backends/oracle/operations.py
  12. 1 0
      django/contrib/gis/db/backends/postgis/adapter.py
  13. 1 0
      django/contrib/gis/db/backends/postgis/const.py
  14. 1 0
      django/contrib/gis/db/backends/postgis/models.py
  15. 1 0
      django/contrib/gis/db/backends/spatialite/models.py
  16. 1 0
      django/contrib/gis/db/backends/spatialite/operations.py
  17. 8 6
      django/contrib/gis/db/models/functions.py
  18. 1 0
      django/contrib/gis/db/models/proxy.py
  19. 1 0
      django/contrib/gis/db/models/sql/conversion.py
  20. 1 0
      django/contrib/gis/gdal/__init__.py
  21. 1 0
      django/contrib/gis/gdal/datasource.py
  22. 1 0
      django/contrib/gis/gdal/envelope.py
  23. 1 0
      django/contrib/gis/gdal/geometries.py
  24. 1 0
      django/contrib/gis/gdal/prototypes/ds.py
  25. 1 0
      django/contrib/gis/gdal/prototypes/errcheck.py
  26. 1 0
      django/contrib/gis/gdal/prototypes/generation.py
  27. 1 0
      django/contrib/gis/gdal/prototypes/raster.py
  28. 1 0
      django/contrib/gis/gdal/raster/const.py
  29. 1 0
      django/contrib/gis/gdal/srs.py
  30. 1 0
      django/contrib/gis/geos/__init__.py
  31. 1 0
      django/contrib/gis/geos/collections.py
  32. 1 0
      django/contrib/gis/geos/coordseq.py
  33. 1 0
      django/contrib/gis/geos/geometry.py
  34. 1 0
      django/contrib/gis/geos/io.py
  35. 1 0
      django/contrib/gis/geos/libgeos.py
  36. 1 0
      django/contrib/gis/geos/prototypes/errcheck.py
  37. 1 0
      django/contrib/gis/geos/prototypes/misc.py
  38. 1 0
      django/contrib/gis/geos/prototypes/predicates.py
  39. 1 0
      django/contrib/gis/geos/prototypes/topology.py
  40. 1 0
      django/contrib/gis/utils/__init__.py
  41. 1 0
      django/contrib/gis/utils/ogrinspect.py
  42. 5 3
      django/contrib/postgres/search.py
  43. 1 0
      django/contrib/sessions/base_session.py
  44. 1 0
      django/contrib/staticfiles/views.py
  45. 1 0
      django/core/cache/__init__.py
  46. 1 0
      django/core/exceptions.py
  47. 1 0
      django/core/files/images.py
  48. 1 0
      django/core/files/locks.py
  49. 1 0
      django/core/files/uploadhandler.py
  50. 1 0
      django/core/mail/__init__.py
  51. 1 0
      django/core/mail/backends/console.py
  52. 1 0
      django/core/mail/backends/locmem.py
  53. 1 0
      django/core/mail/backends/smtp.py
  54. 15 8
      django/core/management/base.py
  55. 1 0
      django/core/serializers/base.py
  56. 1 0
      django/core/serializers/xml_serializer.py
  57. 9 7
      django/db/backends/base/schema.py
  58. 1 0
      django/db/backends/ddl_references.py
  59. 1 0
      django/db/backends/mysql/base.py
  60. 1 0
      django/db/backends/oracle/base.py
  61. 9 9
      django/db/backends/oracle/creation.py
  62. 5 3
      django/db/backends/postgresql/base.py
  63. 3 3
      django/db/backends/postgresql/schema.py
  64. 1 0
      django/db/backends/sqlite3/_functions.py
  65. 1 0
      django/db/backends/sqlite3/base.py
  66. 9 8
      django/db/migrations/autodetector.py
  67. 5 5
      django/db/migrations/loader.py
  68. 5 5
      django/db/migrations/operations/models.py
  69. 5 5
      django/db/migrations/state.py
  70. 1 0
      django/db/models/aggregates.py
  71. 5 3
      django/db/models/base.py
  72. 1 0
      django/db/models/constants.py
  73. 21 21
      django/db/models/expressions.py
  74. 1 0
      django/db/models/fields/related_descriptors.py
  75. 1 0
      django/db/models/fields/reverse_related.py
  76. 1 0
      django/db/models/functions/comparison.py
  77. 10 6
      django/db/models/functions/datetime.py
  78. 5 3
      django/db/models/functions/math.py
  79. 5 3
      django/db/models/functions/mixins.py
  80. 5 3
      django/db/models/functions/text.py
  81. 5 3
      django/db/models/indexes.py
  82. 5 3
      django/db/models/lookups.py
  83. 11 9
      django/db/models/query.py
  84. 1 0
      django/db/models/query_utils.py
  85. 3 3
      django/db/models/sql/compiler.py
  86. 1 0
      django/db/models/sql/datastructures.py
  87. 1 0
      django/db/models/sql/query.py
  88. 1 0
      django/db/models/sql/where.py
  89. 7 3
      django/forms/models.py
  90. 13 9
      django/forms/widgets.py
  91. 1 0
      django/http/multipartparser.py
  92. 5 3
      django/http/request.py
  93. 1 0
      django/middleware/csrf.py
  94. 1 0
      django/shortcuts.py
  95. 1 0
      django/template/defaultfilters.py
  96. 1 0
      django/template/defaulttags.py
  97. 5 3
      django/template/engine.py
  98. 1 0
      django/template/smartif.py
  99. 1 0
      django/test/html.py
  100. 1 0
      django/urls/conf.py

+ 2 - 2
.pre-commit-config.yaml

@@ -1,6 +1,6 @@
 repos:
 repos:
   - repo: https://github.com/psf/black-pre-commit-mirror
   - repo: https://github.com/psf/black-pre-commit-mirror
-    rev: 23.12.1
+    rev: 24.1.0
     hooks:
     hooks:
     - id: black
     - id: black
       exclude: \.py-tpl$
       exclude: \.py-tpl$
@@ -9,7 +9,7 @@ repos:
     hooks:
     hooks:
       - id: blacken-docs
       - id: blacken-docs
         additional_dependencies:
         additional_dependencies:
-        - black==23.12.1
+        - black==24.1.0
         files: 'docs/.*\.txt$'
         files: 'docs/.*\.txt$'
   - repo: https://github.com/PyCQA/isort
   - repo: https://github.com/PyCQA/isort
     rev: 5.13.2
     rev: 5.13.2

+ 1 - 0
django/__main__.py

@@ -3,6 +3,7 @@ Invokes django-admin when the django module is run as a script.
 
 
 Example: python -m django check
 Example: python -m django check
 """
 """
+
 from django.core import management
 from django.core import management
 
 
 if __name__ == "__main__":
 if __name__ == "__main__":

+ 1 - 0
django/contrib/admin/filters.py

@@ -5,6 +5,7 @@ Filters are specified in models with the "list_filter" option.
 Each filter subclass knows how to display a filter for a field that passes a
 Each filter subclass knows how to display a filter for a field that passes a
 certain test -- e.g. being a DateField or ForeignKey.
 certain test -- e.g. being a DateField or ForeignKey.
 """
 """
+
 import datetime
 import datetime
 
 
 from django.contrib.admin.exceptions import NotRegistered
 from django.contrib.admin.exceptions import NotRegistered

+ 8 - 6
django/contrib/admin/options.py

@@ -1759,9 +1759,9 @@ class ModelAdmin(BaseModelAdmin):
                 has_delete_permission = inline.has_delete_permission(request, obj)
                 has_delete_permission = inline.has_delete_permission(request, obj)
             else:
             else:
                 # Disable all edit-permissions, and override formset settings.
                 # Disable all edit-permissions, and override formset settings.
-                has_add_permission = (
-                    has_change_permission
-                ) = has_delete_permission = False
+                has_add_permission = has_change_permission = has_delete_permission = (
+                    False
+                )
                 formset.extra = formset.max_num = 0
                 formset.extra = formset.max_num = 0
             has_view_permission = inline.has_view_permission(request, obj)
             has_view_permission = inline.has_view_permission(request, obj)
             prepopulated = dict(inline.get_prepopulated_fields(request, obj))
             prepopulated = dict(inline.get_prepopulated_fields(request, obj))
@@ -1896,9 +1896,11 @@ class ModelAdmin(BaseModelAdmin):
             form,
             form,
             list(fieldsets),
             list(fieldsets),
             # Clear prepopulated fields on a view-only form to avoid a crash.
             # Clear prepopulated fields on a view-only form to avoid a crash.
-            self.get_prepopulated_fields(request, obj)
-            if add or self.has_change_permission(request, obj)
-            else {},
+            (
+                self.get_prepopulated_fields(request, obj)
+                if add or self.has_change_permission(request, obj)
+                else {}
+            ),
             readonly_fields,
             readonly_fields,
             model_admin=self,
             model_admin=self,
         )
         )

+ 8 - 6
django/contrib/admin/templatetags/admin_list.py

@@ -171,9 +171,9 @@ def result_headers(cl):
             "url_primary": cl.get_query_string({ORDER_VAR: ".".join(o_list_primary)}),
             "url_primary": cl.get_query_string({ORDER_VAR: ".".join(o_list_primary)}),
             "url_remove": cl.get_query_string({ORDER_VAR: ".".join(o_list_remove)}),
             "url_remove": cl.get_query_string({ORDER_VAR: ".".join(o_list_remove)}),
             "url_toggle": cl.get_query_string({ORDER_VAR: ".".join(o_list_toggle)}),
             "url_toggle": cl.get_query_string({ORDER_VAR: ".".join(o_list_toggle)}),
-            "class_attrib": format_html(' class="{}"', " ".join(th_classes))
-            if th_classes
-            else "",
+            "class_attrib": (
+                format_html(' class="{}"', " ".join(th_classes)) if th_classes else ""
+            ),
         }
         }
 
 
 
 
@@ -270,9 +270,11 @@ def items_for_result(cl, result, form):
                 link_or_text = format_html(
                 link_or_text = format_html(
                     '<a href="{}"{}>{}</a>',
                     '<a href="{}"{}>{}</a>',
                     url,
                     url,
-                    format_html(' data-popup-opener="{}"', value)
-                    if cl.is_popup
-                    else "",
+                    (
+                        format_html(' data-popup-opener="{}"', value)
+                        if cl.is_popup
+                        else ""
+                    ),
                     result_repr,
                     result_repr,
                 )
                 )
 
 

+ 1 - 0
django/contrib/admin/widgets.py

@@ -1,6 +1,7 @@
 """
 """
 Form Widget classes specific to the Django admin site.
 Form Widget classes specific to the Django admin site.
 """
 """
+
 import copy
 import copy
 import json
 import json
 
 

+ 1 - 0
django/contrib/auth/base_user.py

@@ -2,6 +2,7 @@
 This module allows importing AbstractBaseUser even when django.contrib.auth is
 This module allows importing AbstractBaseUser even when django.contrib.auth is
 not in INSTALLED_APPS.
 not in INSTALLED_APPS.
 """
 """
+
 import unicodedata
 import unicodedata
 
 
 from django.conf import settings
 from django.conf import settings

+ 1 - 0
django/contrib/auth/management/__init__.py

@@ -1,6 +1,7 @@
 """
 """
 Creates permissions for all installed apps that need permissions.
 Creates permissions for all installed apps that need permissions.
 """
 """
+
 import getpass
 import getpass
 import unicodedata
 import unicodedata
 
 

+ 14 - 9
django/contrib/auth/management/commands/createsuperuser.py

@@ -1,6 +1,7 @@
 """
 """
 Management utility to create superusers.
 Management utility to create superusers.
 """
 """
+
 import getpass
 import getpass
 import os
 import os
 import sys
 import sys
@@ -271,15 +272,19 @@ class Command(BaseCommand):
         return "%s%s%s: " % (
         return "%s%s%s: " % (
             capfirst(field.verbose_name),
             capfirst(field.verbose_name),
             " (leave blank to use '%s')" % default if default else "",
             " (leave blank to use '%s')" % default if default else "",
-            " (%s.%s)"
-            % (
-                field.remote_field.model._meta.object_name,
-                field.m2m_target_field_name()
-                if field.many_to_many
-                else field.remote_field.field_name,
-            )
-            if field.remote_field
-            else "",
+            (
+                " (%s.%s)"
+                % (
+                    field.remote_field.model._meta.object_name,
+                    (
+                        field.m2m_target_field_name()
+                        if field.many_to_many
+                        else field.remote_field.field_name
+                    ),
+                )
+                if field.remote_field
+                else ""
+            ),
         )
         )
 
 
     @cached_property
     @cached_property

+ 1 - 0
django/contrib/gis/db/backends/oracle/models.py

@@ -7,6 +7,7 @@
  For example, the `USER_SDO_GEOM_METADATA` is used for the GeometryColumns
  For example, the `USER_SDO_GEOM_METADATA` is used for the GeometryColumns
  model and the `SDO_COORD_REF_SYS` is used for the SpatialRefSys model.
  model and the `SDO_COORD_REF_SYS` is used for the SpatialRefSys model.
 """
 """
+
 from django.contrib.gis.db import models
 from django.contrib.gis.db import models
 from django.contrib.gis.db.backends.base.models import SpatialRefSysMixin
 from django.contrib.gis.db.backends.base.models import SpatialRefSysMixin
 
 

+ 1 - 0
django/contrib/gis/db/backends/oracle/operations.py

@@ -7,6 +7,7 @@
  support for an internal JVM, and Java libraries are required to use
  support for an internal JVM, and Java libraries are required to use
  the WKT constructors.
  the WKT constructors.
 """
 """
+
 import re
 import re
 
 
 from django.contrib.gis.db import models
 from django.contrib.gis.db import models

+ 1 - 0
django/contrib/gis/db/backends/postgis/adapter.py

@@ -1,6 +1,7 @@
 """
 """
  This object provides quoting for GEOS geometries into PostgreSQL/PostGIS.
  This object provides quoting for GEOS geometries into PostgreSQL/PostGIS.
 """
 """
+
 from django.contrib.gis.db.backends.postgis.pgraster import to_pgraster
 from django.contrib.gis.db.backends.postgis.pgraster import to_pgraster
 from django.contrib.gis.geos import GEOSGeometry
 from django.contrib.gis.geos import GEOSGeometry
 from django.db.backends.postgresql.psycopg_any import sql
 from django.db.backends.postgresql.psycopg_any import sql

+ 1 - 0
django/contrib/gis/db/backends/postgis/const.py

@@ -1,6 +1,7 @@
 """
 """
 PostGIS to GDAL conversion constant definitions
 PostGIS to GDAL conversion constant definitions
 """
 """
+
 # Lookup to convert pixel type values from GDAL to PostGIS
 # Lookup to convert pixel type values from GDAL to PostGIS
 GDAL_TO_POSTGIS = [None, 4, 6, 5, 8, 7, 10, 11, None, None, None, None]
 GDAL_TO_POSTGIS = [None, 4, 6, 5, 8, 7, 10, 11, None, None, None, None]
 
 

+ 1 - 0
django/contrib/gis/db/backends/postgis/models.py

@@ -1,6 +1,7 @@
 """
 """
  The GeometryColumns and SpatialRefSys models for the PostGIS backend.
  The GeometryColumns and SpatialRefSys models for the PostGIS backend.
 """
 """
+
 from django.contrib.gis.db.backends.base.models import SpatialRefSysMixin
 from django.contrib.gis.db.backends.base.models import SpatialRefSysMixin
 from django.db import models
 from django.db import models
 
 

+ 1 - 0
django/contrib/gis/db/backends/spatialite/models.py

@@ -1,6 +1,7 @@
 """
 """
  The GeometryColumns and SpatialRefSys models for the SpatiaLite backend.
  The GeometryColumns and SpatialRefSys models for the SpatiaLite backend.
 """
 """
+
 from django.contrib.gis.db.backends.base.models import SpatialRefSysMixin
 from django.contrib.gis.db.backends.base.models import SpatialRefSysMixin
 from django.db import models
 from django.db import models
 
 

+ 1 - 0
django/contrib/gis/db/backends/spatialite/operations.py

@@ -2,6 +2,7 @@
 SQL functions reference lists:
 SQL functions reference lists:
 https://www.gaia-gis.it/gaia-sins/spatialite-sql-4.3.0.html
 https://www.gaia-gis.it/gaia-sins/spatialite-sql-4.3.0.html
 """
 """
+
 from django.contrib.gis.db import models
 from django.contrib.gis.db import models
 from django.contrib.gis.db.backends.base.operations import BaseSpatialOperations
 from django.contrib.gis.db.backends.base.operations import BaseSpatialOperations
 from django.contrib.gis.db.backends.spatialite.adapter import SpatiaLiteAdapter
 from django.contrib.gis.db.backends.spatialite.adapter import SpatiaLiteAdapter

+ 8 - 6
django/contrib/gis/db/models/functions.py

@@ -127,9 +127,11 @@ class SQLiteDecimalToFloatMixin:
         copy = self.copy()
         copy = self.copy()
         copy.set_source_expressions(
         copy.set_source_expressions(
             [
             [
-                Value(float(expr.value))
-                if hasattr(expr, "value") and isinstance(expr.value, Decimal)
-                else expr
+                (
+                    Value(float(expr.value))
+                    if hasattr(expr, "value") and isinstance(expr.value, Decimal)
+                    else expr
+                )
                 for expr in copy.get_source_expressions()
                 for expr in copy.get_source_expressions()
             ]
             ]
         )
         )
@@ -349,9 +351,9 @@ class Distance(DistanceResultMixin, OracleToleranceMixin, GeoFunc):
     def as_sqlite(self, compiler, connection, **extra_context):
     def as_sqlite(self, compiler, connection, **extra_context):
         if self.geo_field.geodetic(connection):
         if self.geo_field.geodetic(connection):
             # SpatiaLite returns NULL instead of zero on geodetic coordinates
             # SpatiaLite returns NULL instead of zero on geodetic coordinates
-            extra_context[
-                "template"
-            ] = "COALESCE(%(function)s(%(expressions)s, %(spheroid)s), 0)"
+            extra_context["template"] = (
+                "COALESCE(%(function)s(%(expressions)s, %(spheroid)s), 0)"
+            )
             extra_context["spheroid"] = int(bool(self.spheroid))
             extra_context["spheroid"] = int(bool(self.spheroid))
         return super().as_sql(compiler, connection, **extra_context)
         return super().as_sql(compiler, connection, **extra_context)
 
 

+ 1 - 0
django/contrib/gis/db/models/proxy.py

@@ -5,6 +5,7 @@ objects corresponding to geographic model fields.
 
 
 Thanks to Robert Coup for providing this functionality (see #4322).
 Thanks to Robert Coup for providing this functionality (see #4322).
 """
 """
+
 from django.db.models.query_utils import DeferredAttribute
 from django.db.models.query_utils import DeferredAttribute
 
 
 
 

+ 1 - 0
django/contrib/gis/db/models/sql/conversion.py

@@ -2,6 +2,7 @@
 This module holds simple classes to convert geospatial values from the
 This module holds simple classes to convert geospatial values from the
 database.
 database.
 """
 """
+
 from decimal import Decimal
 from decimal import Decimal
 
 
 from django.contrib.gis.measure import Area, Distance
 from django.contrib.gis.measure import Area, Distance

+ 1 - 0
django/contrib/gis/gdal/__init__.py

@@ -25,6 +25,7 @@
  by setting `GDAL_LIBRARY_PATH` in your settings with the path to the GDAL C
  by setting `GDAL_LIBRARY_PATH` in your settings with the path to the GDAL C
  library on your system.
  library on your system.
 """
 """
+
 from django.contrib.gis.gdal.datasource import DataSource
 from django.contrib.gis.gdal.datasource import DataSource
 from django.contrib.gis.gdal.driver import Driver
 from django.contrib.gis.gdal.driver import Driver
 from django.contrib.gis.gdal.envelope import Envelope
 from django.contrib.gis.gdal.envelope import Envelope

+ 1 - 0
django/contrib/gis/gdal/datasource.py

@@ -33,6 +33,7 @@
               #  OFTReal returns floats, all else returns string.
               #  OFTReal returns floats, all else returns string.
               val = field.value
               val = field.value
 """
 """
+
 from pathlib import Path
 from pathlib import Path
 
 
 from django.contrib.gis.gdal.base import GDALBase
 from django.contrib.gis.gdal.base import GDALBase

+ 1 - 0
django/contrib/gis/gdal/envelope.py

@@ -10,6 +10,7 @@
                            |          |
                            |          |
  Lower left (min_x, min_y) o----------+
  Lower left (min_x, min_y) o----------+
 """
 """
+
 from ctypes import Structure, c_double
 from ctypes import Structure, c_double
 
 
 from django.contrib.gis.gdal.error import GDALException
 from django.contrib.gis.gdal.error import GDALException

+ 1 - 0
django/contrib/gis/gdal/geometries.py

@@ -38,6 +38,7 @@
   >>> print(gt1 == 3, gt1 == 'Polygon') # Equivalence works w/non-OGRGeomType objects
   >>> print(gt1 == 3, gt1 == 'Polygon') # Equivalence works w/non-OGRGeomType objects
   True True
   True True
 """
 """
+
 import sys
 import sys
 import warnings
 import warnings
 from binascii import b2a_hex
 from binascii import b2a_hex

+ 1 - 0
django/contrib/gis/gdal/prototypes/ds.py

@@ -3,6 +3,7 @@
  related data structures. OGR_Dr_*, OGR_DS_*, OGR_L_*, OGR_F_*,
  related data structures. OGR_Dr_*, OGR_DS_*, OGR_L_*, OGR_F_*,
  OGR_Fld_* routines are relevant here.
  OGR_Fld_* routines are relevant here.
 """
 """
+
 from ctypes import POINTER, c_char_p, c_double, c_int, c_long, c_uint, c_void_p
 from ctypes import POINTER, c_char_p, c_double, c_int, c_long, c_uint, c_void_p
 
 
 from django.contrib.gis.gdal.envelope import OGREnvelope
 from django.contrib.gis.gdal.envelope import OGREnvelope

+ 1 - 0
django/contrib/gis/gdal/prototypes/errcheck.py

@@ -2,6 +2,7 @@
  This module houses the error-checking routines used by the GDAL
  This module houses the error-checking routines used by the GDAL
  ctypes prototypes.
  ctypes prototypes.
 """
 """
+
 from ctypes import c_void_p, string_at
 from ctypes import c_void_p, string_at
 
 
 from django.contrib.gis.gdal.error import GDALException, SRSException, check_err
 from django.contrib.gis.gdal.error import GDALException, SRSException, check_err

+ 1 - 0
django/contrib/gis/gdal/prototypes/generation.py

@@ -2,6 +2,7 @@
  This module contains functions that generate ctypes prototypes for the
  This module contains functions that generate ctypes prototypes for the
  GDAL routines.
  GDAL routines.
 """
 """
+
 from ctypes import POINTER, c_bool, c_char_p, c_double, c_int, c_int64, c_void_p
 from ctypes import POINTER, c_bool, c_char_p, c_double, c_int, c_int64, c_void_p
 from functools import partial
 from functools import partial
 
 

+ 1 - 0
django/contrib/gis/gdal/prototypes/raster.py

@@ -2,6 +2,7 @@
 This module houses the ctypes function prototypes for GDAL DataSource (raster)
 This module houses the ctypes function prototypes for GDAL DataSource (raster)
 related data structures.
 related data structures.
 """
 """
+
 from ctypes import POINTER, c_bool, c_char_p, c_double, c_int, c_void_p
 from ctypes import POINTER, c_bool, c_char_p, c_double, c_int, c_void_p
 from functools import partial
 from functools import partial
 
 

+ 1 - 0
django/contrib/gis/gdal/raster/const.py

@@ -1,6 +1,7 @@
 """
 """
 GDAL - Constant definitions
 GDAL - Constant definitions
 """
 """
+
 from ctypes import (
 from ctypes import (
     c_double,
     c_double,
     c_float,
     c_float,

+ 1 - 0
django/contrib/gis/gdal/srs.py

@@ -26,6 +26,7 @@
   >>> print(srs.name)
   >>> print(srs.name)
   NAD83 / Texas South Central
   NAD83 / Texas South Central
 """
 """
+
 from ctypes import byref, c_char_p, c_int
 from ctypes import byref, c_char_p, c_int
 from enum import IntEnum
 from enum import IntEnum
 from types import NoneType
 from types import NoneType

+ 1 - 0
django/contrib/gis/geos/__init__.py

@@ -2,6 +2,7 @@
 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/
 for more details: https://docs.djangoproject.com/en/dev/ref/contrib/gis/geos/
 """
 """
+
 from .collections import (  # NOQA
 from .collections import (  # NOQA
     GeometryCollection,
     GeometryCollection,
     MultiLineString,
     MultiLineString,

+ 1 - 0
django/contrib/gis/geos/collections.py

@@ -2,6 +2,7 @@
  This module houses the Geometry Collection objects:
  This module houses the Geometry Collection objects:
  GeometryCollection, MultiPoint, MultiLineString, and MultiPolygon
  GeometryCollection, MultiPoint, MultiLineString, and MultiPolygon
 """
 """
+
 from django.contrib.gis.geos import prototypes as capi
 from django.contrib.gis.geos import prototypes as capi
 from django.contrib.gis.geos.geometry import GEOSGeometry, LinearGeometryMixin
 from django.contrib.gis.geos.geometry import GEOSGeometry, LinearGeometryMixin
 from django.contrib.gis.geos.libgeos import GEOM_PTR
 from django.contrib.gis.geos.libgeos import GEOM_PTR

+ 1 - 0
django/contrib/gis/geos/coordseq.py

@@ -3,6 +3,7 @@
  by GEOSGeometry to house the actual coordinates of the Point,
  by GEOSGeometry to house the actual coordinates of the Point,
  LineString, and LinearRing geometries.
  LineString, and LinearRing geometries.
 """
 """
+
 from ctypes import byref, c_byte, c_double, c_uint
 from ctypes import byref, c_byte, c_double, c_uint
 
 
 from django.contrib.gis.geos import prototypes as capi
 from django.contrib.gis.geos import prototypes as capi

+ 1 - 0
django/contrib/gis/geos/geometry.py

@@ -2,6 +2,7 @@
  This module contains the 'base' GEOSGeometry object -- all GEOS Geometries
  This module contains the 'base' GEOSGeometry object -- all GEOS Geometries
  inherit from this object.
  inherit from this object.
 """
 """
+
 import re
 import re
 from ctypes import addressof, byref, c_double
 from ctypes import addressof, byref, c_double
 
 

+ 1 - 0
django/contrib/gis/geos/io.py

@@ -3,6 +3,7 @@ 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.
 reader and writer classes.
 """
 """
+
 from django.contrib.gis.geos.geometry import GEOSGeometry
 from django.contrib.gis.geos.geometry import GEOSGeometry
 from django.contrib.gis.geos.prototypes.io import (
 from django.contrib.gis.geos.prototypes.io import (
     WKBWriter,
     WKBWriter,

+ 1 - 0
django/contrib/gis/geos/libgeos.py

@@ -6,6 +6,7 @@
  This module also houses GEOS Pointer utilities, including
  This module also houses GEOS Pointer utilities, including
  get_pointer_arr(), and GEOM_PTR.
  get_pointer_arr(), and GEOM_PTR.
 """
 """
+
 import logging
 import logging
 import os
 import os
 from ctypes import CDLL, CFUNCTYPE, POINTER, Structure, c_char_p
 from ctypes import CDLL, CFUNCTYPE, POINTER, Structure, c_char_p

+ 1 - 0
django/contrib/gis/geos/prototypes/errcheck.py

@@ -1,6 +1,7 @@
 """
 """
  Error checking functions for GEOS ctypes prototype functions.
  Error checking functions for GEOS ctypes prototype functions.
 """
 """
+
 from ctypes import c_void_p, string_at
 from ctypes import c_void_p, string_at
 
 
 from django.contrib.gis.geos.error import GEOSException
 from django.contrib.gis.geos.error import GEOSException

+ 1 - 0
django/contrib/gis/geos/prototypes/misc.py

@@ -2,6 +2,7 @@
  This module is for the miscellaneous GEOS routines, particularly the
  This module is for the miscellaneous GEOS routines, particularly the
  ones that return the area, distance, and length.
  ones that return the area, distance, and length.
 """
 """
+
 from ctypes import POINTER, c_double, c_int
 from ctypes import POINTER, c_double, c_int
 
 
 from django.contrib.gis.geos.libgeos import GEOM_PTR, GEOSFuncFactory
 from django.contrib.gis.geos.libgeos import GEOM_PTR, GEOSFuncFactory

+ 1 - 0
django/contrib/gis/geos/prototypes/predicates.py

@@ -2,6 +2,7 @@
  This module houses the GEOS ctypes prototype functions for the
  This module houses the GEOS ctypes prototype functions for the
  unary and binary predicate operations on geometries.
  unary and binary predicate operations on geometries.
 """
 """
+
 from ctypes import c_byte, c_char_p, c_double
 from ctypes import c_byte, c_char_p, c_double
 
 
 from django.contrib.gis.geos.libgeos import GEOM_PTR, GEOSFuncFactory
 from django.contrib.gis.geos.libgeos import GEOM_PTR, GEOSFuncFactory

+ 1 - 0
django/contrib/gis/geos/prototypes/topology.py

@@ -2,6 +2,7 @@
  This module houses the GEOS ctypes prototype functions for the
  This module houses the GEOS ctypes prototype functions for the
  topological operations on geometries.
  topological operations on geometries.
 """
 """
+
 from ctypes import c_double, c_int
 from ctypes import c_double, c_int
 
 
 from django.contrib.gis.geos.libgeos import GEOM_PTR, GEOSFuncFactory
 from django.contrib.gis.geos.libgeos import GEOM_PTR, GEOSFuncFactory

+ 1 - 0
django/contrib/gis/utils/__init__.py

@@ -1,6 +1,7 @@
 """
 """
  This module contains useful utilities for GeoDjango.
  This module contains useful utilities for GeoDjango.
 """
 """
+
 from django.contrib.gis.utils.ogrinfo import ogrinfo
 from django.contrib.gis.utils.ogrinfo import ogrinfo
 from django.contrib.gis.utils.ogrinspect import mapping, ogrinspect
 from django.contrib.gis.utils.ogrinspect import mapping, ogrinspect
 from django.contrib.gis.utils.srs import add_srs_entry
 from django.contrib.gis.utils.srs import add_srs_entry

+ 1 - 0
django/contrib/gis/utils/ogrinspect.py

@@ -3,6 +3,7 @@ This module is for inspecting OGR data sources and generating either
 models for GeoDjango and/or mapping dictionaries for use with the
 models for GeoDjango and/or mapping dictionaries for use with the
 `LayerMapping` utility.
 `LayerMapping` utility.
 """
 """
+
 from django.contrib.gis.gdal import DataSource
 from django.contrib.gis.gdal import DataSource
 from django.contrib.gis.gdal.field import (
 from django.contrib.gis.gdal.field import (
     OFTDate,
     OFTDate,

+ 5 - 3
django/contrib/postgres/search.py

@@ -116,9 +116,11 @@ class SearchVector(SearchVectorCombinable, Func):
         clone.set_source_expressions(
         clone.set_source_expressions(
             [
             [
                 Coalesce(
                 Coalesce(
-                    expression
-                    if isinstance(expression.output_field, (CharField, TextField))
-                    else Cast(expression, TextField()),
+                    (
+                        expression
+                        if isinstance(expression.output_field, (CharField, TextField))
+                        else Cast(expression, TextField())
+                    ),
                     Value(""),
                     Value(""),
                 )
                 )
                 for expression in clone.get_source_expressions()
                 for expression in clone.get_source_expressions()

+ 1 - 0
django/contrib/sessions/base_session.py

@@ -2,6 +2,7 @@
 This module allows importing AbstractBaseSession even
 This module allows importing AbstractBaseSession even
 when django.contrib.sessions is not in INSTALLED_APPS.
 when django.contrib.sessions is not in INSTALLED_APPS.
 """
 """
+
 from django.db import models
 from django.db import models
 from django.utils.translation import gettext_lazy as _
 from django.utils.translation import gettext_lazy as _
 
 

+ 1 - 0
django/contrib/staticfiles/views.py

@@ -3,6 +3,7 @@ Views and functions for serving static files. These are only to be used during
 development, and SHOULD NOT be used in a production setting.
 development, and SHOULD NOT be used in a production setting.
 
 
 """
 """
+
 import os
 import os
 import posixpath
 import posixpath
 
 

+ 1 - 0
django/core/cache/__init__.py

@@ -12,6 +12,7 @@ object.
 
 
 See docs/topics/cache.txt for information on the public API.
 See docs/topics/cache.txt for information on the public API.
 """
 """
+
 from django.core import signals
 from django.core import signals
 from django.core.cache.backends.base import (
 from django.core.cache.backends.base import (
     BaseCache,
     BaseCache,

+ 1 - 0
django/core/exceptions.py

@@ -1,6 +1,7 @@
 """
 """
 Global Django exception and warning classes.
 Global Django exception and warning classes.
 """
 """
+
 import operator
 import operator
 
 
 from django.utils.hashable import make_hashable
 from django.utils.hashable import make_hashable

+ 1 - 0
django/core/files/images.py

@@ -3,6 +3,7 @@ Utility functions for handling images.
 
 
 Requires Pillow as you might imagine.
 Requires Pillow as you might imagine.
 """
 """
+
 import struct
 import struct
 import zlib
 import zlib
 
 

+ 1 - 0
django/core/files/locks.py

@@ -16,6 +16,7 @@ Example Usage::
     ...     locks.lock(f, locks.LOCK_EX)
     ...     locks.lock(f, locks.LOCK_EX)
     ...     f.write('Django')
     ...     f.write('Django')
 """
 """
+
 import os
 import os
 
 
 __all__ = ("LOCK_EX", "LOCK_SH", "LOCK_NB", "lock", "unlock")
 __all__ = ("LOCK_EX", "LOCK_SH", "LOCK_NB", "lock", "unlock")

+ 1 - 0
django/core/files/uploadhandler.py

@@ -1,6 +1,7 @@
 """
 """
 Base file upload handler classes, and the built-in concrete subclasses
 Base file upload handler classes, and the built-in concrete subclasses
 """
 """
+
 import os
 import os
 from io import BytesIO
 from io import BytesIO
 
 

+ 1 - 0
django/core/mail/__init__.py

@@ -1,6 +1,7 @@
 """
 """
 Tools for sending email.
 Tools for sending email.
 """
 """
+
 from django.conf import settings
 from django.conf import settings
 
 
 # Imported for backwards compatibility and for the sake
 # Imported for backwards compatibility and for the sake

+ 1 - 0
django/core/mail/backends/console.py

@@ -1,6 +1,7 @@
 """
 """
 Email backend that writes messages to console instead of sending them.
 Email backend that writes messages to console instead of sending them.
 """
 """
+
 import sys
 import sys
 import threading
 import threading
 
 

+ 1 - 0
django/core/mail/backends/locmem.py

@@ -1,6 +1,7 @@
 """
 """
 Backend for test environment.
 Backend for test environment.
 """
 """
+
 import copy
 import copy
 
 
 from django.core import mail
 from django.core import mail

+ 1 - 0
django/core/mail/backends/smtp.py

@@ -1,4 +1,5 @@
 """SMTP email backend class."""
 """SMTP email backend class."""
+
 import smtplib
 import smtplib
 import ssl
 import ssl
 import threading
 import threading

+ 15 - 8
django/core/management/base.py

@@ -2,6 +2,7 @@
 Base classes for writing management commands (named commands which can
 Base classes for writing management commands (named commands which can
 be executed through ``django-admin`` or ``manage.py``).
 be executed through ``django-admin`` or ``manage.py``).
 """
 """
+
 import argparse
 import argparse
 import os
 import os
 import sys
 import sys
@@ -528,9 +529,11 @@ class BaseCommand:
                 if issues:
                 if issues:
                     visible_issue_count += len(issues)
                     visible_issue_count += len(issues)
                     formatted = (
                     formatted = (
-                        self.style.ERROR(str(e))
-                        if e.is_serious()
-                        else self.style.WARNING(str(e))
+                        (
+                            self.style.ERROR(str(e))
+                            if e.is_serious()
+                            else self.style.WARNING(str(e))
+                        )
                         for e in issues
                         for e in issues
                     )
                     )
                     formatted = "\n".join(sorted(formatted))
                     formatted = "\n".join(sorted(formatted))
@@ -543,11 +546,15 @@ class BaseCommand:
             if visible_issue_count:
             if visible_issue_count:
                 footer += "\n"
                 footer += "\n"
             footer += "System check identified %s (%s silenced)." % (
             footer += "System check identified %s (%s silenced)." % (
-                "no issues"
-                if visible_issue_count == 0
-                else "1 issue"
-                if visible_issue_count == 1
-                else "%s issues" % visible_issue_count,
+                (
+                    "no issues"
+                    if visible_issue_count == 0
+                    else (
+                        "1 issue"
+                        if visible_issue_count == 1
+                        else "%s issues" % visible_issue_count
+                    )
+                ),
                 len(all_issues) - visible_issue_count,
                 len(all_issues) - visible_issue_count,
             )
             )
 
 

+ 1 - 0
django/core/serializers/base.py

@@ -1,6 +1,7 @@
 """
 """
 Module for abstract serializer/unserializer base classes.
 Module for abstract serializer/unserializer base classes.
 """
 """
+
 from io import StringIO
 from io import StringIO
 
 
 from django.core.exceptions import ObjectDoesNotExist
 from django.core.exceptions import ObjectDoesNotExist

+ 1 - 0
django/core/serializers/xml_serializer.py

@@ -1,6 +1,7 @@
 """
 """
 XML serializer.
 XML serializer.
 """
 """
+
 import json
 import json
 from xml.dom import pulldom
 from xml.dom import pulldom
 from xml.sax import handler
 from xml.sax import handler

+ 9 - 7
django/db/backends/base/schema.py

@@ -724,9 +724,9 @@ class BaseDatabaseSchemaEditor:
                 namespace, _ = split_identifier(model._meta.db_table)
                 namespace, _ = split_identifier(model._meta.db_table)
                 definition += " " + self.sql_create_column_inline_fk % {
                 definition += " " + self.sql_create_column_inline_fk % {
                     "name": self._fk_constraint_name(model, field, constraint_suffix),
                     "name": self._fk_constraint_name(model, field, constraint_suffix),
-                    "namespace": "%s." % self.quote_name(namespace)
-                    if namespace
-                    else "",
+                    "namespace": (
+                        "%s." % self.quote_name(namespace) if namespace else ""
+                    ),
                     "column": self.quote_name(field.column),
                     "column": self.quote_name(field.column),
                     "to_table": self.quote_name(to_table),
                     "to_table": self.quote_name(to_table),
                     "to_column": self.quote_name(to_column),
                     "to_column": self.quote_name(to_column),
@@ -1919,11 +1919,13 @@ class BaseDatabaseSchemaEditor:
         """Return all constraint names matching the columns and conditions."""
         """Return all constraint names matching the columns and conditions."""
         if column_names is not None:
         if column_names is not None:
             column_names = [
             column_names = [
-                self.connection.introspection.identifier_converter(
-                    truncate_name(name, self.connection.ops.max_name_length())
+                (
+                    self.connection.introspection.identifier_converter(
+                        truncate_name(name, self.connection.ops.max_name_length())
+                    )
+                    if self.connection.features.truncates_names
+                    else self.connection.introspection.identifier_converter(name)
                 )
                 )
-                if self.connection.features.truncates_names
-                else self.connection.introspection.identifier_converter(name)
                 for name in column_names
                 for name in column_names
             ]
             ]
         with self.connection.cursor() as cursor:
         with self.connection.cursor() as cursor:

+ 1 - 0
django/db/backends/ddl_references.py

@@ -2,6 +2,7 @@
 Helpers to manipulate deferred DDL statements that might need to be adjusted or
 Helpers to manipulate deferred DDL statements that might need to be adjusted or
 discarded within when executing a migration.
 discarded within when executing a migration.
 """
 """
+
 from copy import deepcopy
 from copy import deepcopy
 
 
 
 

+ 1 - 0
django/db/backends/mysql/base.py

@@ -3,6 +3,7 @@ MySQL database backend for Django.
 
 
 Requires mysqlclient: https://pypi.org/project/mysqlclient/
 Requires mysqlclient: https://pypi.org/project/mysqlclient/
 """
 """
+
 from django.core.exceptions import ImproperlyConfigured
 from django.core.exceptions import ImproperlyConfigured
 from django.db import IntegrityError
 from django.db import IntegrityError
 from django.db.backends import utils as backend_utils
 from django.db.backends import utils as backend_utils

+ 1 - 0
django/db/backends/oracle/base.py

@@ -3,6 +3,7 @@ Oracle database backend for Django.
 
 
 Requires oracledb: https://oracle.github.io/python-oracledb/
 Requires oracledb: https://oracle.github.io/python-oracledb/
 """
 """
+
 import datetime
 import datetime
 import decimal
 import decimal
 import os
 import os

+ 9 - 9
django/db/backends/oracle/creation.py

@@ -133,20 +133,20 @@ class DatabaseCreation(BaseDatabaseCreation):
         credentials in the SAVED_USER/SAVED_PASSWORD key in the settings dict.
         credentials in the SAVED_USER/SAVED_PASSWORD key in the settings dict.
         """
         """
         real_settings = settings.DATABASES[self.connection.alias]
         real_settings = settings.DATABASES[self.connection.alias]
-        real_settings["SAVED_USER"] = self.connection.settings_dict[
-            "SAVED_USER"
-        ] = self.connection.settings_dict["USER"]
+        real_settings["SAVED_USER"] = self.connection.settings_dict["SAVED_USER"] = (
+            self.connection.settings_dict["USER"]
+        )
         real_settings["SAVED_PASSWORD"] = self.connection.settings_dict[
         real_settings["SAVED_PASSWORD"] = self.connection.settings_dict[
             "SAVED_PASSWORD"
             "SAVED_PASSWORD"
         ] = self.connection.settings_dict["PASSWORD"]
         ] = self.connection.settings_dict["PASSWORD"]
         real_test_settings = real_settings["TEST"]
         real_test_settings = real_settings["TEST"]
         test_settings = self.connection.settings_dict["TEST"]
         test_settings = self.connection.settings_dict["TEST"]
-        real_test_settings["USER"] = real_settings["USER"] = test_settings[
-            "USER"
-        ] = self.connection.settings_dict["USER"] = parameters["user"]
-        real_settings["PASSWORD"] = self.connection.settings_dict[
-            "PASSWORD"
-        ] = parameters["password"]
+        real_test_settings["USER"] = real_settings["USER"] = test_settings["USER"] = (
+            self.connection.settings_dict["USER"]
+        ) = parameters["user"]
+        real_settings["PASSWORD"] = self.connection.settings_dict["PASSWORD"] = (
+            parameters["password"]
+        )
 
 
     def set_as_test_mirror(self, primary_settings_dict):
     def set_as_test_mirror(self, primary_settings_dict):
         """
         """

+ 5 - 3
django/db/backends/postgresql/base.py

@@ -226,9 +226,11 @@ class DatabaseWrapper(BaseDatabaseWrapper):
         server_side_binding = conn_params.pop("server_side_binding", None)
         server_side_binding = conn_params.pop("server_side_binding", None)
         conn_params.setdefault(
         conn_params.setdefault(
             "cursor_factory",
             "cursor_factory",
-            ServerBindingCursor
-            if is_psycopg3 and server_side_binding is True
-            else Cursor,
+            (
+                ServerBindingCursor
+                if is_psycopg3 and server_side_binding is True
+                else Cursor
+            ),
         )
         )
         if settings_dict["USER"]:
         if settings_dict["USER"]:
             conn_params["user"] = settings_dict["USER"]
             conn_params["user"] = settings_dict["USER"]

+ 3 - 3
django/db/backends/postgresql/schema.py

@@ -267,9 +267,9 @@ class DatabaseSchemaEditor(BaseDatabaseSchemaEditor):
             % {
             % {
                 "column": self.quote_name(new_field.column),
                 "column": self.quote_name(new_field.column),
                 "type": new_type,
                 "type": new_type,
-                "collation": " " + self._collate_sql(new_collation)
-                if new_collation
-                else "",
+                "collation": (
+                    " " + self._collate_sql(new_collation) if new_collation else ""
+                ),
             },
             },
             [],
             [],
         )
         )

+ 1 - 0
django/db/backends/sqlite3/_functions.py

@@ -1,6 +1,7 @@
 """
 """
 Implementations of SQL functions for SQLite.
 Implementations of SQL functions for SQLite.
 """
 """
+
 import functools
 import functools
 import random
 import random
 import statistics
 import statistics

+ 1 - 0
django/db/backends/sqlite3/base.py

@@ -1,6 +1,7 @@
 """
 """
 SQLite backend for the sqlite3 module in the standard library.
 SQLite backend for the sqlite3 module in the standard library.
 """
 """
+
 import datetime
 import datetime
 import decimal
 import decimal
 import warnings
 import warnings

+ 9 - 8
django/db/migrations/autodetector.py

@@ -620,11 +620,12 @@ class MigrationAutodetector:
                                 rem_model_state.app_label,
                                 rem_model_state.app_label,
                                 rem_model_state.name_lower,
                                 rem_model_state.name_lower,
                             )
                             )
-                            self.renamed_models_rel[
-                                renamed_models_rel_key
-                            ] = "%s.%s" % (
-                                model_state.app_label,
-                                model_state.name_lower,
+                            self.renamed_models_rel[renamed_models_rel_key] = (
+                                "%s.%s"
+                                % (
+                                    model_state.app_label,
+                                    model_state.name_lower,
+                                )
                             )
                             )
                             self.old_model_keys.remove((rem_app_label, rem_model_name))
                             self.old_model_keys.remove((rem_app_label, rem_model_name))
                             self.old_model_keys.add((app_label, model_name))
                             self.old_model_keys.add((app_label, model_name))
@@ -1058,9 +1059,9 @@ class MigrationAutodetector:
                                 (rem_app_label, rem_model_name, rem_field_name)
                                 (rem_app_label, rem_model_name, rem_field_name)
                             )
                             )
                             old_field_keys.add((app_label, model_name, field_name))
                             old_field_keys.add((app_label, model_name, field_name))
-                            self.renamed_fields[
-                                app_label, model_name, field_name
-                            ] = rem_field_name
+                            self.renamed_fields[app_label, model_name, field_name] = (
+                                rem_field_name
+                            )
                             break
                             break
 
 
     def generate_renamed_fields(self):
     def generate_renamed_fields(self):

+ 5 - 5
django/db/migrations/loader.py

@@ -131,11 +131,11 @@ class MigrationLoader:
                         "Migration %s in app %s has no Migration class"
                         "Migration %s in app %s has no Migration class"
                         % (migration_name, app_config.label)
                         % (migration_name, app_config.label)
                     )
                     )
-                self.disk_migrations[
-                    app_config.label, migration_name
-                ] = migration_module.Migration(
-                    migration_name,
-                    app_config.label,
+                self.disk_migrations[app_config.label, migration_name] = (
+                    migration_module.Migration(
+                        migration_name,
+                        app_config.label,
+                    )
                 )
                 )
 
 
     def get_migration(self, app_label, name_prefix):
     def get_migration(self, app_label, name_prefix):

+ 5 - 5
django/db/migrations/operations/models.py

@@ -56,11 +56,11 @@ class CreateModel(ModelOperation):
         _check_for_duplicates(
         _check_for_duplicates(
             "bases",
             "bases",
             (
             (
-                base._meta.label_lower
-                if hasattr(base, "_meta")
-                else base.lower()
-                if isinstance(base, str)
-                else base
+                (
+                    base._meta.label_lower
+                    if hasattr(base, "_meta")
+                    else base.lower() if isinstance(base, str) else base
+                )
                 for base in self.bases
                 for base in self.bases
             ),
             ),
         )
         )

+ 5 - 5
django/db/migrations/state.py

@@ -524,11 +524,11 @@ class ProjectState:
             if model_state.options.get("proxy"):
             if model_state.options.get("proxy"):
                 proxy_models[model_key] = model_state
                 proxy_models[model_key] = model_state
                 # Find a concrete model for the proxy.
                 # Find a concrete model for the proxy.
-                concrete_models_mapping[
-                    model_key
-                ] = self._find_concrete_model_from_proxy(
-                    proxy_models,
-                    model_state,
+                concrete_models_mapping[model_key] = (
+                    self._find_concrete_model_from_proxy(
+                        proxy_models,
+                        model_state,
+                    )
                 )
                 )
             else:
             else:
                 concrete_models_mapping[model_key] = model_key
                 concrete_models_mapping[model_key] = model_key

+ 1 - 0
django/db/models/aggregates.py

@@ -1,6 +1,7 @@
 """
 """
 Classes to represent the definitions of aggregate functions.
 Classes to represent the definitions of aggregate functions.
 """
 """
+
 from django.core.exceptions import FieldError, FullResultSet
 from django.core.exceptions import FieldError, FullResultSet
 from django.db.models.expressions import Case, Func, Star, Value, When
 from django.db.models.expressions import Case, Func, Star, Value, When
 from django.db.models.fields import IntegerField
 from django.db.models.fields import IntegerField

+ 5 - 3
django/db/models/base.py

@@ -2265,9 +2265,11 @@ class Model(AltersData, metaclass=ModelBase):
         opts = cls._meta
         opts = cls._meta
         valid_fields = set(
         valid_fields = set(
             chain.from_iterable(
             chain.from_iterable(
-                (f.name, f.attname)
-                if not (f.auto_created and not f.concrete)
-                else (f.field.related_query_name(),)
+                (
+                    (f.name, f.attname)
+                    if not (f.auto_created and not f.concrete)
+                    else (f.field.related_query_name(),)
+                )
                 for f in chain(opts.fields, opts.related_objects)
                 for f in chain(opts.fields, opts.related_objects)
             )
             )
         )
         )

+ 1 - 0
django/db/models/constants.py

@@ -1,6 +1,7 @@
 """
 """
 Constants used across the ORM in general.
 Constants used across the ORM in general.
 """
 """
+
 from enum import Enum
 from enum import Enum
 
 
 # Separator used to split filter strings apart.
 # Separator used to split filter strings apart.

+ 21 - 21
django/db/models/expressions.py

@@ -204,9 +204,11 @@ class BaseExpression:
 
 
     def _parse_expressions(self, *expressions):
     def _parse_expressions(self, *expressions):
         return [
         return [
-            arg
-            if hasattr(arg, "resolve_expression")
-            else (F(arg) if isinstance(arg, str) else Value(arg))
+            (
+                arg
+                if hasattr(arg, "resolve_expression")
+                else (F(arg) if isinstance(arg, str) else Value(arg))
+            )
             for arg in expressions
             for arg in expressions
         ]
         ]
 
 
@@ -285,9 +287,11 @@ class BaseExpression:
         c.is_summary = summarize
         c.is_summary = summarize
         c.set_source_expressions(
         c.set_source_expressions(
             [
             [
-                expr.resolve_expression(query, allow_joins, reuse, summarize)
-                if expr
-                else None
+                (
+                    expr.resolve_expression(query, allow_joins, reuse, summarize)
+                    if expr
+                    else None
+                )
                 for expr in c.get_source_expressions()
                 for expr in c.get_source_expressions()
             ]
             ]
         )
         )
@@ -366,22 +370,16 @@ class BaseExpression:
         field = self.output_field
         field = self.output_field
         internal_type = field.get_internal_type()
         internal_type = field.get_internal_type()
         if internal_type == "FloatField":
         if internal_type == "FloatField":
-            return (
-                lambda value, expression, connection: None
-                if value is None
-                else float(value)
+            return lambda value, expression, connection: (
+                None if value is None else float(value)
             )
             )
         elif internal_type.endswith("IntegerField"):
         elif internal_type.endswith("IntegerField"):
-            return (
-                lambda value, expression, connection: None
-                if value is None
-                else int(value)
+            return lambda value, expression, connection: (
+                None if value is None else int(value)
             )
             )
         elif internal_type == "DecimalField":
         elif internal_type == "DecimalField":
-            return (
-                lambda value, expression, connection: None
-                if value is None
-                else Decimal(value)
+            return lambda value, expression, connection: (
+                None if value is None else Decimal(value)
             )
             )
         return self._convert_value_noop
         return self._convert_value_noop
 
 
@@ -432,9 +430,11 @@ class BaseExpression:
         clone = self.copy()
         clone = self.copy()
         clone.set_source_expressions(
         clone.set_source_expressions(
             [
             [
-                F(f"{prefix}{expr.name}")
-                if isinstance(expr, F)
-                else expr.prefix_references(prefix)
+                (
+                    F(f"{prefix}{expr.name}")
+                    if isinstance(expr, F)
+                    else expr.prefix_references(prefix)
+                )
                 for expr in self.get_source_expressions()
                 for expr in self.get_source_expressions()
             ]
             ]
         )
         )

+ 1 - 0
django/db/models/fields/related_descriptors.py

@@ -62,6 +62,7 @@ and two directions (forward and reverse) for a total of six combinations.
    If you're looking for ``ForwardManyToManyDescriptor`` or
    If you're looking for ``ForwardManyToManyDescriptor`` or
    ``ReverseManyToManyDescriptor``, use ``ManyToManyDescriptor`` instead.
    ``ReverseManyToManyDescriptor``, use ``ManyToManyDescriptor`` instead.
 """
 """
+
 import warnings
 import warnings
 
 
 from asgiref.sync import sync_to_async
 from asgiref.sync import sync_to_async

+ 1 - 0
django/db/models/fields/reverse_related.py

@@ -8,6 +8,7 @@ in the ``remote_field`` attribute of the field.
 They also act as reverse fields for the purposes of the Meta API because
 They also act as reverse fields for the purposes of the Meta API because
 they're the closest concept currently available.
 they're the closest concept currently available.
 """
 """
+
 import warnings
 import warnings
 
 
 from django.core import exceptions
 from django.core import exceptions

+ 1 - 0
django/db/models/functions/comparison.py

@@ -1,4 +1,5 @@
 """Database functions that do comparisons or type conversions."""
 """Database functions that do comparisons or type conversions."""
+
 from django.db import NotSupportedError
 from django.db import NotSupportedError
 from django.db.models.expressions import Func, Value
 from django.db.models.expressions import Func, Value
 from django.db.models.fields import TextField
 from django.db.models.fields import TextField

+ 10 - 6
django/db/models/functions/datetime.py

@@ -318,9 +318,11 @@ class TruncBase(TimezoneMixin, Transform):
                 "Cannot truncate DateField '%s' to %s."
                 "Cannot truncate DateField '%s' to %s."
                 % (
                 % (
                     field.name,
                     field.name,
-                    output_field.__class__.__name__
-                    if has_explicit_output_field
-                    else "DateTimeField",
+                    (
+                        output_field.__class__.__name__
+                        if has_explicit_output_field
+                        else "DateTimeField"
+                    ),
                 )
                 )
             )
             )
         elif isinstance(field, TimeField) and (
         elif isinstance(field, TimeField) and (
@@ -331,9 +333,11 @@ class TruncBase(TimezoneMixin, Transform):
                 "Cannot truncate TimeField '%s' to %s."
                 "Cannot truncate TimeField '%s' to %s."
                 % (
                 % (
                     field.name,
                     field.name,
-                    output_field.__class__.__name__
-                    if has_explicit_output_field
-                    else "DateTimeField",
+                    (
+                        output_field.__class__.__name__
+                        if has_explicit_output_field
+                        else "DateTimeField"
+                    ),
                 )
                 )
             )
             )
         return copy
         return copy

+ 5 - 3
django/db/models/functions/math.py

@@ -47,9 +47,11 @@ class ATan2(NumericOutputFieldMixin, Func):
         clone = self.copy()
         clone = self.copy()
         clone.set_source_expressions(
         clone.set_source_expressions(
             [
             [
-                Cast(expression, FloatField())
-                if isinstance(expression.output_field, IntegerField)
-                else expression
+                (
+                    Cast(expression, FloatField())
+                    if isinstance(expression.output_field, IntegerField)
+                    else expression
+                )
                 for expression in self.get_source_expressions()[::-1]
                 for expression in self.get_source_expressions()[::-1]
             ]
             ]
         )
         )

+ 5 - 3
django/db/models/functions/mixins.py

@@ -14,9 +14,11 @@ class FixDecimalInputMixin:
         clone = self.copy()
         clone = self.copy()
         clone.set_source_expressions(
         clone.set_source_expressions(
             [
             [
-                Cast(expression, output_field)
-                if isinstance(expression.output_field, FloatField)
-                else expression
+                (
+                    Cast(expression, output_field)
+                    if isinstance(expression.output_field, FloatField)
+                    else expression
+                )
                 for expression in self.get_source_expressions()
                 for expression in self.get_source_expressions()
             ]
             ]
         )
         )

+ 5 - 3
django/db/models/functions/text.py

@@ -89,9 +89,11 @@ class ConcatPair(Func):
         c = self.copy()
         c = self.copy()
         c.set_source_expressions(
         c.set_source_expressions(
             [
             [
-                expression
-                if isinstance(expression.output_field, (CharField, TextField))
-                else Cast(expression, TextField())
+                (
+                    expression
+                    if isinstance(expression.output_field, (CharField, TextField))
+                    else Cast(expression, TextField())
+                )
                 for expression in c.get_source_expressions()
                 for expression in c.get_source_expressions()
             ]
             ]
         )
         )

+ 5 - 3
django/db/models/indexes.py

@@ -196,9 +196,11 @@ class Index:
             "" if not self.fields else " fields=%s" % repr(self.fields),
             "" if not self.fields else " fields=%s" % repr(self.fields),
             "" if not self.expressions else " expressions=%s" % repr(self.expressions),
             "" if not self.expressions else " expressions=%s" % repr(self.expressions),
             "" if not self.name else " name=%s" % repr(self.name),
             "" if not self.name else " name=%s" % repr(self.name),
-            ""
-            if self.db_tablespace is None
-            else " db_tablespace=%s" % repr(self.db_tablespace),
+            (
+                ""
+                if self.db_tablespace is None
+                else " db_tablespace=%s" % repr(self.db_tablespace)
+            ),
             "" if self.condition is None else " condition=%s" % self.condition,
             "" if self.condition is None else " condition=%s" % self.condition,
             "" if not self.include else " include=%s" % repr(self.include),
             "" if not self.include else " include=%s" % repr(self.include),
             "" if not self.opclasses else " opclasses=%s" % repr(self.opclasses),
             "" if not self.opclasses else " opclasses=%s" % repr(self.opclasses),

+ 5 - 3
django/db/models/lookups.py

@@ -273,9 +273,11 @@ class FieldGetDbPrepValueMixin:
         return (
         return (
             "%s",
             "%s",
             [
             [
-                v
-                if hasattr(v, "as_sql")
-                else get_db_prep_value(v, connection, prepared=True)
+                (
+                    v
+                    if hasattr(v, "as_sql")
+                    else get_db_prep_value(v, connection, prepared=True)
+                )
                 for v in value
                 for v in value
             ],
             ],
         )
         )

+ 11 - 9
django/db/models/query.py

@@ -109,9 +109,11 @@ class ModelIterable(BaseIterable):
                 related_objs,
                 related_objs,
                 operator.attrgetter(
                 operator.attrgetter(
                     *[
                     *[
-                        field.attname
-                        if from_field == "self"
-                        else queryset.model._meta.get_field(from_field).attname
+                        (
+                            field.attname
+                            if from_field == "self"
+                            else queryset.model._meta.get_field(from_field).attname
+                        )
                         for from_field in field.from_fields
                         for from_field in field.from_fields
                     ]
                     ]
                 ),
                 ),
@@ -1391,9 +1393,7 @@ class QuerySet(AltersData):
         clone._iterable_class = (
         clone._iterable_class = (
             NamedValuesListIterable
             NamedValuesListIterable
             if named
             if named
-            else FlatValuesListIterable
-            if flat
-            else ValuesListIterable
+            else FlatValuesListIterable if flat else ValuesListIterable
         )
         )
         return clone
         return clone
 
 
@@ -1659,9 +1659,11 @@ class QuerySet(AltersData):
         if names is None:
         if names is None:
             names = set(
             names = set(
                 chain.from_iterable(
                 chain.from_iterable(
-                    (field.name, field.attname)
-                    if hasattr(field, "attname")
-                    else (field.name,)
+                    (
+                        (field.name, field.attname)
+                        if hasattr(field, "attname")
+                        else (field.name,)
+                    )
                     for field in self.model._meta.get_fields()
                     for field in self.model._meta.get_fields()
                 )
                 )
             )
             )

+ 1 - 0
django/db/models/query_utils.py

@@ -5,6 +5,7 @@ Factored out from django.db.models.query to avoid making the main module very
 large and/or so that they can be used by other modules without getting into
 large and/or so that they can be used by other modules without getting into
 circular import difficulties.
 circular import difficulties.
 """
 """
+
 import functools
 import functools
 import inspect
 import inspect
 import logging
 import logging

+ 3 - 3
django/db/models/sql/compiler.py

@@ -1224,9 +1224,9 @@ class SQLCompiler:
                 "field": f,
                 "field": f,
                 "reverse": False,
                 "reverse": False,
                 "local_setter": f.set_cached_value,
                 "local_setter": f.set_cached_value,
-                "remote_setter": f.remote_field.set_cached_value
-                if f.unique
-                else lambda x, y: None,
+                "remote_setter": (
+                    f.remote_field.set_cached_value if f.unique else lambda x, y: None
+                ),
                 "from_parent": False,
                 "from_parent": False,
             }
             }
             related_klass_infos.append(klass_info)
             related_klass_infos.append(klass_info)

+ 1 - 0
django/db/models/sql/datastructures.py

@@ -2,6 +2,7 @@
 Useful auxiliary data structures for query construction. Not useful outside
 Useful auxiliary data structures for query construction. Not useful outside
 the SQL domain.
 the SQL domain.
 """
 """
+
 import warnings
 import warnings
 
 
 from django.core.exceptions import FullResultSet
 from django.core.exceptions import FullResultSet

+ 1 - 0
django/db/models/sql/query.py

@@ -6,6 +6,7 @@ themselves do not have to (and could be backed by things other than SQL
 databases). The abstraction barrier only works one way: this module has to know
 databases). The abstraction barrier only works one way: this module has to know
 all about the internals of models in order to get the information it needs.
 all about the internals of models in order to get the information it needs.
 """
 """
+
 import copy
 import copy
 import difflib
 import difflib
 import functools
 import functools

+ 1 - 0
django/db/models/sql/where.py

@@ -1,6 +1,7 @@
 """
 """
 Code to manage the creation and SQL rendering of 'where' constraints.
 Code to manage the creation and SQL rendering of 'where' constraints.
 """
 """
+
 import operator
 import operator
 from functools import reduce
 from functools import reduce
 
 

+ 7 - 3
django/forms/models.py

@@ -2,6 +2,7 @@
 Helper functions for creating Form classes from Django models
 Helper functions for creating Form classes from Django models
 and database field objects.
 and database field objects.
 """
 """
+
 from itertools import chain
 from itertools import chain
 
 
 from django.core.exceptions import (
 from django.core.exceptions import (
@@ -830,9 +831,12 @@ class BaseModelFormSet(BaseFormSet, AltersData):
                 )
                 )
                 # Reduce Model instances to their primary key values
                 # Reduce Model instances to their primary key values
                 row_data = tuple(
                 row_data = tuple(
-                    d._get_pk_val() if hasattr(d, "_get_pk_val")
-                    # Prevent "unhashable type: list" errors later on.
-                    else tuple(d) if isinstance(d, list) else d
+                    (
+                        d._get_pk_val()
+                        if hasattr(d, "_get_pk_val")
+                        # Prevent "unhashable type: list" errors later on.
+                        else tuple(d) if isinstance(d, list) else d
+                    )
                     for d in row_data
                     for d in row_data
                 )
                 )
                 if row_data and None not in row_data:
                 if row_data and None not in row_data:

+ 13 - 9
django/forms/widgets.py

@@ -101,9 +101,11 @@ class Media:
 
 
     def render_js(self):
     def render_js(self):
         return [
         return [
-            path.__html__()
-            if hasattr(path, "__html__")
-            else format_html('<script src="{}"></script>', self.absolute_path(path))
+            (
+                path.__html__()
+                if hasattr(path, "__html__")
+                else format_html('<script src="{}"></script>', self.absolute_path(path))
+            )
             for path in self._js
             for path in self._js
         ]
         ]
 
 
@@ -113,12 +115,14 @@ class Media:
         media = sorted(self._css)
         media = sorted(self._css)
         return chain.from_iterable(
         return chain.from_iterable(
             [
             [
-                path.__html__()
-                if hasattr(path, "__html__")
-                else format_html(
-                    '<link href="{}" media="{}" rel="stylesheet">',
-                    self.absolute_path(path),
-                    medium,
+                (
+                    path.__html__()
+                    if hasattr(path, "__html__")
+                    else format_html(
+                        '<link href="{}" media="{}" rel="stylesheet">',
+                        self.absolute_path(path),
+                        medium,
+                    )
                 )
                 )
                 for path in self._css[medium]
                 for path in self._css[medium]
             ]
             ]

+ 1 - 0
django/http/multipartparser.py

@@ -4,6 +4,7 @@ Multi-part parsing for file uploads.
 Exposes one class, ``MultiPartParser``, which feeds chunks of uploaded data to
 Exposes one class, ``MultiPartParser``, which feeds chunks of uploaded data to
 file upload handlers for processing.
 file upload handlers for processing.
 """
 """
+
 import base64
 import base64
 import binascii
 import binascii
 import collections
 import collections

+ 5 - 3
django/http/request.py

@@ -170,9 +170,11 @@ class HttpRequest:
         return "%s%s%s" % (
         return "%s%s%s" % (
             escape_uri_path(path),
             escape_uri_path(path),
             "/" if force_append_slash and not path.endswith("/") else "",
             "/" if force_append_slash and not path.endswith("/") else "",
-            ("?" + iri_to_uri(self.META.get("QUERY_STRING", "")))
-            if self.META.get("QUERY_STRING", "")
-            else "",
+            (
+                ("?" + iri_to_uri(self.META.get("QUERY_STRING", "")))
+                if self.META.get("QUERY_STRING", "")
+                else ""
+            ),
         )
         )
 
 
     def get_signed_cookie(self, key, default=RAISE_ERROR, salt="", max_age=None):
     def get_signed_cookie(self, key, default=RAISE_ERROR, salt="", max_age=None):

+ 1 - 0
django/middleware/csrf.py

@@ -4,6 +4,7 @@ Cross Site Request Forgery Middleware.
 This module provides a middleware that implements protection
 This module provides a middleware that implements protection
 against request forgeries from other sites.
 against request forgeries from other sites.
 """
 """
+
 import logging
 import logging
 import string
 import string
 from collections import defaultdict
 from collections import defaultdict

+ 1 - 0
django/shortcuts.py

@@ -3,6 +3,7 @@ This module collects helper functions and classes that "span" multiple levels
 of MVC. In other words, these functions/classes introduce controlled coupling
 of MVC. In other words, these functions/classes introduce controlled coupling
 for convenience's sake.
 for convenience's sake.
 """
 """
+
 from django.http import (
 from django.http import (
     Http404,
     Http404,
     HttpResponse,
     HttpResponse,

+ 1 - 0
django/template/defaultfilters.py

@@ -1,4 +1,5 @@
 """Default variable filters."""
 """Default variable filters."""
+
 import random as random_module
 import random as random_module
 import re
 import re
 import types
 import types

+ 1 - 0
django/template/defaulttags.py

@@ -1,4 +1,5 @@
 """Default tags used by the template system, available to all templates."""
 """Default tags used by the template system, available to all templates."""
+
 import re
 import re
 import sys
 import sys
 import warnings
 import warnings

+ 5 - 3
django/template/engine.py

@@ -70,9 +70,11 @@ class Engine:
             self.__class__.__qualname__,
             self.__class__.__qualname__,
             "" if not self.dirs else " dirs=%s" % repr(self.dirs),
             "" if not self.dirs else " dirs=%s" % repr(self.dirs),
             self.app_dirs,
             self.app_dirs,
-            ""
-            if not self.context_processors
-            else " context_processors=%s" % repr(self.context_processors),
+            (
+                ""
+                if not self.context_processors
+                else " context_processors=%s" % repr(self.context_processors)
+            ),
             self.debug,
             self.debug,
             repr(self.loaders),
             repr(self.loaders),
             repr(self.string_if_invalid),
             repr(self.string_if_invalid),

+ 1 - 0
django/template/smartif.py

@@ -1,6 +1,7 @@
 """
 """
 Parser and utilities for the smart 'if' tag
 Parser and utilities for the smart 'if' tag
 """
 """
+
 # Using a simple top down parser, as described here:
 # Using a simple top down parser, as described here:
 #    http://effbot.org/zone/simple-top-down-parsing.htm.
 #    http://effbot.org/zone/simple-top-down-parsing.htm.
 # 'led' = left denotation
 # 'led' = left denotation

+ 1 - 0
django/test/html.py

@@ -1,4 +1,5 @@
 """Compare two HTML documents."""
 """Compare two HTML documents."""
+
 import html
 import html
 from html.parser import HTMLParser
 from html.parser import HTMLParser
 
 

+ 1 - 0
django/urls/conf.py

@@ -1,4 +1,5 @@
 """Functions for use in URLsconfs."""
 """Functions for use in URLsconfs."""
+
 from functools import partial
 from functools import partial
 from importlib import import_module
 from importlib import import_module
 
 

部分文件因为文件数量过多而无法显示