1
0
mirror of https://github.com/django/django.git synced 2024-12-22 09:05:43 +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(
"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

View File

@ -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)

View File

@ -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)

View File

@ -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:

View File

@ -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(

View File

@ -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',
)

View File

@ -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,

View File

@ -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 = (

View File

@ -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

View File

@ -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:

View File

@ -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

View File

@ -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):