From aa12cf07c9202e117712abe2621d901dd6dd94b4 Mon Sep 17 00:00:00 2001 From: Jon Dufresne Date: Mon, 18 Nov 2019 23:29:47 -0800 Subject: [PATCH] Removed unnecessary numeric indexes in format strings. --- django/contrib/auth/mixins.py | 2 +- django/template/defaulttags.py | 2 +- django/test/client.py | 2 +- tests/admin_widgets/tests.py | 2 +- tests/db_functions/models.py | 2 +- tests/gis_tests/gdal_tests/test_raster.py | 2 +- tests/template_tests/templatetags/custom.py | 4 ++-- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/django/contrib/auth/mixins.py b/django/contrib/auth/mixins.py index 362a734f96b4..e83e0ee8054a 100644 --- a/django/contrib/auth/mixins.py +++ b/django/contrib/auth/mixins.py @@ -93,7 +93,7 @@ class UserPassesTestMixin(AccessMixin): def test_func(self): raise NotImplementedError( - '{0} is missing the implementation of the test_func() method.'.format(self.__class__.__name__) + '{} is missing the implementation of the test_func() method.'.format(self.__class__.__name__) ) def get_test_func(self): diff --git a/django/template/defaulttags.py b/django/template/defaulttags.py index 602e8b2a15e0..d010bc75600c 100644 --- a/django/template/defaulttags.py +++ b/django/template/defaulttags.py @@ -970,7 +970,7 @@ def do_if(parser, token): # {% endif %} if token.contents != 'endif': - raise TemplateSyntaxError('Malformed template tag at line {0}: "{1}"'.format(token.lineno, token.contents)) + raise TemplateSyntaxError('Malformed template tag at line {}: "{}"'.format(token.lineno, token.contents)) return IfNode(conditions_nodelists) diff --git a/django/test/client.py b/django/test/client.py index 0a683f50262c..34fc9f3cf116 100644 --- a/django/test/client.py +++ b/django/test/client.py @@ -656,7 +656,7 @@ def _parse_json(self, response, **extra): if not hasattr(response, '_json'): if not JSON_CONTENT_TYPE_RE.match(response.get('Content-Type')): raise ValueError( - 'Content-Type header is "{0}", not "application/json"' + 'Content-Type header is "{}", not "application/json"' .format(response.get('Content-Type')) ) response._json = json.loads(response.content.decode(response.charset), **extra) diff --git a/tests/admin_widgets/tests.py b/tests/admin_widgets/tests.py index 7aa597a87dcc..2bbf176ec3f9 100644 --- a/tests/admin_widgets/tests.py +++ b/tests/admin_widgets/tests.py @@ -883,7 +883,7 @@ def test_calendar_show_date_from_input(self): # Get the expected caption may_translation = month_name - expected_caption = '{0:s} {1:d}'.format(may_translation.upper(), 1984) + expected_caption = '{:s} {:d}'.format(may_translation.upper(), 1984) # Test with every locale with override_settings(LANGUAGE_CODE=language_code, USE_L10N=True): diff --git a/tests/db_functions/models.py b/tests/db_functions/models.py index 083655e80f5a..0deea8f54c9e 100644 --- a/tests/db_functions/models.py +++ b/tests/db_functions/models.py @@ -49,7 +49,7 @@ class DTModel(models.Model): duration = models.DurationField(null=True, blank=True) def __str__(self): - return 'DTModel({0})'.format(self.name) + return 'DTModel({})'.format(self.name) class DecimalModel(models.Model): diff --git a/tests/gis_tests/gdal_tests/test_raster.py b/tests/gis_tests/gdal_tests/test_raster.py index a8801e88dd8f..f3477181b49b 100644 --- a/tests/gis_tests/gdal_tests/test_raster.py +++ b/tests/gis_tests/gdal_tests/test_raster.py @@ -319,7 +319,7 @@ def test_raster_info_accessor(self): return gdalinfo = """ Driver: GTiff/GeoTIFF - Files: {0} + Files: {} Size is 163, 174 Coordinate System is: PROJCS["NAD83 / Florida GDL Albers", diff --git a/tests/template_tests/templatetags/custom.py b/tests/template_tests/templatetags/custom.py index eaaff193eed4..a5e1b33c67c0 100644 --- a/tests/template_tests/templatetags/custom.py +++ b/tests/template_tests/templatetags/custom.py @@ -153,13 +153,13 @@ def simple_tag_without_context_parameter(arg): @register.simple_tag(takes_context=True) def escape_naive(context): """A tag that doesn't even think about escaping issues""" - return "Hello {0}!".format(context['name']) + return "Hello {}!".format(context['name']) @register.simple_tag(takes_context=True) def escape_explicit(context): """A tag that uses escape explicitly""" - return escape("Hello {0}!".format(context['name'])) + return escape("Hello {}!".format(context['name'])) @register.simple_tag(takes_context=True)