diff --git a/django/contrib/admin/filters.py b/django/contrib/admin/filters.py
index 5f9d69dee4..243bad8247 100644
--- a/django/contrib/admin/filters.py
+++ b/django/contrib/admin/filters.py
@@ -242,7 +242,7 @@ class BooleanFieldListFilter(FieldListFilter):
'selected': self.lookup_val == lookup and not self.lookup_val2,
'query_string': cl.get_query_string({
self.lookup_kwarg: lookup,
- }, [self.lookup_kwarg2]),
+ }, [self.lookup_kwarg2]),
'display': title,
}
if isinstance(self.field, models.NullBooleanField):
@@ -250,7 +250,7 @@ class BooleanFieldListFilter(FieldListFilter):
'selected': self.lookup_val2 == 'True',
'query_string': cl.get_query_string({
self.lookup_kwarg2: 'True',
- }, [self.lookup_kwarg]),
+ }, [self.lookup_kwarg]),
'display': _('Unknown'),
}
diff --git a/django/contrib/admin/options.py b/django/contrib/admin/options.py
index 6d3195a868..8ee4ed3fbc 100644
--- a/django/contrib/admin/options.py
+++ b/django/contrib/admin/options.py
@@ -1200,7 +1200,7 @@ class ModelAdmin(BaseModelAdmin):
'The %(name)s "%(obj)s" was deleted successfully.') % {
'name': force_text(opts.verbose_name),
'obj': force_text(obj_display)
- }, messages.SUCCESS)
+ }, messages.SUCCESS)
if self.has_change_permission(request, None):
post_url = reverse('admin:%s_%s_changelist' %
diff --git a/django/contrib/auth/management/commands/changepassword.py b/django/contrib/auth/management/commands/changepassword.py
index 3240b0f992..deb89ef1d4 100644
--- a/django/contrib/auth/management/commands/changepassword.py
+++ b/django/contrib/auth/management/commands/changepassword.py
@@ -35,7 +35,7 @@ class Command(BaseCommand):
try:
u = UserModel._default_manager.using(options.get('database')).get(**{
UserModel.USERNAME_FIELD: username
- })
+ })
except UserModel.DoesNotExist:
raise CommandError("user '%s' does not exist" % username)
diff --git a/django/contrib/auth/tests/test_forms.py b/django/contrib/auth/tests/test_forms.py
index 718e8fff18..430bac1b05 100644
--- a/django/contrib/auth/tests/test_forms.py
+++ b/django/contrib/auth/tests/test_forms.py
@@ -32,7 +32,7 @@ class UserCreationFormTest(TestCase):
'username': 'testclient',
'password1': 'test123',
'password2': 'test123',
- }
+ }
form = UserCreationForm(data)
self.assertFalse(form.is_valid())
self.assertEqual(form["username"].errors,
@@ -43,7 +43,7 @@ class UserCreationFormTest(TestCase):
'username': 'jsmith!',
'password1': 'test123',
'password2': 'test123',
- }
+ }
form = UserCreationForm(data)
self.assertFalse(form.is_valid())
self.assertEqual(form["username"].errors,
@@ -55,7 +55,7 @@ class UserCreationFormTest(TestCase):
'username': 'jsmith',
'password1': 'test123',
'password2': 'test',
- }
+ }
form = UserCreationForm(data)
self.assertFalse(form.is_valid())
self.assertEqual(form["password2"].errors,
@@ -82,7 +82,7 @@ class UserCreationFormTest(TestCase):
'username': 'jsmith@example.com',
'password1': 'test123',
'password2': 'test123',
- }
+ }
form = UserCreationForm(data)
self.assertTrue(form.is_valid())
u = form.save()
@@ -101,7 +101,7 @@ class AuthenticationFormTest(TestCase):
data = {
'username': 'jsmith_does_not_exist',
'password': 'test123',
- }
+ }
form = AuthenticationForm(None, data)
self.assertFalse(form.is_valid())
self.assertEqual(form.non_field_errors(),
@@ -114,7 +114,7 @@ class AuthenticationFormTest(TestCase):
data = {
'username': 'inactive',
'password': 'password',
- }
+ }
form = AuthenticationForm(None, data)
self.assertFalse(form.is_valid())
self.assertEqual(form.non_field_errors(),
@@ -126,7 +126,7 @@ class AuthenticationFormTest(TestCase):
data = {
'username': 'inactive',
'password': 'password',
- }
+ }
form = AuthenticationForm(None, data)
self.assertFalse(form.is_valid())
self.assertEqual(form.non_field_errors(),
@@ -137,7 +137,7 @@ class AuthenticationFormTest(TestCase):
data = {
'username': 'inactive',
'password': 'password',
- }
+ }
class AuthenticationFormWithInactiveUsersOkay(AuthenticationForm):
def confirm_login_allowed(self, user):
@@ -161,7 +161,7 @@ class AuthenticationFormTest(TestCase):
data = {
'username': 'testclient',
'password': 'password',
- }
+ }
form = PickyAuthenticationForm(None, data)
self.assertFalse(form.is_valid())
self.assertEqual(form.non_field_errors(), ["Sorry, nobody's allowed in."])
@@ -171,7 +171,7 @@ class AuthenticationFormTest(TestCase):
data = {
'username': 'testclient',
'password': 'password',
- }
+ }
form = AuthenticationForm(None, data)
self.assertTrue(form.is_valid())
self.assertEqual(form.non_field_errors(), [])
@@ -215,7 +215,7 @@ class SetPasswordFormTest(TestCase):
data = {
'new_password1': 'abc123',
'new_password2': 'abc',
- }
+ }
form = SetPasswordForm(user, data)
self.assertFalse(form.is_valid())
self.assertEqual(form["new_password2"].errors,
@@ -226,7 +226,7 @@ class SetPasswordFormTest(TestCase):
data = {
'new_password1': 'abc123',
'new_password2': 'abc123',
- }
+ }
form = SetPasswordForm(user, data)
self.assertTrue(form.is_valid())
@@ -243,7 +243,7 @@ class PasswordChangeFormTest(TestCase):
'old_password': 'test',
'new_password1': 'abc123',
'new_password2': 'abc123',
- }
+ }
form = PasswordChangeForm(user, data)
self.assertFalse(form.is_valid())
self.assertEqual(form["old_password"].errors,
@@ -256,7 +256,7 @@ class PasswordChangeFormTest(TestCase):
'old_password': 'password',
'new_password1': 'abc123',
'new_password2': 'abc',
- }
+ }
form = PasswordChangeForm(user, data)
self.assertFalse(form.is_valid())
self.assertEqual(form["new_password2"].errors,
@@ -269,7 +269,7 @@ class PasswordChangeFormTest(TestCase):
'old_password': 'password',
'new_password1': 'abc123',
'new_password2': 'abc123',
- }
+ }
form = PasswordChangeForm(user, data)
self.assertTrue(form.is_valid())
diff --git a/django/contrib/auth/tests/test_views.py b/django/contrib/auth/tests/test_views.py
index dc2e985248..0190d1d3d4 100644
--- a/django/contrib/auth/tests/test_views.py
+++ b/django/contrib/auth/tests/test_views.py
@@ -49,7 +49,7 @@ class AuthViewsTestCase(TestCase):
response = self.client.post('/login/', {
'username': 'testclient',
'password': password,
- })
+ })
self.assertTrue(SESSION_KEY in self.client.session)
return response
@@ -180,7 +180,7 @@ class PasswordResetTest(AuthViewsTestCase):
response = self.client.post('/password_reset/',
{'email': 'staffmember@example.com'},
HTTP_HOST='www.example:dr.frankenstein@evil.tld'
- )
+ )
self.assertEqual(response.status_code, 400)
self.assertEqual(len(mail.outbox), 0)
self.assertEqual(len(logger_calls), 1)
@@ -193,7 +193,7 @@ class PasswordResetTest(AuthViewsTestCase):
response = self.client.post('/admin_password_reset/',
{'email': 'staffmember@example.com'},
HTTP_HOST='www.example:dr.frankenstein@evil.tld'
- )
+ )
self.assertEqual(response.status_code, 400)
self.assertEqual(len(mail.outbox), 0)
self.assertEqual(len(logger_calls), 1)
@@ -357,7 +357,7 @@ class ChangePasswordTest(AuthViewsTestCase):
})
self.assertFormError(response, AuthenticationForm.error_messages['invalid_login'] % {
'username': User._meta.get_field('username').verbose_name
- })
+ })
def logout(self):
self.client.get('/logout/')
diff --git a/django/contrib/contenttypes/generic.py b/django/contrib/contenttypes/generic.py
index 241f497590..bffd969f48 100644
--- a/django/contrib/contenttypes/generic.py
+++ b/django/contrib/contenttypes/generic.py
@@ -354,7 +354,7 @@ def create_generic_related_manager(superclass):
'%s__pk' % self.content_type_field_name: self.content_type.id,
'%s__in' % self.object_id_field_name:
set(obj._get_pk_val() for obj in instances)
- }
+ }
qs = super(GenericRelatedObjectManager, self).get_queryset().using(db).filter(**query)
# We (possibly) need to convert object IDs to the type of the
# instances' PK in order to match up instances:
diff --git a/django/contrib/flatpages/tests/test_templatetags.py b/django/contrib/flatpages/tests/test_templatetags.py
index 473abce1b1..b789422a86 100644
--- a/django/contrib/flatpages/tests/test_templatetags.py
+++ b/django/contrib/flatpages/tests/test_templatetags.py
@@ -32,7 +32,7 @@ class FlatpageTemplateTagTests(TestCase):
"{% for page in flatpages %}"
"{{ page.title }},"
"{% endfor %}"
- ).render(Context())
+ ).render(Context())
self.assertEqual(out, "A Flatpage,A Nested Flatpage,")
def test_get_flatpages_tag_for_anon_user(self):
@@ -43,9 +43,9 @@ class FlatpageTemplateTagTests(TestCase):
"{% for page in flatpages %}"
"{{ page.title }},"
"{% endfor %}"
- ).render(Context({
+ ).render(Context({
'anonuser': AnonymousUser()
- }))
+ }))
self.assertEqual(out, "A Flatpage,A Nested Flatpage,")
@skipIfCustomUser
@@ -58,9 +58,9 @@ class FlatpageTemplateTagTests(TestCase):
"{% for page in flatpages %}"
"{{ page.title }},"
"{% endfor %}"
- ).render(Context({
+ ).render(Context({
'me': me
- }))
+ }))
self.assertEqual(out, "A Flatpage,A Nested Flatpage,Sekrit Nested Flatpage,Sekrit Flatpage,")
def test_get_flatpages_with_prefix(self):
@@ -71,7 +71,7 @@ class FlatpageTemplateTagTests(TestCase):
"{% for page in location_flatpages %}"
"{{ page.title }},"
"{% endfor %}"
- ).render(Context())
+ ).render(Context())
self.assertEqual(out, "A Nested Flatpage,")
def test_get_flatpages_with_prefix_for_anon_user(self):
@@ -82,9 +82,9 @@ class FlatpageTemplateTagTests(TestCase):
"{% for page in location_flatpages %}"
"{{ page.title }},"
"{% endfor %}"
- ).render(Context({
+ ).render(Context({
'anonuser': AnonymousUser()
- }))
+ }))
self.assertEqual(out, "A Nested Flatpage,")
@skipIfCustomUser
@@ -97,9 +97,9 @@ class FlatpageTemplateTagTests(TestCase):
"{% for page in location_flatpages %}"
"{{ page.title }},"
"{% endfor %}"
- ).render(Context({
+ ).render(Context({
'me': me
- }))
+ }))
self.assertEqual(out, "A Nested Flatpage,Sekrit Nested Flatpage,")
def test_get_flatpages_with_variable_prefix(self):
@@ -110,9 +110,9 @@ class FlatpageTemplateTagTests(TestCase):
"{% for page in location_flatpages %}"
"{{ page.title }},"
"{% endfor %}"
- ).render(Context({
+ ).render(Context({
'location_prefix': '/location/'
- }))
+ }))
self.assertEqual(out, "A Nested Flatpage,")
def test_parsing_errors(self):
diff --git a/django/contrib/gis/db/backends/oracle/operations.py b/django/contrib/gis/db/backends/oracle/operations.py
index a8f798d300..9eed8632e8 100644
--- a/django/contrib/gis/db/backends/oracle/operations.py
+++ b/django/contrib/gis/db/backends/oracle/operations.py
@@ -114,7 +114,7 @@ class OracleOperations(DatabaseOperations, BaseSpatialOperations):
'distance_lt' : (SDODistance('<'), dtypes),
'distance_lte' : (SDODistance('<='), dtypes),
'dwithin' : (SDODWithin(), dtypes),
- }
+ }
geometry_functions = {
'contains' : SDOOperation('SDO_CONTAINS'),
@@ -129,7 +129,7 @@ class OracleOperations(DatabaseOperations, BaseSpatialOperations):
'relate' : (SDORelate, six.string_types), # Oracle uses a different syntax, e.g., 'mask=inside+touch'
'touches' : SDOOperation('SDO_TOUCH'),
'within' : SDOOperation('SDO_INSIDE'),
- }
+ }
geometry_functions.update(distance_functions)
gis_terms = set(['isnull'])
diff --git a/django/contrib/gis/db/backends/postgis/operations.py b/django/contrib/gis/db/backends/postgis/operations.py
index 41644e377d..1d29b394e0 100644
--- a/django/contrib/gis/db/backends/postgis/operations.py
+++ b/django/contrib/gis/db/backends/postgis/operations.py
@@ -119,7 +119,7 @@ class PostGISOperations(DatabaseOperations, BaseSpatialOperations):
# The "&&" operator returns true if A's bounding box overlaps
# B's bounding box.
'bboverlaps' : PostGISOperator('&&'),
- }
+ }
self.geometry_functions = {
'equals' : PostGISFunction(prefix, 'Equals'),
@@ -256,7 +256,7 @@ class PostGISOperations(DatabaseOperations, BaseSpatialOperations):
'GeoDjango requires at least PostGIS version 1.3. '
'Was the database created from a spatial database '
'template?' % self.connection.settings_dict['NAME']
- )
+ )
version = vtup[1:]
return version
diff --git a/django/contrib/gis/db/backends/spatialite/operations.py b/django/contrib/gis/db/backends/spatialite/operations.py
index d2bbc9f4b9..1ccd8fa610 100644
--- a/django/contrib/gis/db/backends/spatialite/operations.py
+++ b/django/contrib/gis/db/backends/spatialite/operations.py
@@ -103,14 +103,14 @@ class SpatiaLiteOperations(DatabaseOperations, BaseSpatialOperations):
# These are implemented here as synonyms for Equals
'same_as' : SpatiaLiteFunction('Equals'),
'exact' : SpatiaLiteFunction('Equals'),
- }
+ }
distance_functions = {
'distance_gt' : (get_dist_ops('>'), dtypes),
'distance_gte' : (get_dist_ops('>='), dtypes),
'distance_lt' : (get_dist_ops('<'), dtypes),
'distance_lte' : (get_dist_ops('<='), dtypes),
- }
+ }
geometry_functions.update(distance_functions)
def __init__(self, connection):
diff --git a/django/contrib/gis/forms/fields.py b/django/contrib/gis/forms/fields.py
index 5597a07e45..2e75689010 100644
--- a/django/contrib/gis/forms/fields.py
+++ b/django/contrib/gis/forms/fields.py
@@ -24,7 +24,7 @@ class GeometryField(forms.Field):
'invalid_geom_type' : _('Invalid geometry type.'),
'transform_error' : _('An error occurred when transforming the geometry '
'to the SRID of the geometry form field.'),
- }
+ }
def __init__(self, **kwargs):
# Pop out attributes from the database field, or use sensible
diff --git a/django/contrib/gis/management/commands/ogrinspect.py b/django/contrib/gis/management/commands/ogrinspect.py
index 238209123e..af2d585f28 100644
--- a/django/contrib/gis/management/commands/ogrinspect.py
+++ b/django/contrib/gis/management/commands/ogrinspect.py
@@ -67,7 +67,7 @@ class Command(LabelCommand):
'determined, the SRID of the data source is used.'),
make_option('--mapping', action='store_true', dest='mapping',
help='Generate mapping dictionary for use with `LayerMapping`.')
- )
+ )
requires_model_validation = False
diff --git a/django/contrib/gis/measure.py b/django/contrib/gis/measure.py
index c9bc86a26b..3335f8f935 100644
--- a/django/contrib/gis/measure.py
+++ b/django/contrib/gis/measure.py
@@ -252,7 +252,7 @@ class Distance(MeasureBase):
'survey_ft' : 0.304800609601,
'um' : 0.000001,
'yd': 0.9144,
- }
+ }
# Unit aliases for `UNIT` terms encountered in Spatial Reference WKT.
ALIAS = {
@@ -292,7 +292,7 @@ class Distance(MeasureBase):
'U.S. Foot' : 'survey_ft',
'Yard (Indian)' : 'indian_yd',
'Yard (Sears)' : 'sears_yd'
- }
+ }
LALIAS = dict((k.lower(), v) for k, v in ALIAS.items())
def __mul__(self, other):
@@ -305,7 +305,7 @@ class Distance(MeasureBase):
else:
raise TypeError('%(distance)s must be multiplied with number or %(distance)s' % {
"distance" : pretty_name(self.__class__),
- })
+ })
class Area(MeasureBase):
diff --git a/django/contrib/gis/tests/geo3d/tests.py b/django/contrib/gis/tests/geo3d/tests.py
index 3dc8451bac..b528e1faea 100644
--- a/django/contrib/gis/tests/geo3d/tests.py
+++ b/django/contrib/gis/tests/geo3d/tests.py
@@ -51,7 +51,7 @@ interstate_data = (
15.544, 14.975, 15.688, 16.099, 15.197, 17.268, 19.857,
15.435),
),
- )
+)
# Bounding box polygon for inner-loop of Houston (in projected coordinate
# system 32140), with elevation values from the National Elevation Dataset
diff --git a/django/contrib/gis/tests/geoadmin/tests.py b/django/contrib/gis/tests/geoadmin/tests.py
index ebeb22338c..b39b3183dc 100644
--- a/django/contrib/gis/tests/geoadmin/tests.py
+++ b/django/contrib/gis/tests/geoadmin/tests.py
@@ -28,7 +28,7 @@ class GeoAdminTest(TestCase):
def test_olmap_OSM_rendering(self):
geoadmin = admin.site._registry[City]
result = geoadmin.get_map_widget(City._meta.get_field('point'))(
- ).render('point', Point(-79.460734, 40.18476))
+ ).render('point', Point(-79.460734, 40.18476))
self.assertIn(
"""geodjango_point.layers.base = new OpenLayers.Layer.OSM("OpenStreetMap (Mapnik)");""",
result)
@@ -36,7 +36,7 @@ class GeoAdminTest(TestCase):
def test_olmap_WMS_rendering(self):
geoadmin = admin.GeoModelAdmin(City, admin.site)
result = geoadmin.get_map_widget(City._meta.get_field('point'))(
- ).render('point', Point(-79.460734, 40.18476))
+ ).render('point', Point(-79.460734, 40.18476))
self.assertIn(
"""geodjango_point.layers.base = new OpenLayers.Layer.WMS("OpenLayers WMS", "http://vmap0.tiles.osgeo.org/wms/vmap0", {layers: \'basic\', format: 'image/jpeg'});""",
result)
diff --git a/django/contrib/gis/utils/layermapping.py b/django/contrib/gis/utils/layermapping.py
index 4c11f9dbfa..2ce525aa8c 100644
--- a/django/contrib/gis/utils/layermapping.py
+++ b/django/contrib/gis/utils/layermapping.py
@@ -66,7 +66,7 @@ class LayerMapping(object):
models.BigIntegerField : (OFTInteger, OFTReal, OFTString),
models.SmallIntegerField : (OFTInteger, OFTReal, OFTString),
models.PositiveSmallIntegerField : (OFTInteger, OFTReal, OFTString),
- }
+ }
def __init__(self, model, data, mapping, layer=0,
source_srs=None, encoding='utf-8',
diff --git a/django/contrib/messages/tests/base.py b/django/contrib/messages/tests/base.py
index 5ed12a7e46..f5d7a5bf00 100644
--- a/django/contrib/messages/tests/base.py
+++ b/django/contrib/messages/tests/base.py
@@ -359,7 +359,7 @@ class BaseTests(object):
constants.WARNING: '',
constants.ERROR: 'bad',
29: 'custom',
- }
+ }
)
def test_custom_tags(self):
storage = self.get_storage()
diff --git a/django/core/management/commands/loaddata.py b/django/core/management/commands/loaddata.py
index 20ab486489..d28c715930 100644
--- a/django/core/management/commands/loaddata.py
+++ b/django/core/management/commands/loaddata.py
@@ -144,7 +144,7 @@ class Command(BaseCommand):
'object_name': obj.object._meta.object_name,
'pk': obj.object.pk,
'error_msg': force_text(e)
- },)
+ },)
raise
self.loaded_object_count += loaded_objects_in_fixture
diff --git a/django/core/management/templates.py b/django/core/management/templates.py
index 164fd071e5..ea4bd1164b 100644
--- a/django/core/management/templates.py
+++ b/django/core/management/templates.py
@@ -51,7 +51,7 @@ class TemplateCommand(BaseCommand):
help='The file name(s) to render. '
'Separate multiple extensions with commas, or use '
'-n multiple times.')
- )
+ )
requires_model_validation = False
# Can't import settings during this command, because they haven't
# necessarily been created.
diff --git a/django/db/utils.py b/django/db/utils.py
index 3b3799bbd7..5d81fee44b 100644
--- a/django/db/utils.py
+++ b/django/db/utils.py
@@ -82,7 +82,7 @@ class DatabaseErrorWrapper(object):
DatabaseError,
InterfaceError,
Error,
- ):
+ ):
db_exc_type = getattr(self.wrapper.Database, dj_exc_type.__name__)
if issubclass(exc_type, db_exc_type):
dj_exc_value = dj_exc_type(*exc_value.args)
diff --git a/django/forms/formsets.py b/django/forms/formsets.py
index ae424f901a..d1fb136adb 100644
--- a/django/forms/formsets.py
+++ b/django/forms/formsets.py
@@ -147,7 +147,7 @@ class BaseFormSet(object):
'auto_id': self.auto_id,
'prefix': self.add_prefix(i),
'error_class': self.error_class,
- }
+ }
if self.is_bound:
defaults['data'] = self.data
defaults['files'] = self.files
diff --git a/django/forms/models.py b/django/forms/models.py
index 3b01e9b6c7..820a30b667 100644
--- a/django/forms/models.py
+++ b/django/forms/models.py
@@ -688,7 +688,7 @@ class BaseModelFormSet(BaseFormSet):
return ugettext("Please correct the duplicate data for %(field)s, "
"which must be unique.") % {
"field": get_text_list(unique_check, six.text_type(_("and"))),
- }
+ }
def get_date_error_message(self, date_check):
return ugettext("Please correct the duplicate data for %(field_name)s "
diff --git a/django/http/request.py b/django/http/request.py
index 1cecbe191a..3f480592af 100644
--- a/django/http/request.py
+++ b/django/http/request.py
@@ -526,9 +526,9 @@ def validate_host(host, allowed_hosts):
pattern == '*' or
pattern.startswith('.') and (
host.endswith(pattern) or host == pattern[1:]
- ) or
+ ) or
pattern == host
- )
+ )
if match:
return True
diff --git a/django/template/base.py b/django/template/base.py
index b1df21f519..5cc5dd684f 100644
--- a/django/template/base.py
+++ b/django/template/base.py
@@ -495,7 +495,7 @@ constant_string = r"""
'strsq': r"'[^'\\]*(?:\\.[^'\\]*)*'", # single-quoted string
'i18n_open': re.escape("_("),
'i18n_close': re.escape(")"),
- }
+}
constant_string = constant_string.replace("\n", "")
filter_raw_string = r"""
diff --git a/django/test/html.py b/django/test/html.py
index 0d30bd2d1c..35e9be9570 100644
--- a/django/test/html.py
+++ b/django/test/html.py
@@ -190,7 +190,7 @@ class Parser(HTMLParser):
if name == "class"
else (name, value)
for name, value in attrs
- ]
+ ]
element = Element(tag, attrs)
self.current.append(element)
if tag not in self.SELF_CLOSING_TAGS:
diff --git a/django/test/runner.py b/django/test/runner.py
index fd0bfe8cb0..e76d7298fc 100644
--- a/django/test/runner.py
+++ b/django/test/runner.py
@@ -25,7 +25,7 @@ class DiscoverRunner(object):
make_option('-p', '--pattern', action='store', dest='pattern',
default="test*.py",
help='The test matching pattern. Defaults to test*.py.'),
- )
+ )
def __init__(self, pattern=None, top_level=None,
verbosity=1, interactive=True, failfast=False,
diff --git a/django/utils/crypto.py b/django/utils/crypto.py
index b395b3699f..cb5e06efd2 100644
--- a/django/utils/crypto.py
+++ b/django/utils/crypto.py
@@ -72,7 +72,7 @@ def get_random_string(length=12,
random.getstate(),
time.time(),
settings.SECRET_KEY)).encode('utf-8')
- ).digest())
+ ).digest())
return ''.join(random.choice(allowed_chars) for i in range(length))
diff --git a/django/utils/jslex.py b/django/utils/jslex.py
index f042d2e5ee..bf9fffb7e7 100644
--- a/django/utils/jslex.py
+++ b/django/utils/jslex.py
@@ -136,7 +136,7 @@ class JsLexer(Lexer):
Tok("punct", literals("{ } ( [ . ; , < > + - * % & | ^ ! ~ ? : ="), next='reg'),
Tok("string", r'"([^"\\]|(\\(.|\n)))*?"', next='div'),
Tok("string", r"'([^'\\]|(\\(.|\n)))*?'", next='div'),
- ]
+ ]
both_after = [
Tok("other", r"."),
@@ -175,7 +175,7 @@ class JsLexer(Lexer):
[a-zA-Z0-9]* # trailing flags
""", next='div'),
] + both_after,
- }
+ }
def __init__(self):
super(JsLexer, self).__init__(self.states, 'reg')
diff --git a/extras/csrf_migration_helper.py b/extras/csrf_migration_helper.py
index 1554555eda..ffa8b0b924 100755
--- a/extras/csrf_migration_helper.py
+++ b/extras/csrf_migration_helper.py
@@ -77,11 +77,11 @@
TEMPLATE_EXTENSIONS = [
".html",
".htm",
- ]
+]
PYTHON_SOURCE_EXTENSIONS = [
".py",
- ]
+]
TEMPLATE_ENCODING = "UTF-8"
diff --git a/setup.cfg b/setup.cfg
index e9679c50d5..c7f2e5b4f3 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -4,7 +4,7 @@ install-script = scripts/rpm-install.sh
[flake8]
exclude=./django/utils/dictconfig.py,./django/contrib/comments/*,./django/utils/unittest.py,./tests/comment_tests/*,./django/test/_doctest.py
-ignore=E123,E124,E125,E126,E127,E128,E225,E226,E241,E251,E302,E501,E203,E221,E227,E231,E261,E301,F401,F403,F841,W601
+ignore=E124,E125,E126,E127,E128,E225,E226,E241,E251,E302,E501,E203,E221,E227,E231,E261,E301,F401,F403,F841,W601
[metadata]
license-file = LICENSE
diff --git a/tests/admin_scripts/management/commands/custom_startproject.py b/tests/admin_scripts/management/commands/custom_startproject.py
index 80c6d6b805..8144b5b69c 100644
--- a/tests/admin_scripts/management/commands/custom_startproject.py
+++ b/tests/admin_scripts/management/commands/custom_startproject.py
@@ -8,4 +8,4 @@ class Command(BaseCommand):
make_option('--extra',
action='store', dest='extra',
help='An arbitrary extra value passed to the context'),
- )
+ )
diff --git a/tests/admin_views/models.py b/tests/admin_views/models.py
index adccae6c26..0f16fdb81e 100644
--- a/tests/admin_views/models.py
+++ b/tests/admin_views/models.py
@@ -171,7 +171,7 @@ class Fabric(models.Model):
('Textured', (
('x', 'Horizontal'),
('y', 'Vertical'),
- )
+ )
),
('plain', 'Smooth'),
)
diff --git a/tests/admin_views/tests.py b/tests/admin_views/tests.py
index 25a4b02495..438522189a 100644
--- a/tests/admin_views/tests.py
+++ b/tests/admin_views/tests.py
@@ -431,7 +431,7 @@ class AdminViewBasicTest(AdminViewBasicTestCase):
values=[p.name for p in Promo.objects.all()],
test=lambda obj, value:
obj.chap.book.promo_set.filter(name=value).exists()),
- }
+ }
for filter_path, params in filters.items():
for value in params['values']:
query_string = urlencode({filter_path: value})
@@ -1256,7 +1256,7 @@ class AdminViewPermissionsTest(TestCase):
'index': 0,
'action': ['delete_selected'],
'_selected_action': ['1'],
- })
+ })
self.assertTemplateUsed(response, 'custom_admin/delete_selected_confirmation.html')
response = self.client.get('/test_admin/admin/admin_views/customarticle/%d/history/' % article_pk)
self.assertTemplateUsed(response, 'custom_admin/object_history.html')
@@ -1474,7 +1474,7 @@ class AdminViewDeletedObjectsTest(TestCase):
"""
Super villain: Bob""",
"""Secret hideout: floating castle""",
"""Super secret hideout: super floating castle!"""
- ]
+ ]
response = self.client.get('/test_admin/admin/admin_views/villain/%s/delete/' % quote(3))
for should in should_contain:
self.assertContains(response, should, 1)
diff --git a/tests/aggregation_regress/tests.py b/tests/aggregation_regress/tests.py
index 111ef79b5e..078c1a9d1b 100644
--- a/tests/aggregation_regress/tests.py
+++ b/tests/aggregation_regress/tests.py
@@ -256,7 +256,7 @@ class AggregationTests(TestCase):
self.assertEqual(
Book.objects.annotate(c=Count('authors')).values('c').aggregate(Max('c')),
{'c__max': 3}
- )
+ )
def test_field_error(self):
# Bad field requests in aggregates are caught and reported
diff --git a/tests/basic/tests.py b/tests/basic/tests.py
index 5c1ed0726a..5d5e93b1e4 100644
--- a/tests/basic/tests.py
+++ b/tests/basic/tests.py
@@ -607,7 +607,7 @@ class ModelTest(TestCase):
dicts = Article.objects.filter(
pub_date__year=2008).extra(
select={'dashed-value': '1'}
- ).values('headline', 'dashed-value')
+ ).values('headline', 'dashed-value')
self.assertEqual([sorted(d.items()) for d in dicts],
[[('dashed-value', 1), ('headline', 'Article 11')], [('dashed-value', 1), ('headline', 'Article 12')]])
diff --git a/tests/cache/tests.py b/tests/cache/tests.py
index b107cdb3fe..89c53da6b8 100644
--- a/tests/cache/tests.py
+++ b/tests/cache/tests.py
@@ -150,7 +150,7 @@ class DummyCacheTests(unittest.TestCase):
'unicode_ascii': 'Iñtërnâtiônàlizætiøn1',
'Iñtërnâtiônàlizætiøn': 'Iñtërnâtiônàlizætiøn2',
'ascii2': {'x' : 1}
- }
+ }
for (key, value) in stuff.items():
self.cache.set(key, value)
self.assertEqual(self.cache.get(key), None)
@@ -354,7 +354,7 @@ class BaseCacheTests(object):
'unicode_ascii': 'Iñtërnâtiônàlizætiøn1',
'Iñtërnâtiônàlizætiøn': 'Iñtërnâtiônàlizætiøn2',
'ascii2': {'x' : 1}
- }
+ }
# Test `set`
for (key, value) in stuff.items():
self.cache.set(key, value)
diff --git a/tests/file_uploads/tests.py b/tests/file_uploads/tests.py
index 83a9e8b09c..703d512ef6 100644
--- a/tests/file_uploads/tests.py
+++ b/tests/file_uploads/tests.py
@@ -61,7 +61,7 @@ class FileUploadTests(TestCase):
'name': 'Ringo',
'file_field1': file1,
'file_field2': file2,
- }
+ }
for key in list(post_data):
try:
@@ -112,7 +112,7 @@ class FileUploadTests(TestCase):
post_data = {
'file_unicode': file1,
- }
+ }
response = self.client.post('/file_uploads/unicode_name/', post_data)
diff --git a/tests/fixtures_regress/tests.py b/tests/fixtures_regress/tests.py
index eb57a698be..4bfb45ea39 100644
--- a/tests/fixtures_regress/tests.py
+++ b/tests/fixtures_regress/tests.py
@@ -390,7 +390,7 @@ class TestFixtures(TestCase):
stdout.getvalue(),
"""[{"pk": %d, "model": "fixtures_regress.widget", "fields": {"name": "grommet"}}]"""
% widget.pk
- )
+ )
def test_loaddata_works_when_fixture_has_forward_refs(self):
"""
@@ -535,7 +535,7 @@ class NaturalKeyFixtureTests(TestCase):
'loaddata',
'forward_ref_lookup.json',
verbosity=0,
- )
+ )
stdout = StringIO()
management.call_command(
diff --git a/tests/forms_tests/tests/test_fields.py b/tests/forms_tests/tests/test_fields.py
index 152e53773e..e04b060916 100644
--- a/tests/forms_tests/tests/test_fields.py
+++ b/tests/forms_tests/tests/test_fields.py
@@ -1142,7 +1142,7 @@ class FieldsTests(SimpleTestCase):
('/django/forms/util.py', 'util.py'),
('/django/forms/utils.py', 'utils.py'),
('/django/forms/widgets.py', 'widgets.py')
- ]
+ ]
for exp, got in zip(expected, fix_os_paths(f.choices)):
self.assertEqual(exp[1], got[1])
self.assertTrue(got[0].endswith(exp[0]))
@@ -1163,7 +1163,7 @@ class FieldsTests(SimpleTestCase):
('/django/forms/util.py', 'util.py'),
('/django/forms/utils.py', 'utils.py'),
('/django/forms/widgets.py', 'widgets.py')
- ]
+ ]
for exp, got in zip(expected, fix_os_paths(f.choices)):
self.assertEqual(exp[1], got[1])
self.assertTrue(got[0].endswith(exp[0]))
@@ -1184,7 +1184,7 @@ class FieldsTests(SimpleTestCase):
('/django/forms/util.py', 'util.py'),
('/django/forms/utils.py', 'utils.py'),
('/django/forms/widgets.py', 'widgets.py')
- ]
+ ]
for exp, got in zip(expected, fix_os_paths(f.choices)):
self.assertEqual(exp[1], got[1])
self.assertTrue(got[0].endswith(exp[0]))
diff --git a/tests/forms_tests/tests/test_formsets.py b/tests/forms_tests/tests/test_formsets.py
index 28ebfd08cc..4b4a4bc001 100644
--- a/tests/forms_tests/tests/test_formsets.py
+++ b/tests/forms_tests/tests/test_formsets.py
@@ -996,9 +996,9 @@ class FormsFormsetTestCase(TestCase):
'choices-2-votes': '2',
'choices-3-choice': 'Three',
'choices-3-votes': '3',
- },
+ },
prefix='choices',
- )
+ )
# But we still only instantiate 3 forms
self.assertEqual(len(formset.forms), 3)
# and the formset isn't valid
@@ -1028,9 +1028,9 @@ class FormsFormsetTestCase(TestCase):
'choices-2-votes': '2',
'choices-3-choice': 'Three',
'choices-3-votes': '3',
- },
+ },
prefix='choices',
- )
+ )
# Four forms are instantiated and no exception is raised
self.assertEqual(len(formset.forms), 4)
finally:
diff --git a/tests/forms_tests/tests/tests.py b/tests/forms_tests/tests/tests.py
index 618ab8e07c..159d03ab7e 100644
--- a/tests/forms_tests/tests/tests.py
+++ b/tests/forms_tests/tests/tests.py
@@ -128,7 +128,7 @@ class ModelFormCallableModelDefault(TestCase):
'choice_int': obj2,
'multi_choice': [obj2,obj3],
'multi_choice_int': ChoiceOptionModel.objects.exclude(name="default"),
- }).as_p(), """