From abea86f9e44a8eda9ad1859fe05a91509bdb8011 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Freitag?= Date: Sat, 25 Apr 2020 15:53:30 +0200 Subject: [PATCH] Removed unnecessary tuple wrapping of single format string argument. --- django/apps/config.py | 2 +- django/contrib/admin/templatetags/base.py | 2 +- django/contrib/admin/utils.py | 2 +- django/core/management/commands/makemigrations.py | 2 +- django/core/management/commands/migrate.py | 2 +- django/db/models/fields/__init__.py | 2 +- django/db/models/fields/related.py | 2 +- django/urls/resolvers.py | 2 +- django/utils/datetime_safe.py | 2 +- tests/admin_views/tests.py | 4 ++-- tests/resolve_url/models.py | 2 +- tests/select_related_onetoone/models.py | 6 +++--- 12 files changed, 15 insertions(+), 15 deletions(-) diff --git a/django/apps/config.py b/django/apps/config.py index f5c971fc9c..2728503d62 100644 --- a/django/apps/config.py +++ b/django/apps/config.py @@ -75,7 +75,7 @@ class AppConfig: raise ImproperlyConfigured( "The app module %r has no filesystem location, " "you must configure this app with an AppConfig subclass " - "with a 'path' class attribute." % (module,)) + "with a 'path' class attribute." % module) return paths[0] @classmethod diff --git a/django/contrib/admin/templatetags/base.py b/django/contrib/admin/templatetags/base.py index ec6f10378d..e98604ac5a 100644 --- a/django/contrib/admin/templatetags/base.py +++ b/django/contrib/admin/templatetags/base.py @@ -28,6 +28,6 @@ class InclusionAdminNode(InclusionNode): context.render_context[self] = context.template.engine.select_template([ 'admin/%s/%s/%s' % (app_label, object_name, self.template_name), 'admin/%s/%s' % (app_label, self.template_name), - 'admin/%s' % (self.template_name,), + 'admin/%s' % self.template_name, ]) return super().render(context) diff --git a/django/contrib/admin/utils.py b/django/contrib/admin/utils.py index 06f85d41f9..e4ddc8f017 100644 --- a/django/contrib/admin/utils.py +++ b/django/contrib/admin/utils.py @@ -337,7 +337,7 @@ def label_for_field(name, model, model_admin=None, return_attr=False, form=None) else: message = "Unable to lookup '%s' on %s" % (name, model._meta.object_name) if model_admin: - message += " or %s" % (model_admin.__class__.__name__,) + message += " or %s" % model_admin.__class__.__name__ if form: message += " or %s" % form.__class__.__name__ raise AttributeError(message) diff --git a/django/core/management/commands/makemigrations.py b/django/core/management/commands/makemigrations.py index 3382887ca3..b9d43d097d 100644 --- a/django/core/management/commands/makemigrations.py +++ b/django/core/management/commands/makemigrations.py @@ -203,7 +203,7 @@ class Command(BaseCommand): migration_string = writer.path if migration_string.startswith('..'): migration_string = writer.path - self.stdout.write(" %s\n" % (self.style.MIGRATE_LABEL(migration_string),)) + self.stdout.write(" %s\n" % self.style.MIGRATE_LABEL(migration_string)) for operation in migration.operations: self.stdout.write(" - %s\n" % operation.describe()) if not self.dry_run: diff --git a/django/core/management/commands/migrate.py b/django/core/management/commands/migrate.py index 85e04b6fcc..315a734d07 100644 --- a/django/core/management/commands/migrate.py +++ b/django/core/management/commands/migrate.py @@ -189,7 +189,7 @@ class Command(BaseCommand): else: if targets[0][1] is None: self.stdout.write(self.style.MIGRATE_LABEL( - " Unapply all migrations: ") + "%s" % (targets[0][0],) + " Unapply all migrations: ") + "%s" % targets[0][0] ) else: self.stdout.write(self.style.MIGRATE_LABEL( diff --git a/django/db/models/fields/__init__.py b/django/db/models/fields/__init__.py index d00942a7b8..08c2a18d94 100644 --- a/django/db/models/fields/__init__.py +++ b/django/db/models/fields/__init__.py @@ -221,7 +221,7 @@ class Field(RegisterLookupMixin): elif LOOKUP_SEP in self.name: return [ checks.Error( - 'Field names must not contain "%s".' % (LOOKUP_SEP,), + 'Field names must not contain "%s".' % LOOKUP_SEP, obj=self, id='fields.E002', ) diff --git a/django/db/models/fields/related.py b/django/db/models/fields/related.py index 5ce7fac420..d517d7269b 100644 --- a/django/db/models/fields/related.py +++ b/django/db/models/fields/related.py @@ -133,7 +133,7 @@ class RelatedField(FieldCacheMixin, Field): errors.append( checks.Error( "Reverse query name '%s' must not end with an underscore." - % (rel_query_name,), + % rel_query_name, hint=("Add or change a related_name or related_query_name " "argument for this field."), obj=self, diff --git a/django/urls/resolvers.py b/django/urls/resolvers.py index 3c95e1d686..fbe5a0fdb5 100644 --- a/django/urls/resolvers.py +++ b/django/urls/resolvers.py @@ -670,7 +670,7 @@ class URLResolver: if args: arg_msg = "arguments '%s'" % (args,) elif kwargs: - arg_msg = "keyword arguments '%s'" % (kwargs,) + arg_msg = "keyword arguments '%s'" % kwargs else: arg_msg = "no arguments" msg = ( diff --git a/django/utils/datetime_safe.py b/django/utils/datetime_safe.py index ade2dca610..7edd96f2f1 100644 --- a/django/utils/datetime_safe.py +++ b/django/utils/datetime_safe.py @@ -100,7 +100,7 @@ def strftime(dt, fmt): sites.append(site) s = s1 - syear = "%04d" % (dt.year,) + syear = "%04d" % dt.year for site in sites: s = s[:site] + syear + s[site + 4:] return s diff --git a/tests/admin_views/tests.py b/tests/admin_views/tests.py index 37818f7f65..da00615310 100644 --- a/tests/admin_views/tests.py +++ b/tests/admin_views/tests.py @@ -5502,7 +5502,7 @@ class DateHierarchyTests(TestCase): self.assertNotContains(response, formats.number_format(year)) def assert_contains_year_link(self, response, date): - self.assertContains(response, '?release_date__year=%d"' % (date.year,)) + self.assertContains(response, '?release_date__year=%d"' % date.year) def assert_contains_month_link(self, response, date): self.assertContains( @@ -5619,7 +5619,7 @@ class DateHierarchyTests(TestCase): response = self.client.get(reverse('admin:admin_views_answer_changelist')) for date, answer_count in questions_data: - link = '?question__posted__year=%d"' % (date.year,) + link = '?question__posted__year=%d"' % date.year if answer_count > 0: self.assertContains(response, link) else: diff --git a/tests/resolve_url/models.py b/tests/resolve_url/models.py index 238902edd2..1477bef685 100644 --- a/tests/resolve_url/models.py +++ b/tests/resolve_url/models.py @@ -9,4 +9,4 @@ class UnimportantThing(models.Model): importance = models.IntegerField() def get_absolute_url(self): - return '/importance/%d/' % (self.importance,) + return '/importance/%d/' % self.importance diff --git a/tests/select_related_onetoone/models.py b/tests/select_related_onetoone/models.py index 0a20cc7375..a1852f421e 100644 --- a/tests/select_related_onetoone/models.py +++ b/tests/select_related_onetoone/models.py @@ -22,7 +22,7 @@ class UserStatResult(models.Model): results = models.CharField(max_length=50) def __str__(self): - return 'UserStatResults, results = %s' % (self.results,) + return 'UserStatResults, results = %s' % self.results class UserStat(models.Model): @@ -31,7 +31,7 @@ class UserStat(models.Model): results = models.ForeignKey(UserStatResult, models.CASCADE) def __str__(self): - return 'UserStat, posts = %s' % (self.posts,) + return 'UserStat, posts = %s' % self.posts class StatDetails(models.Model): @@ -39,7 +39,7 @@ class StatDetails(models.Model): comments = models.IntegerField() def __str__(self): - return 'StatDetails, comments = %s' % (self.comments,) + return 'StatDetails, comments = %s' % self.comments class AdvancedUserStat(UserStat):