summaryrefslogtreecommitdiff
path: root/django/db
diff options
context:
space:
mode:
authorDavid Smith <smithdc@gmail.com>2023-02-01 07:13:39 +0000
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2023-02-01 11:04:38 +0100
commit097e3a70c1481ee7b042b2edd91b2be86fb7b5b6 (patch)
tree7042be9ee3aabda10ecfa8923a113388b81f34a8 /django/db
parent8c660fb59239828583f17cdede3b64f208b8752c (diff)
Refs #33476 -- Applied Black's 2023 stable style.
Black 23.1.0 is released which, as the first release of the year, introduces the 2023 stable style. This incorporates most of last year's preview style. https://github.com/psf/black/releases/tag/23.1.0
Diffstat (limited to 'django/db')
-rw-r--r--django/db/backends/base/creation.py1
-rw-r--r--django/db/backends/base/operations.py1
-rw-r--r--django/db/backends/mysql/schema.py1
-rw-r--r--django/db/backends/oracle/schema.py1
-rw-r--r--django/db/backends/postgresql/base.py1
-rw-r--r--django/db/backends/postgresql/schema.py1
-rw-r--r--django/db/backends/sqlite3/schema.py2
-rw-r--r--django/db/backends/utils.py1
-rw-r--r--django/db/migrations/operations/models.py4
-rw-r--r--django/db/models/expressions.py1
-rw-r--r--django/db/models/fields/files.py1
-rw-r--r--django/db/models/fields/related.py3
-rw-r--r--django/db/models/options.py1
-rw-r--r--django/db/models/query.py2
14 files changed, 7 insertions, 14 deletions
diff --git a/django/db/backends/base/creation.py b/django/db/backends/base/creation.py
index 8a54f4061a..cbac8a7f76 100644
--- a/django/db/backends/base/creation.py
+++ b/django/db/backends/base/creation.py
@@ -116,6 +116,7 @@ class BaseDatabaseCreation:
Designed only for test runner usage; will not handle large
amounts of data.
"""
+
# Iteratively return every object for all models to serialize.
def get_objects():
from django.db.migrations.loader import MigrationLoader
diff --git a/django/db/backends/base/operations.py b/django/db/backends/base/operations.py
index 4ee73c0734..d2bc336dd8 100644
--- a/django/db/backends/base/operations.py
+++ b/django/db/backends/base/operations.py
@@ -269,6 +269,7 @@ class BaseDatabaseOperations:
exists for database backends to provide a better implementation
according to their own quoting schemes.
"""
+
# Convert params to contain string values.
def to_string(s):
return force_str(s, strings_only=True, errors="replace")
diff --git a/django/db/backends/mysql/schema.py b/django/db/backends/mysql/schema.py
index e61445e46c..65b8fb7f42 100644
--- a/django/db/backends/mysql/schema.py
+++ b/django/db/backends/mysql/schema.py
@@ -4,7 +4,6 @@ from django.db.models.constants import LOOKUP_SEP
class DatabaseSchemaEditor(BaseDatabaseSchemaEditor):
-
sql_rename_table = "RENAME TABLE %(old_table)s TO %(new_table)s"
sql_alter_column_null = "MODIFY %(column)s %(type)s NULL"
diff --git a/django/db/backends/oracle/schema.py b/django/db/backends/oracle/schema.py
index ec5c9f4142..aca6d83962 100644
--- a/django/db/backends/oracle/schema.py
+++ b/django/db/backends/oracle/schema.py
@@ -11,7 +11,6 @@ from django.utils.duration import duration_iso_string
class DatabaseSchemaEditor(BaseDatabaseSchemaEditor):
-
sql_create_column = "ALTER TABLE %(table)s ADD %(column)s %(definition)s"
sql_alter_column_type = "MODIFY %(column)s %(type)s%(collation)s"
sql_alter_column_null = "MODIFY %(column)s NULL"
diff --git a/django/db/backends/postgresql/base.py b/django/db/backends/postgresql/base.py
index 9e24b186cf..3db3d6abd2 100644
--- a/django/db/backends/postgresql/base.py
+++ b/django/db/backends/postgresql/base.py
@@ -476,7 +476,6 @@ if is_psycopg3:
return self.cursor.copy(statement)
else:
-
Cursor = psycopg2.extensions.cursor
class CursorDebugWrapper(BaseCursorDebugWrapper):
diff --git a/django/db/backends/postgresql/schema.py b/django/db/backends/postgresql/schema.py
index 2887071254..321fa530aa 100644
--- a/django/db/backends/postgresql/schema.py
+++ b/django/db/backends/postgresql/schema.py
@@ -5,7 +5,6 @@ from django.db.backends.utils import strip_quotes
class DatabaseSchemaEditor(BaseDatabaseSchemaEditor):
-
# Setting all constraints to IMMEDIATE to allow changing data in the same
# transaction.
sql_update_with_default = (
diff --git a/django/db/backends/sqlite3/schema.py b/django/db/backends/sqlite3/schema.py
index c9e924b182..89867b6623 100644
--- a/django/db/backends/sqlite3/schema.py
+++ b/django/db/backends/sqlite3/schema.py
@@ -11,7 +11,6 @@ from django.db.transaction import atomic
class DatabaseSchemaEditor(BaseDatabaseSchemaEditor):
-
sql_delete_table = "DROP TABLE %(table)s"
sql_create_fk = None
sql_create_inline_fk = (
@@ -191,6 +190,7 @@ class DatabaseSchemaEditor(BaseDatabaseSchemaEditor):
4. Rename the "new__app_model" table to "app_model"
5. Restore any index of the previous "app_model" table.
"""
+
# Self-referential fields must be recreated rather than copied from
# the old model to ensure their remote_field.field_name doesn't refer
# to an altered field.
diff --git a/django/db/backends/utils.py b/django/db/backends/utils.py
index 71c1f2c7e8..f1acf98a8b 100644
--- a/django/db/backends/utils.py
+++ b/django/db/backends/utils.py
@@ -95,7 +95,6 @@ class CursorWrapper:
class CursorDebugWrapper(CursorWrapper):
-
# XXX callproc isn't instrumented at this time.
def execute(self, sql, params=None):
diff --git a/django/db/migrations/operations/models.py b/django/db/migrations/operations/models.py
index a243aba0b6..8847441a03 100644
--- a/django/db/migrations/operations/models.py
+++ b/django/db/migrations/operations/models.py
@@ -400,7 +400,7 @@ class RenameModel(ModelOperation):
fields = zip(
old_model._meta.local_many_to_many, new_model._meta.local_many_to_many
)
- for (old_field, new_field) in fields:
+ for old_field, new_field in fields:
# Skip self-referential fields as these are renamed above.
if (
new_field.model == new_field.related_model
@@ -505,7 +505,7 @@ class AlterModelTable(ModelOptionOperation):
new_model._meta.db_table,
)
# Rename M2M fields whose name is based on this model's db_table
- for (old_field, new_field) in zip(
+ for old_field, new_field in zip(
old_model._meta.local_many_to_many, new_model._meta.local_many_to_many
):
if new_field.remote_field.through._meta.auto_created:
diff --git a/django/db/models/expressions.py b/django/db/models/expressions.py
index 21a49bc229..2d8a5c5919 100644
--- a/django/db/models/expressions.py
+++ b/django/db/models/expressions.py
@@ -1106,7 +1106,6 @@ class Star(Expression):
class Col(Expression):
-
contains_column_references = True
possibly_multivalued = False
diff --git a/django/db/models/fields/files.py b/django/db/models/fields/files.py
index 04b3eb3473..7f8eb128e1 100644
--- a/django/db/models/fields/files.py
+++ b/django/db/models/fields/files.py
@@ -222,7 +222,6 @@ class FileDescriptor(DeferredAttribute):
class FileField(Field):
-
# The class to wrap instance attributes in. Accessing the file object off
# the instance will always return an instance of attr_class.
attr_class = FieldFile
diff --git a/django/db/models/fields/related.py b/django/db/models/fields/related.py
index ad1f15c426..b31fee7e89 100644
--- a/django/db/models/fields/related.py
+++ b/django/db/models/fields/related.py
@@ -344,7 +344,6 @@ class RelatedField(FieldCacheMixin, Field):
return None
def contribute_to_class(self, cls, name, private_only=False, **kwargs):
-
super().contribute_to_class(cls, name, private_only=private_only, **kwargs)
self.opts = cls._meta
@@ -541,7 +540,6 @@ class ForeignObject(RelatedField):
swappable=True,
**kwargs,
):
-
if rel is None:
rel = self.rel_class(
self,
@@ -1616,7 +1614,6 @@ class ManyToManyField(RelatedField):
(source_field_name, source),
(target_field_name, target),
):
-
possible_field_names = []
for f in through._meta.fields:
if (
diff --git a/django/db/models/options.py b/django/db/models/options.py
index 607b19fb8a..be3d68f390 100644
--- a/django/db/models/options.py
+++ b/django/db/models/options.py
@@ -528,6 +528,7 @@ class Options:
combined with filtering of field properties is the public API for
obtaining this field list.
"""
+
# For legacy reasons, the fields property should only contain forward
# fields that are not private or with a m2m cardinality. Therefore we
# pass these three filters as filters to the generator.
diff --git a/django/db/models/query.py b/django/db/models/query.py
index f88662de12..9d621c4f69 100644
--- a/django/db/models/query.py
+++ b/django/db/models/query.py
@@ -2110,7 +2110,7 @@ class RawQuerySet:
"""
columns = self.query.get_columns()
# Adjust any column names which don't match field names
- for (query_name, model_name) in self.translations.items():
+ for query_name, model_name in self.translations.items():
# Ignore translations for nonexistent column names
try:
index = columns.index(query_name)