summaryrefslogtreecommitdiff
path: root/django/db/backends/sqlite3
diff options
context:
space:
mode:
authordjango-bot <ops@djangoproject.com>2025-07-22 20:41:41 -0700
committernessita <124304+nessita@users.noreply.github.com>2025-07-23 20:17:55 -0300
commit69a93a88edb56ba47f624dac7a21aacc47ea474f (patch)
treef57507a4435d032493cae40e06ecb254790b67b2 /django/db/backends/sqlite3
parent55b0cc21310b76ce4018dd793ba50556eaf0af06 (diff)
Refs #36500 -- Rewrapped long docstrings and block comments via a script.
Rewrapped long docstrings and block comments to 79 characters + newline using script from https://github.com/medmunds/autofix-w505.
Diffstat (limited to 'django/db/backends/sqlite3')
-rw-r--r--django/db/backends/sqlite3/base.py18
-rw-r--r--django/db/backends/sqlite3/schema.py17
2 files changed, 18 insertions, 17 deletions
diff --git a/django/db/backends/sqlite3/base.py b/django/db/backends/sqlite3/base.py
index f7b65651b3..e378975207 100644
--- a/django/db/backends/sqlite3/base.py
+++ b/django/db/backends/sqlite3/base.py
@@ -60,9 +60,9 @@ Database.register_adapter(datetime.datetime, adapt_datetime)
class DatabaseWrapper(BaseDatabaseWrapper):
vendor = "sqlite"
display_name = "SQLite"
- # SQLite doesn't actually support most of these types, but it "does the right
- # thing" given more verbose field definitions, so leave them as is so that
- # schema inspection is more useful.
+ # SQLite doesn't actually support most of these types, but it "does the
+ # right thing" given more verbose field definitions, so leave them as is so
+ # that schema inspection is more useful.
data_types = {
"AutoField": "integer",
"BigAutoField": "integer",
@@ -124,13 +124,13 @@ class DatabaseWrapper(BaseDatabaseWrapper):
}
# The patterns below are used to generate SQL pattern lookup clauses when
- # the right-hand side of the lookup isn't a raw string (it might be an expression
- # or the result of a bilateral transformation).
- # In those cases, special characters for LIKE operators (e.g. \, *, _) should be
- # escaped on database side.
+ # the right-hand side of the lookup isn't a raw string (it might be an
+ # expression or the result of a bilateral transformation). In those cases,
+ # special characters for LIKE operators (e.g. \, *, _) should be escaped on
+ # database side.
#
- # Note: we use str.format() here for readability as '%' is used as a wildcard for
- # the LIKE operator.
+ # Note: we use str.format() here for readability as '%' is used as a
+ # wildcard for the LIKE operator.
pattern_esc = r"REPLACE(REPLACE(REPLACE({}, '\', '\\'), '%%', '\%%'), '_', '\_')"
pattern_ops = {
"contains": r"LIKE '%%' || {} || '%%' ESCAPE '\'",
diff --git a/django/db/backends/sqlite3/schema.py b/django/db/backends/sqlite3/schema.py
index 10edfd81b9..ac6ae5efbd 100644
--- a/django/db/backends/sqlite3/schema.py
+++ b/django/db/backends/sqlite3/schema.py
@@ -206,9 +206,9 @@ class DatabaseSchemaEditor(BaseDatabaseSchemaEditor):
# Construct a new model with the new fields to allow self referential
# primary key to resolve to. This model won't ever be materialized as a
- # table and solely exists for foreign key reference resolution purposes.
- # This wouldn't be required if the schema editor was operating on model
- # states instead of rendered models.
+ # table and solely exists for foreign key reference resolution
+ # purposes. This wouldn't be required if the schema editor was
+ # operating on model states instead of rendered models.
meta_contents = {
"app_label": model._meta.app_label,
"db_table": model._meta.db_table,
@@ -303,10 +303,10 @@ class DatabaseSchemaEditor(BaseDatabaseSchemaEditor):
if field.many_to_many and field.remote_field.through._meta.auto_created:
self.create_model(field.remote_field.through)
elif isinstance(field, CompositePrimaryKey):
- # If a CompositePrimaryKey field was added, the existing primary key field
- # had to be altered too, resulting in an AddField, AlterField migration.
- # The table cannot be re-created on AddField, it would result in a
- # duplicate primary key error.
+ # If a CompositePrimaryKey field was added, the existing primary
+ # key field had to be altered too, resulting in an AddField,
+ # AlterField migration. The table cannot be re-created on AddField,
+ # it would result in a duplicate primary key error.
return
elif (
# Primary keys and unique fields are not supported in ALTER TABLE
@@ -404,7 +404,8 @@ class DatabaseSchemaEditor(BaseDatabaseSchemaEditor):
related_models.add(remote_field.through)
if new_field.primary_key:
for many_to_many in opts.many_to_many:
- # Ignore self-relationship since the table was already rebuilt.
+ # Ignore self-relationship since the table was already
+ # rebuilt.
if many_to_many.related_model == model:
continue
if many_to_many.remote_field.through._meta.auto_created: