1
0
mirror of https://github.com/django/django.git synced 2024-12-22 17:16:24 +00:00

Removed unnecessary tuple wrapping of single format string argument.

This commit is contained in:
François Freitag 2020-04-25 15:53:30 +02:00 committed by Mariusz Felisiak
parent 687cb38a05
commit abea86f9e4
12 changed files with 15 additions and 15 deletions

View File

@ -75,7 +75,7 @@ class AppConfig:
raise ImproperlyConfigured( raise ImproperlyConfigured(
"The app module %r has no filesystem location, " "The app module %r has no filesystem location, "
"you must configure this app with an AppConfig subclass " "you must configure this app with an AppConfig subclass "
"with a 'path' class attribute." % (module,)) "with a 'path' class attribute." % module)
return paths[0] return paths[0]
@classmethod @classmethod

View File

@ -28,6 +28,6 @@ class InclusionAdminNode(InclusionNode):
context.render_context[self] = context.template.engine.select_template([ context.render_context[self] = context.template.engine.select_template([
'admin/%s/%s/%s' % (app_label, object_name, self.template_name), 'admin/%s/%s/%s' % (app_label, object_name, self.template_name),
'admin/%s/%s' % (app_label, 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) return super().render(context)

View File

@ -337,7 +337,7 @@ def label_for_field(name, model, model_admin=None, return_attr=False, form=None)
else: else:
message = "Unable to lookup '%s' on %s" % (name, model._meta.object_name) message = "Unable to lookup '%s' on %s" % (name, model._meta.object_name)
if model_admin: if model_admin:
message += " or %s" % (model_admin.__class__.__name__,) message += " or %s" % model_admin.__class__.__name__
if form: if form:
message += " or %s" % form.__class__.__name__ message += " or %s" % form.__class__.__name__
raise AttributeError(message) raise AttributeError(message)

View File

@ -203,7 +203,7 @@ class Command(BaseCommand):
migration_string = writer.path migration_string = writer.path
if migration_string.startswith('..'): if migration_string.startswith('..'):
migration_string = writer.path 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: for operation in migration.operations:
self.stdout.write(" - %s\n" % operation.describe()) self.stdout.write(" - %s\n" % operation.describe())
if not self.dry_run: if not self.dry_run:

View File

@ -189,7 +189,7 @@ class Command(BaseCommand):
else: else:
if targets[0][1] is None: if targets[0][1] is None:
self.stdout.write(self.style.MIGRATE_LABEL( self.stdout.write(self.style.MIGRATE_LABEL(
" Unapply all migrations: ") + "%s" % (targets[0][0],) " Unapply all migrations: ") + "%s" % targets[0][0]
) )
else: else:
self.stdout.write(self.style.MIGRATE_LABEL( self.stdout.write(self.style.MIGRATE_LABEL(

View File

@ -221,7 +221,7 @@ class Field(RegisterLookupMixin):
elif LOOKUP_SEP in self.name: elif LOOKUP_SEP in self.name:
return [ return [
checks.Error( checks.Error(
'Field names must not contain "%s".' % (LOOKUP_SEP,), 'Field names must not contain "%s".' % LOOKUP_SEP,
obj=self, obj=self,
id='fields.E002', id='fields.E002',
) )

View File

@ -133,7 +133,7 @@ class RelatedField(FieldCacheMixin, Field):
errors.append( errors.append(
checks.Error( checks.Error(
"Reverse query name '%s' must not end with an underscore." "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 " hint=("Add or change a related_name or related_query_name "
"argument for this field."), "argument for this field."),
obj=self, obj=self,

View File

@ -670,7 +670,7 @@ class URLResolver:
if args: if args:
arg_msg = "arguments '%s'" % (args,) arg_msg = "arguments '%s'" % (args,)
elif kwargs: elif kwargs:
arg_msg = "keyword arguments '%s'" % (kwargs,) arg_msg = "keyword arguments '%s'" % kwargs
else: else:
arg_msg = "no arguments" arg_msg = "no arguments"
msg = ( msg = (

View File

@ -100,7 +100,7 @@ def strftime(dt, fmt):
sites.append(site) sites.append(site)
s = s1 s = s1
syear = "%04d" % (dt.year,) syear = "%04d" % dt.year
for site in sites: for site in sites:
s = s[:site] + syear + s[site + 4:] s = s[:site] + syear + s[site + 4:]
return s return s

View File

@ -5502,7 +5502,7 @@ class DateHierarchyTests(TestCase):
self.assertNotContains(response, formats.number_format(year)) self.assertNotContains(response, formats.number_format(year))
def assert_contains_year_link(self, response, date): 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): def assert_contains_month_link(self, response, date):
self.assertContains( self.assertContains(
@ -5619,7 +5619,7 @@ class DateHierarchyTests(TestCase):
response = self.client.get(reverse('admin:admin_views_answer_changelist')) response = self.client.get(reverse('admin:admin_views_answer_changelist'))
for date, answer_count in questions_data: 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: if answer_count > 0:
self.assertContains(response, link) self.assertContains(response, link)
else: else:

View File

@ -9,4 +9,4 @@ class UnimportantThing(models.Model):
importance = models.IntegerField() importance = models.IntegerField()
def get_absolute_url(self): def get_absolute_url(self):
return '/importance/%d/' % (self.importance,) return '/importance/%d/' % self.importance

View File

@ -22,7 +22,7 @@ class UserStatResult(models.Model):
results = models.CharField(max_length=50) results = models.CharField(max_length=50)
def __str__(self): def __str__(self):
return 'UserStatResults, results = %s' % (self.results,) return 'UserStatResults, results = %s' % self.results
class UserStat(models.Model): class UserStat(models.Model):
@ -31,7 +31,7 @@ class UserStat(models.Model):
results = models.ForeignKey(UserStatResult, models.CASCADE) results = models.ForeignKey(UserStatResult, models.CASCADE)
def __str__(self): def __str__(self):
return 'UserStat, posts = %s' % (self.posts,) return 'UserStat, posts = %s' % self.posts
class StatDetails(models.Model): class StatDetails(models.Model):
@ -39,7 +39,7 @@ class StatDetails(models.Model):
comments = models.IntegerField() comments = models.IntegerField()
def __str__(self): def __str__(self):
return 'StatDetails, comments = %s' % (self.comments,) return 'StatDetails, comments = %s' % self.comments
class AdvancedUserStat(UserStat): class AdvancedUserStat(UserStat):