Permalink
Browse files

Fixed #21285 -- Fixed E121,E122 pep8 warnings

  • Loading branch information...
alasdairnicol authored and timgraham committed Oct 17, 2013
1 parent d97bec5 commit dfb4cb9970f86487f0aaa88c5dfcfafa31e4f430
@@ -198,7 +198,7 @@
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
-# 'django.template.loaders.eggs.Loader',
+ # 'django.template.loaders.eggs.Loader',
)
# List of processors used by RequestContext to populate the context.
@@ -211,7 +211,7 @@
'django.core.context_processors.media',
'django.core.context_processors.static',
'django.core.context_processors.tz',
-# 'django.core.context_processors.request',
+ # 'django.core.context_processors.request',
'django.contrib.messages.context_processors.messages',
)
@@ -456,8 +456,8 @@
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
-# 'django.middleware.http.ConditionalGetMiddleware',
-# 'django.middleware.gzip.GZipMiddleware',
+ # 'django.middleware.http.ConditionalGetMiddleware',
+ # 'django.middleware.gzip.GZipMiddleware',
)
############
@@ -607,7 +607,7 @@
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
-# 'django.contrib.staticfiles.finders.DefaultStorageFinder',
+ # 'django.contrib.staticfiles.finders.DefaultStorageFinder',
)
##############
@@ -166,9 +166,8 @@ def __init__(self, field, request, params, model, model_admin, field_path):
rel_name = other_model._meta.pk.name
self.lookup_kwarg = '%s__%s__exact' % (field_path, rel_name)
self.lookup_kwarg_isnull = '%s__isnull' % field_path
- self.lookup_val = request.GET.get(self.lookup_kwarg, None)
- self.lookup_val_isnull = request.GET.get(
- self.lookup_kwarg_isnull, None)
+ self.lookup_val = request.GET.get(self.lookup_kwarg)
+ self.lookup_val_isnull = request.GET.get(self.lookup_kwarg_isnull)
self.lookup_choices = field.get_choices(include_blank=False)
super(RelatedFieldListFilter, self).__init__(
field, request, params, model, model_admin, field_path)
@@ -1198,9 +1198,9 @@ def response_delete(self, request, obj_display):
self.message_user(request, _(
'The %(name)s "%(obj)s" was deleted successfully.') % {
- 'name': force_text(opts.verbose_name),
- 'obj': force_text(obj_display)},
- messages.SUCCESS)
+ 'name': force_text(opts.verbose_name),
+ 'obj': force_text(obj_display)
+ }, messages.SUCCESS)
if self.has_change_permission(request, None):
post_url = reverse('admin:%s_%s_changelist' %
@@ -1221,10 +1221,10 @@ def render_delete_form(self, request, context):
return TemplateResponse(request,
self.delete_confirmation_template or [
- "admin/{}/{}/delete_confirmation.html".format(app_label, opts.model_name),
- "admin/{}/delete_confirmation.html".format(app_label),
- "admin/delete_confirmation.html"
- ], context, current_app=self.admin_site.name)
+ "admin/{}/{}/delete_confirmation.html".format(app_label, opts.model_name),
+ "admin/{}/delete_confirmation.html".format(app_label),
+ "admin/delete_confirmation.html"
+ ], context, current_app=self.admin_site.name)
@csrf_protect_m
@transaction.atomic
@@ -49,9 +49,9 @@ def _is_changelist_popup(request):
IS_LEGACY_POPUP_VAR = 'pop'
if IS_LEGACY_POPUP_VAR in request.GET:
warnings.warn(
- "The `%s` GET parameter has been renamed to `%s`." %
- (IS_LEGACY_POPUP_VAR, IS_POPUP_VAR),
- DeprecationWarning, 2)
+ "The `%s` GET parameter has been renamed to `%s`." %
+ (IS_LEGACY_POPUP_VAR, IS_POPUP_VAR),
+ DeprecationWarning, 2)
return True
return False
@@ -106,7 +106,7 @@ def test_invalid_username(self):
self.assertFalse(form.is_valid())
self.assertEqual(form.non_field_errors(),
[force_text(form.error_messages['invalid_login'] % {
- 'username': User._meta.get_field('username').verbose_name
+ 'username': User._meta.get_field('username').verbose_name
})])
def test_inactive_user(self):
@@ -217,7 +217,7 @@ def test_duplicated_permissions(self):
"""
# check duplicated default permission
models.Permission._meta.permissions = [
- ('change_permission', 'Can edit permission (duplicate)')]
+ ('change_permission', 'Can edit permission (duplicate)')]
six.assertRaisesRegex(self, CommandError,
"The permission codename 'change_permission' clashes with a "
"builtin permission for model 'auth.Permission'.",
@@ -13,10 +13,10 @@
('form2', Page2),
('form3', Page3),
('form4', Page4)])),
- url(r'^wiz_other_template/$', CookieContactWizard.as_view(
- [('form1', Page1),
- ('form2', Page2),
- ('form3', Page3),
- ('form4', Page4)],
- template_name='other_wizard_form.html')),
+ url(r'^wiz_other_template/$', CookieContactWizard.as_view(
+ [('form1', Page1),
+ ('form2', Page2),
+ ('form3', Page3),
+ ('form4', Page4)],
+ template_name='other_wizard_form.html')),
)
@@ -36,7 +36,7 @@ def render(self, name, value, attrs=None):
except (GEOSException, ValueError) as err:
logger.error(
"Error creating geometry from value '%s' (%s)" % (
- value, err)
+ value, err)
)
value = None
@@ -68,7 +68,7 @@ def render(self, name, value, attrs=None):
except OGRException as err:
logger.error(
"Error transforming geometry from srid '%s' to srid '%s' (%s)" % (
- value.srid, srid, err)
+ value.srid, srid, err)
)
wkt = ''
else:
@@ -9,6 +9,6 @@
# The geographic-enabled fields.
from django.contrib.gis.db.models.fields import (
- GeometryField, PointField, LineStringField, PolygonField,
- MultiPointField, MultiLineStringField, MultiPolygonField,
- GeometryCollectionField)
+ GeometryField, PointField, LineStringField, PolygonField,
+ MultiPointField, MultiLineStringField, MultiPolygonField,
+ GeometryCollectionField)
@@ -43,7 +43,7 @@ def deserialize(self, value):
except (GEOSException, ValueError) as err:
logger.error(
"Error creating geometry from value '%s' (%s)" % (
- value, err)
+ value, err)
)
return None
@@ -63,7 +63,7 @@ def render(self, name, value, attrs=None):
except gdal.OGRException as err:
logger.error(
"Error transforming geometry from srid '%s' to srid '%s' (%s)" % (
- value.srid, self.map_srid, err)
+ value.srid, self.map_srid, err)
)
context = self.build_attrs(attrs,
@@ -34,7 +34,7 @@ def _prepare(self):
def __eq__(self, other):
return isinstance(other, Message) and self.level == other.level and \
- self.message == other.message
+ self.message == other.message
def __str__(self):
return force_text(self.message)
@@ -219,7 +219,7 @@ def test_multiple_posts(self):
lambda m:'MessageMiddleware' not in m, settings.MIDDLEWARE_CLASSES),
TEMPLATE_CONTEXT_PROCESSORS=filter(
lambda p:'context_processors.messages' not in p,
- settings.TEMPLATE_CONTEXT_PROCESSORS),
+ settings.TEMPLATE_CONTEXT_PROCESSORS),
MESSAGE_LEVEL=constants.DEBUG
)
def test_middleware_disabled(self):
@@ -244,7 +244,7 @@ def test_middleware_disabled(self):
lambda m:'MessageMiddleware' not in m, settings.MIDDLEWARE_CLASSES),
TEMPLATE_CONTEXT_PROCESSORS=filter(
lambda p:'context_processors.messages' not in p,
- settings.TEMPLATE_CONTEXT_PROCESSORS),
+ settings.TEMPLATE_CONTEXT_PROCESSORS),
MESSAGE_LEVEL=constants.DEBUG
)
def test_middleware_disabled_fail_silently(self):
@@ -251,9 +251,9 @@ def get_validation_errors(outfile, app=None):
"than one foreign key to %s, which is "
"ambiguous and is not permitted." % (
f.rel.through._meta.object_name,
- from_model._meta.object_name
- )
- )
+ from_model._meta.object_name
+ )
+ )
else:
seen_from = True
elif rel_to == to_model:
@@ -439,9 +439,9 @@ def destroy_test_db(self, old_database_name, verbosity=1):
settings_dict['NAME'] = old_database_name
backend = load_backend(settings_dict['ENGINE'])
new_connection = backend.DatabaseWrapper(
- settings_dict,
- alias='__destroy_test_db__',
- allow_thread_sharing=False)
+ settings_dict,
+ alias='__destroy_test_db__',
+ allow_thread_sharing=False)
new_connection.creation._destroy_test_db(test_database_name, verbosity)
def _destroy_test_db(self, test_database_name, verbosity):
View
@@ -566,8 +566,8 @@ def save(self, force_insert=False, force_update=False, using=None,
deferred_fields = [
f.attname for f in self._meta.fields
if f.attname not in self.__dict__
- and isinstance(self.__class__.__dict__[f.attname],
- DeferredAttribute)]
+ and isinstance(self.__class__.__dict__[f.attname],
+ DeferredAttribute)]
loaded_fields = field_names.difference(deferred_fields)
if loaded_fields:
@@ -704,7 +704,7 @@ class AutoField(Field):
def __init__(self, *args, **kwargs):
assert kwargs.get('primary_key', False) is True, \
- "%ss must have primary_key=True." % self.__class__.__name__
+ "%ss must have primary_key=True." % self.__class__.__name__
kwargs['blank'] = True
Field.__init__(self, *args, **kwargs)
@@ -746,7 +746,7 @@ def get_prep_value(self, value):
def contribute_to_class(self, cls, name):
assert not cls._meta.has_auto_field, \
- "A model can't have more than one AutoField."
+ "A model can't have more than one AutoField."
super(AutoField, self).contribute_to_class(cls, name)
cls._meta.has_auto_field = True
cls._meta.auto_field = self
@@ -1247,8 +1247,8 @@ def validate(self, value, model_instance):
using = router.db_for_read(model_instance.__class__, instance=model_instance)
qs = self.rel.to._default_manager.using(using).filter(
- **{self.rel.field_name: value}
- )
+ **{self.rel.field_name: value}
+ )
qs = qs.complex_filter(self.rel.limit_choices_to)
if not qs.exists():
raise exceptions.ValidationError(
View
@@ -515,7 +515,7 @@ def next_space_index(subject, i):
'var_chars': "\w\.",
'filter_sep': re.escape(FILTER_SEPARATOR),
'arg_sep': re.escape(FILTER_ARGUMENT_SEPARATOR),
- }
+}
filter_re = re.compile(filter_raw_string, re.UNICODE | re.VERBOSE)
View
@@ -282,8 +282,7 @@ def assertRedirects(self, response, expected_url, status_code=302,
" response code was %d (expected %d)" %
(path, redirect_response.status_code, target_status_code))
- e_scheme, e_netloc, e_path, e_query, e_fragment = urlsplit(
- expected_url)
+ e_scheme, e_netloc, e_path, e_query, e_fragment = urlsplit(expected_url)
if not (e_scheme or e_netloc):
expected_url = urlunsplit(('http', host or 'testserver', e_path,
e_query, e_fragment))
@@ -850,10 +849,10 @@ def _fixture_setup(self):
try:
call_command('loaddata', *self.fixtures,
**{
- 'verbosity': 0,
- 'commit': False,
- 'database': db_name,
- 'skip_validation': True,
+ 'verbosity': 0,
+ 'commit': False,
+ 'database': db_name,
+ 'skip_validation': True,
})
except Exception:
self._fixture_teardown()
View
@@ -145,12 +145,12 @@ class JsLexer(Lexer):
states = {
'div': # slash will mean division
both_before + [
- Tok("punct", literals("/= /"), next='reg'),
+ Tok("punct", literals("/= /"), next='reg'),
] + both_after,
'reg': # slash will mean regex
both_before + [
- Tok("regex",
+ Tok("regex",
r"""
/ # opening slash
# First character is..
@@ -65,8 +65,9 @@ def decorator(view):
@functools.wraps(view)
def sensitive_post_parameters_wrapper(request, *args, **kwargs):
assert isinstance(request, HttpRequest), (
- "sensitive_post_parameters didn't receive an HttpRequest. If you "
- "are decorating a classmethod, be sure to use @method_decorator."
+ "sensitive_post_parameters didn't receive an HttpRequest. "
+ "If you are decorating a classmethod, be sure to use "
+ "@method_decorator."
)
if parameters:
request.sensitive_post_parameters = parameters
View
@@ -226,8 +226,8 @@ def django_release():
# (source start file, target name, title, author, document class [howto/manual]).
#latex_documents = []
latex_documents = [
- ('contents', 'django.tex', 'Django Documentation',
- 'Django Software Foundation', 'manual'),
+ ('contents', 'django.tex', 'Django Documentation',
+ 'Django Software Foundation', 'manual'),
]
# The name of an image file (relative to this directory) to place at the top of
View
@@ -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,E121,E122,E203,E221,E227,E231,E261,E301,E303,E502,F401,F403,F841,W601
+ignore=E123,E124,E125,E126,E127,E128,E225,E226,E241,E251,E302,E501,E203,E221,E227,E231,E261,E301,E303,E502,F401,F403,F841,W601
[metadata]
license-file = LICENSE
@@ -94,8 +94,8 @@ def test_large_batch(self):
with override_settings(DEBUG=True):
connection.queries = []
TwoFields.objects.bulk_create([
- TwoFields(f1=i, f2=i+1) for i in range(0, 1001)
- ])
+ TwoFields(f1=i, f2=i+1) for i in range(0, 1001)
+ ])
self.assertEqual(TwoFields.objects.count(), 1001)
self.assertEqual(
TwoFields.objects.filter(f1__gte=450, f1__lte=550).count(),
@@ -115,8 +115,8 @@ def test_large_batch_efficiency(self):
with override_settings(DEBUG=True):
connection.queries = []
TwoFields.objects.bulk_create([
- TwoFields(f1=i, f2=i+1) for i in range(0, 1001)
- ])
+ TwoFields(f1=i, f2=i+1) for i in range(0, 1001)
+ ])
self.assertTrue(len(connection.queries) < 10)
def test_large_batch_mixed(self):
View
@@ -867,7 +867,7 @@ def test_zero_cull(self):
def test_second_call_doesnt_crash(self):
stdout = six.StringIO()
management.call_command(
- 'createcachetable',
+ 'createcachetable',
stdout=stdout
)
self.assertEqual(stdout.getvalue(),
@@ -306,14 +306,14 @@ def test_regression_10847(self):
self.assertQuerysetEqual(
TestObject.objects.filter(
- pk__in=TestObject.objects.values('pk').extra(select={'extra': 1})
+ pk__in=TestObject.objects.values('pk').extra(select={'extra': 1})
),
['<TestObject: TestObject: first,second,third>']
)
self.assertQuerysetEqual(
TestObject.objects.filter(pk=obj.pk) |
- TestObject.objects.extra(where=["id > %s"], params=[obj.pk]),
+ TestObject.objects.extra(where=["id > %s"], params=[obj.pk]),
['<TestObject: TestObject: first,second,third>']
)
Oops, something went wrong.

0 comments on commit dfb4cb9

Please sign in to comment.