Skip to content

Commit

Permalink
Fixed #21287 -- Fixed E123 pep8 warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
alasdairnicol committed Oct 18, 2013
1 parent 65750b8 commit a800036
Show file tree
Hide file tree
Showing 71 changed files with 152 additions and 152 deletions.
4 changes: 2 additions & 2 deletions django/contrib/admin/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,15 +242,15 @@ def choices(self, cl):
'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):
yield {
'selected': self.lookup_val2 == 'True',
'query_string': cl.get_query_string({
self.lookup_kwarg2: 'True',
}, [self.lookup_kwarg]),
}, [self.lookup_kwarg]),
'display': _('Unknown'),
}

Expand Down
2 changes: 1 addition & 1 deletion django/contrib/admin/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -1200,7 +1200,7 @@ def response_delete(self, request, obj_display):
'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' %
Expand Down
2 changes: 1 addition & 1 deletion django/contrib/auth/management/commands/changepassword.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def handle(self, *args, **options):
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)

Expand Down
30 changes: 15 additions & 15 deletions django/contrib/auth/tests/test_forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def test_user_already_exists(self):
'username': 'testclient',
'password1': 'test123',
'password2': 'test123',
}
}
form = UserCreationForm(data)
self.assertFalse(form.is_valid())
self.assertEqual(form["username"].errors,
Expand All @@ -43,7 +43,7 @@ def test_invalid_data(self):
'username': 'jsmith!',
'password1': 'test123',
'password2': 'test123',
}
}
form = UserCreationForm(data)
self.assertFalse(form.is_valid())
self.assertEqual(form["username"].errors,
Expand All @@ -55,7 +55,7 @@ def test_password_verification(self):
'username': 'jsmith',
'password1': 'test123',
'password2': 'test',
}
}
form = UserCreationForm(data)
self.assertFalse(form.is_valid())
self.assertEqual(form["password2"].errors,
Expand All @@ -82,7 +82,7 @@ def test_success(self):
'username': 'jsmith@example.com',
'password1': 'test123',
'password2': 'test123',
}
}
form = UserCreationForm(data)
self.assertTrue(form.is_valid())
u = form.save()
Expand All @@ -101,7 +101,7 @@ def test_invalid_username(self):
data = {
'username': 'jsmith_does_not_exist',
'password': 'test123',
}
}
form = AuthenticationForm(None, data)
self.assertFalse(form.is_valid())
self.assertEqual(form.non_field_errors(),
Expand All @@ -114,7 +114,7 @@ def test_inactive_user(self):
data = {
'username': 'inactive',
'password': 'password',
}
}
form = AuthenticationForm(None, data)
self.assertFalse(form.is_valid())
self.assertEqual(form.non_field_errors(),
Expand All @@ -126,7 +126,7 @@ def test_inactive_user_i18n(self):
data = {
'username': 'inactive',
'password': 'password',
}
}
form = AuthenticationForm(None, data)
self.assertFalse(form.is_valid())
self.assertEqual(form.non_field_errors(),
Expand All @@ -137,7 +137,7 @@ def test_custom_login_allowed_policy(self):
data = {
'username': 'inactive',
'password': 'password',
}
}

class AuthenticationFormWithInactiveUsersOkay(AuthenticationForm):
def confirm_login_allowed(self, user):
Expand All @@ -161,7 +161,7 @@ def confirm_login_allowed(self, user):
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."])
Expand All @@ -171,7 +171,7 @@ def test_success(self):
data = {
'username': 'testclient',
'password': 'password',
}
}
form = AuthenticationForm(None, data)
self.assertTrue(form.is_valid())
self.assertEqual(form.non_field_errors(), [])
Expand Down Expand Up @@ -215,7 +215,7 @@ def test_password_verification(self):
data = {
'new_password1': 'abc123',
'new_password2': 'abc',
}
}
form = SetPasswordForm(user, data)
self.assertFalse(form.is_valid())
self.assertEqual(form["new_password2"].errors,
Expand All @@ -226,7 +226,7 @@ def test_success(self):
data = {
'new_password1': 'abc123',
'new_password2': 'abc123',
}
}
form = SetPasswordForm(user, data)
self.assertTrue(form.is_valid())

