diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index cd2366d560..b9ef3dd693 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -9,7 +9,7 @@ repos:
hooks:
- id: isort
- repo: https://github.com/PyCQA/flake8
- rev: 4.0.1
+ rev: 5.0.0
hooks:
- id: flake8
- repo: https://github.com/pre-commit/mirrors-eslint
diff --git a/django/contrib/contenttypes/management/commands/remove_stale_contenttypes.py b/django/contrib/contenttypes/management/commands/remove_stale_contenttypes.py
index 3002ceaf53..eccd3aa2c9 100644
--- a/django/contrib/contenttypes/management/commands/remove_stale_contenttypes.py
+++ b/django/contrib/contenttypes/management/commands/remove_stale_contenttypes.py
@@ -72,18 +72,18 @@ class Command(BaseCommand):
)
content_type_display = "\n".join(ct_info)
self.stdout.write(
- """Some content types in your database are stale and can be deleted.
-Any objects that depend on these content types will also be deleted.
-The content types and dependent objects that would be deleted are:
-
-%s
-
-This list doesn't include any cascade deletions to data outside of Django's
-models (uncommon).
-
-Are you sure you want to delete these content types?
-If you're unsure, answer 'no'."""
- % content_type_display
+ "Some content types in your database are stale and can be "
+ "deleted.\n"
+ "Any objects that depend on these content types will also be "
+ "deleted.\n"
+ "The content types and dependent objects that would be deleted "
+ "are:\n\n"
+ f"{content_type_display}\n\n"
+ "This list doesn't include any cascade deletions to data "
+ "outside of Django's\n"
+ "models (uncommon).\n\n"
+ "Are you sure you want to delete these content types?\n"
+ "If you're unsure, answer 'no'."
)
ok_to_delete = input("Type 'yes' to continue, or 'no' to cancel: ")
else:
diff --git a/tests/admin_views/tests.py b/tests/admin_views/tests.py
index 11b8aff346..88468e883c 100644
--- a/tests/admin_views/tests.py
+++ b/tests/admin_views/tests.py
@@ -803,8 +803,9 @@ class AdminViewBasicTest(AdminViewBasicTestCase):
self.assertIs(response.context["cl"].has_related_field_in_list_display(), False)
def test_limited_filter(self):
- """Ensure admin changelist filters do not contain objects excluded via limit_choices_to.
- This also tests relation-spanning filters (e.g. 'color__value').
+ """
+ Admin changelist filters do not contain objects excluded via
+ limit_choices_to.
"""
response = self.client.get(reverse("admin:admin_views_thing_changelist"))
self.assertContains(
diff --git a/tests/forms_tests/tests/test_forms.py b/tests/forms_tests/tests/test_forms.py
index ec911ee961..6005472194 100644
--- a/tests/forms_tests/tests/test_forms.py
+++ b/tests/forms_tests/tests/test_forms.py
@@ -130,9 +130,12 @@ class FormsTestCase(SimpleTestCase):
self.assertHTMLEqual(
"\n".join(form_output),
- """
-
-""",
+ '"
+ '"
+ '",
)
form_output = []
@@ -893,10 +896,12 @@ class FormsTestCase(SimpleTestCase):
f = BeatleForm(auto_id=False)
self.assertHTMLEqual(
"\n".join(str(bf) for bf in f["name"]),
- """
-
-
-""",
+ ''
+ ''
+ '"
+ '",
)
self.assertHTMLEqual(
"\n".join("
%s
" % bf for bf in f["name"]),
@@ -2229,8 +2234,10 @@ class FormsTestCase(SimpleTestCase):
p = UserRegistration(auto_id=False)
self.assertHTMLEqual(
p.as_ul(),
- """
Username:
-
Password:
""",
+ '
Username: '
+ "
"
+ '
Password:
",
)
def test_specifying_labels(self):
@@ -2320,8 +2327,9 @@ class FormsTestCase(SimpleTestCase):
p = UserRegistration(auto_id=False)
self.assertHTMLEqual(
p.as_ul(),
- """