Expand All @@ -243,7 +243,7 @@ def test_incorrect_password(self):
'old_password': 'test',
'new_password1': 'abc123',
'new_password2': 'abc123',
}
}
form = PasswordChangeForm(user, data)
self.assertFalse(form.is_valid())
self.assertEqual(form["old_password"].errors,
Expand All @@ -256,7 +256,7 @@ def test_password_verification(self):
'old_password': 'password',
'new_password1': 'abc123',
'new_password2': 'abc',
}
}
form = PasswordChangeForm(user, data)
self.assertFalse(form.is_valid())
self.assertEqual(form["new_password2"].errors,
Expand All @@ -269,7 +269,7 @@ def test_success(self):
'old_password': 'password',
'new_password1': 'abc123',
'new_password2': 'abc123',
}
}
form = PasswordChangeForm(user, data)
self.assertTrue(form.is_valid())

Expand Down
8 changes: 4 additions & 4 deletions django/contrib/auth/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def login(self, password='password'):
response = self.client.post('/login/', {
'username': 'testclient',
'password': password,
})
})
self.assertTrue(SESSION_KEY in self.client.session)
return response

Expand Down Expand Up @@ -180,7 +180,7 @@ def test_poisoned_http_host(self):
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)
Expand All @@ -193,7 +193,7 @@ def test_poisoned_http_host_admin_site(self):
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)
Expand Down Expand Up @@ -357,7 +357,7 @@ def fail_login(self, password='password'):
})
self.assertFormError(response, AuthenticationForm.error_messages['invalid_login'] % {
'username': User._meta.get_field('username').verbose_name
})
})

def logout(self):
self.client.get('/logout/')
Expand Down
2 changes: 1 addition & 1 deletion django/contrib/contenttypes/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ def get_prefetch_queryset(self, instances):
'%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:
Expand Down
24 changes: 12 additions & 12 deletions django/contrib/flatpages/tests/test_templatetags.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def test_get_flatpages_tag(self):
"{% 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):
Expand All @@ -43,9 +43,9 @@ def test_get_flatpages_tag_for_anon_user(self):
"{% for page in flatpages %}"
"{{ page.title }},"
"{% endfor %}"
).render(Context({
).render(Context({
'anonuser': AnonymousUser()
}))
}))
self.assertEqual(out, "A Flatpage,A Nested Flatpage,")

@skipIfCustomUser
Expand All @@ -58,9 +58,9 @@ def test_get_flatpages_tag_for_user(self):
"{% 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):
Expand All @@ -71,7 +71,7 @@ def test_get_flatpages_with_prefix(self):
"{% 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):
Expand All @@ -82,9 +82,9 @@ def test_get_flatpages_with_prefix_for_anon_user(self):
"{% for page in location_flatpages %}"
"{{ page.title }},"
"{% endfor %}"
).render(Context({
).render(Context({
'anonuser': AnonymousUser()
}))
}))
self.assertEqual(out, "A Nested Flatpage,")

@skipIfCustomUser
Expand All @@ -97,9 +97,9 @@ def test_get_flatpages_with_prefix_for_user(self):
"{% 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):
Expand All @@ -110,9 +110,9 @@ def test_get_flatpages_with_variable_prefix(self):
"{% 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):
Expand Down
4 changes: 2 additions & 2 deletions django/contrib/gis/db/backends/oracle/operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand All @@ -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'])
Expand Down
4 changes: 2 additions & 2 deletions django/contrib/gis/db/backends/postgis/operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def __init__(self, connection):
# The "&&" operator returns true if A's bounding box overlaps
# B's bounding box.
'bboverlaps' : PostGISOperator('&&'),
}
}

self.geometry_functions = {
'equals' : PostGISFunction(prefix, 'Equals'),
Expand Down Expand Up @@ -256,7 +256,7 @@ def spatial_version(self):
'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

Expand Down
4 changes: 2 additions & 2 deletions django/contrib/gis/db/backends/spatialite/operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion django/contrib/gis/forms/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion django/contrib/gis/management/commands/ogrinspect.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 3 additions & 3 deletions django/contrib/gis/measure.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -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):
Expand All @@ -305,7 +305,7 @@ def __mul__(self, other):
else:
raise TypeError('%(distance)s must be multiplied with number or %(distance)s' % {
"distance" : pretty_name(self.__class__),
})
})


class Area(MeasureBase):
Expand Down
Loading

0 comments on commit a800036

Please sign in to comment.