Skip to content

Commit

Permalink
Fixed #21268 -- Fixed E303 pep8 warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
alasdairnicol committed Oct 18, 2013
1 parent 65d1d65 commit bab9123
Show file tree
Hide file tree
Showing 53 changed files with 2 additions and 87 deletions.
1 change: 0 additions & 1 deletion django/contrib/admin/templatetags/admin_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@ def result_headers(cl):
if i not in ordering_field_columns:
o_list_primary.insert(0, make_qs_param(new_order_type, i))


yield {
"text": text,
"sortable": True,
Expand Down
1 change: 0 additions & 1 deletion django/contrib/auth/tests/test_auth_backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,6 @@ def test_authenticate(self):
self.assertEqual(test_user, authenticated_user)



class TestObj(object):
pass

Expand Down
1 change: 0 additions & 1 deletion django/contrib/auth/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,6 @@ def test_poisoned_http_host_admin_site(self):
self.assertEqual(len(mail.outbox), 0)
self.assertEqual(len(logger_calls), 1)


def _test_confirm_start(self):
# Start by creating the email
self.client.post('/password_reset/', {'email': 'staffmember@example.com'})
Expand Down
1 change: 0 additions & 1 deletion django/contrib/contenttypes/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,6 @@ def test_get_for_concrete_models(self):
DeferredProxyModel: proxy_model_ct,
})


@override_settings(ALLOWED_HOSTS=['example.com'])
def test_shortcut_view(self):
"""
Expand Down
1 change: 0 additions & 1 deletion django/contrib/formtools/preview.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ def get_context(self, request, form):
"Context for template rendering."
return {'form': form, 'stage_field': self.unused_name('stage'), 'state': self.state}


def parse_params(self, *args, **kwargs):
"""
Given captured args and kwargs from the URLconf, saves something in
Expand Down
1 change: 0 additions & 1 deletion django/contrib/formtools/tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ def test_form_submit_good_hash(self):
response = self.client.post('/preview/', self.test_data)
self.assertEqual(response.content, success_string_encoded)


def test_form_submit_bad_hash(self):
"""
Test contrib.formtools.preview form submittal does not proceed
Expand Down
1 change: 0 additions & 1 deletion django/contrib/gis/geos/tests/test_mutable_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ def setfcn(x,i,j,k,L):
pl[::k] = ssl
self.assertEqual(pl, ul[:], 'set slice [::%d]' % (k))


def test03_delslice(self):
'Delete slice'
for Len in range(self.limit):
Expand Down
1 change: 0 additions & 1 deletion django/contrib/gis/tests/test_measure.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ def testInit(self):
self.assertEqual(d.m, 1.0)
self.assertEqual(d.mm, 1000.0)


def testInitInvalid(self):
"Testing initialisation from invalid units"
self.assertRaises(AttributeError, D, banana=100)
Expand Down
1 change: 0 additions & 1 deletion django/contrib/sessions/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,6 @@ def test_decode_failure_logged_to_security(self):
self.assertEqual(len(calls), 1)
self.assertTrue('corrupted' in calls[0])


def test_actual_expiry(self):
# this doesn't work with JSONSerializer (serializing timedelta)
with override_settings(SESSION_SERIALIZER='django.contrib.sessions.serializers.PickleSerializer'):
Expand Down
1 change: 0 additions & 1 deletion django/contrib/sitemaps/tests/test_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ def test_simple_sitemap_custom_index(self):
""" % self.base_url
self.assertXMLEqual(response.content.decode('utf-8'), expected_content)


def test_simple_sitemap_section(self):
"A simple sitemap section can be rendered"
response = self.client.get('/simple/sitemap-simple.xml')
Expand Down
1 change: 0 additions & 1 deletion django/core/handlers/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ class BaseHandler(object):
def __init__(self):
self._request_middleware = self._view_middleware = self._template_response_middleware = self._response_middleware = self._exception_middleware = None


def load_middleware(self):
"""
Populate middleware lists from settings.MIDDLEWARE_CLASSES.
Expand Down
1 change: 0 additions & 1 deletion django/core/urlresolvers.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ def __init__(self, regex):
self._regex = regex
self._regex_dict = {}


@property
def regex(self):
"""
Expand Down
1 change: 0 additions & 1 deletion django/forms/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -840,7 +840,6 @@ def initial_form_count(self):
return 0
return super(BaseInlineFormSet, self).initial_form_count()


def _construct_form(self, i, **kwargs):
form = super(BaseInlineFormSet, self)._construct_form(i, **kwargs)
if self.save_as_new:
Expand Down
1 change: 0 additions & 1 deletion django/test/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ def build_suite(self, test_labels=None, extra_tests=None, **kwargs):
break
kwargs['top_level_dir'] = top_level


if not (tests and tests.countTestCases()):
# if no tests found, it's probably a package; try discovery
tests = self.test_loader.discover(start_dir=label, **kwargs)
Expand Down
6 changes: 0 additions & 6 deletions django/utils/six.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ def _resolve(self):
return getattr(module, self.attr)



class _MovedItems(types.ModuleType):
"""Lazy loading of moved objects"""

Expand Down Expand Up @@ -198,7 +197,6 @@ class _MovedItems(types.ModuleType):
moves = sys.modules[__name__ + ".moves"] = _MovedItems(__name__ + ".moves")



class Module_six_moves_urllib_parse(types.ModuleType):
"""Lazy loading of moved objects in six.moves.urllib_parse"""

Expand Down Expand Up @@ -484,13 +482,11 @@ def iterbytes(buf):
import builtins
exec_ = getattr(builtins, "exec")


def reraise(tp, value, tb=None):
if value.__traceback__ is not tb:
raise value.with_traceback(tb)
raise value


print_ = getattr(builtins, "print")
del builtins

Expand All @@ -507,12 +503,10 @@ def exec_(_code_, _globs_=None, _locs_=None):
_locs_ = _globs_
exec("""exec _code_ in _globs_, _locs_""")


exec_("""def reraise(tp, value, tb=None):
raise tp, value, tb
""")


def print_(*args, **kwargs):
"""The new-style print function."""
fp = kwargs.pop("file", sys.stdout)
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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,E303,F401,F403,F841,W601
ignore=E123,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
Expand Down
1 change: 0 additions & 1 deletion tests/admin_changelist/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ def test_select_related_as_empty_tuple(self):
ia.list_max_show_all, ia.list_editable, ia)
self.assertEqual(cl.queryset.query.select_related, False)


def test_result_list_empty_changelist_value(self):
"""
Regression test for #14982: EMPTY_CHANGELIST_VALUE should be honored
Expand Down
1 change: 0 additions & 1 deletion tests/admin_inlines/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,6 @@ def test_inline_change_fk_change_del_perm(self):
'value="%i" name="inner2_set-0-id" />' % self.inner2_id, html=True)
self.assertContains(response, 'id="id_inner2_set-0-DELETE"')


def test_inline_change_fk_all_perms(self):
permission = Permission.objects.get(codename='add_inner2', content_type=self.inner_ct)
self.user.user_permissions.add(permission)
Expand Down
1 change: 0 additions & 1 deletion tests/admin_scripts/management/commands/noargs_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,5 @@ class Command(NoArgsCommand):
help = "Test No-args commands"
requires_model_validation = False


def handle_noargs(self, **options):
print('EXECUTE:NoArgsCommand options=%s' % sorted(options.items()))
2 changes: 0 additions & 2 deletions tests/admin_validation/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ class MyAdmin(admin.ModelAdmin):
inlines = [TwoAlbumFKAndAnEInline]
MyAdmin.validate(Album)


def test_inline_self_validation(self):
class TwoAlbumFKAndAnEInline(admin.TabularInline):
model = TwoAlbumFKAndAnE
Expand Down Expand Up @@ -296,7 +295,6 @@ class Meta:
model = Song
fields = '__all__'


class FieldsOnFormOnlyAdmin(admin.ModelAdmin):
form = SongForm
fields = ['extra_data', 'title']
Expand Down
1 change: 0 additions & 1 deletion tests/admin_widgets/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -860,7 +860,6 @@ def test_filter(self):
self.selenium.get(
'%s%s' % (self.live_server_url, '/admin_widgets/school/%s/' % self.school.id))


for field_name in ['students', 'alumni']:
from_box = '#id_%s_from' % field_name
to_box = '#id_%s_to' % field_name
Expand Down
5 changes: 0 additions & 5 deletions tests/app_loading/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,29 +96,24 @@ def setUp(self):
from .not_installed import models
self.not_installed_module = models


def test_get_model_only_returns_installed_models(self):
self.assertEqual(
get_model("not_installed", "NotInstalledModel"), None)


def test_get_model_with_not_installed(self):
self.assertEqual(
get_model(
"not_installed", "NotInstalledModel", only_installed=False),
self.not_installed_module.NotInstalledModel)


def test_get_models_only_returns_installed_models(self):
self.assertFalse(
"NotInstalledModel" in
[m.__name__ for m in get_models()])


def test_get_models_with_app_label_only_returns_installed_models(self):
self.assertEqual(get_models(self.not_installed_module), [])


def test_get_models_with_not_installed(self):
self.assertTrue(
"NotInstalledModel" in [
Expand Down
2 changes: 0 additions & 2 deletions tests/cache/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -794,7 +794,6 @@ def test_custom_key_func(self):
self.assertEqual(self.custom_key_cache.get('answer2'), 42)
self.assertEqual(self.custom_key_cache2.get('answer2'), 42)


def test_cache_write_unpickable_object(self):
update_middleware = UpdateCacheMiddleware()
update_middleware.cache = self.cache
Expand Down Expand Up @@ -1496,7 +1495,6 @@ def tzname(self, dt):
self.assertIn(sanitized_name, learn_cache_key(request, response),
"Cache keys should include the time zone name when time zones are active")


@override_settings(
CACHE_MIDDLEWARE_KEY_PREFIX="test",
CACHE_MIDDLEWARE_SECONDS=60,
Expand Down
1 change: 0 additions & 1 deletion tests/custom_managers/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ def test_manager(self):
# manager
self.assertIsInstance(self.p2.books, PublishedBookManager)


# The default manager, "objects", doesn't exist, because a custom one
# was provided.
self.assertRaises(AttributeError, lambda: Book.objects)
Expand Down
2 changes: 0 additions & 2 deletions tests/defaultfilters/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ def __float__(self):
finally:
decimal_ctx.prec = old_prec


def test_floatformat_py2_fail(self):
self.assertEqual(floatformat(1.00000000000000015, 16), '1.0000000000000002')

Expand All @@ -92,7 +91,6 @@ def test_floatformat_py2_fail(self):
if six.PY2:
test_floatformat_py2_fail = unittest.expectedFailure(test_floatformat_py2_fail)


def test_addslashes(self):
self.assertEqual(addslashes('"double quotes" and \'single quotes\''),
'\\"double quotes\\" and \\\'single quotes\\\'')
Expand Down
4 changes: 0 additions & 4 deletions tests/delete_regress/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,6 @@ def create_image(self):

return test_image


def test_delete_proxy(self):
"""
Deleting the *proxy* instance bubbles through to its non-proxy and
Expand All @@ -197,7 +196,6 @@ def test_delete_proxy(self):
self.assertEqual(len(FooImage.objects.all()), 0)
self.assertEqual(len(FooFile.objects.all()), 0)


def test_delete_proxy_of_proxy(self):
"""
Deleting a proxy-of-proxy instance should bubble through to its proxy
Expand All @@ -224,7 +222,6 @@ def test_delete_proxy_of_proxy(self):
self.assertEqual(len(FooFile.objects.all()), 0)
self.assertEqual(len(FooImage.objects.all()), 0)


def test_delete_concrete_parent(self):
"""
Deleting an instance of a concrete model should also delete objects
Expand All @@ -244,7 +241,6 @@ def test_delete_concrete_parent(self):
self.assertEqual(len(FooFile.objects.all()), 0)
self.assertEqual(len(FooImage.objects.all()), 0)


def test_delete_proxy_pair(self):
"""
If a pair of proxy models are linked by an FK from one concrete parent
Expand Down
1 change: 0 additions & 1 deletion tests/files/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ def test_file_object(self):
with temp_storage.open('tests/file_obj') as f:
self.assertEqual(f.read(), b'some content')


def test_stringio(self):
# Test passing StringIO instance as content argument to save
output = StringIO()
Expand Down
1 change: 0 additions & 1 deletion tests/fixtures_model_package/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ def test_migrate(self):
)
self.assertQuerysetEqual(Book.objects.all(), [])


def test_flush(self):
# Test presence of fixture (flush called by TransactionTestCase)
self.assertQuerysetEqual(
Expand Down
1 change: 0 additions & 1 deletion tests/fixtures_regress/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,6 @@ def test_dumpdata_uses_default_manager(self):
self.maxDiff = 1024
self.assertEqual(data, animals_data)


def test_proxy_model_included(self):
"""
Regression for #11428 - Proxy models aren't included when you dumpdata
Expand Down
1 change: 0 additions & 1 deletion tests/forms_tests/tests/test_extra.py
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,6 @@ def compress(self, data_list):
self.assertTrue(f._has_changed('some text,JP,2007-04-25 06:24:00',
['some text', ['J','P'], ['2009-04-25','11:44:00']]))


class ComplexFieldForm(Form):
field1 = ComplexField(widget=w)

Expand Down
4 changes: 0 additions & 4 deletions tests/forms_tests/tests/test_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ def __init__(self):
self.class_a_var = True
super(A, self).__init__()


class ComplexField(Field, A):
def __init__(self):
super(ComplexField, self).__init__()
Expand Down Expand Up @@ -718,7 +717,6 @@ def test_filefield_changed(self):
# with here)
self.assertTrue(f._has_changed('resume.txt', {'filename': 'resume.txt', 'content': 'My resume'}))


# URLField ##################################################################

def test_urlfield_1(self):
Expand Down Expand Up @@ -965,7 +963,6 @@ def test_nullbooleanfield_1(self):
self.assertEqual(None, f.clean('3'))
self.assertEqual(None, f.clean('hello'))


def test_nullbooleanfield_2(self):
# Make sure that the internal value is preserved if using HiddenInput (#7753)
class HiddenNullBooleanForm(Form):
Expand Down Expand Up @@ -1218,7 +1215,6 @@ def test_filepathfield_folders(self):
self.assertEqual(exp[1], got[1])
self.assertTrue(got[0].endswith(exp[0]))


# SplitDateTimeField ##########################################################

def test_splitdatetimefield_1(self):
Expand Down
1 change: 0 additions & 1 deletion tests/forms_tests/tests/test_forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -1810,7 +1810,6 @@ def __init__(self, fields=(), *args, **kwargs):
CharField(label='Name', max_length=10))
super(ChoicesField, self).__init__(fields=fields, *args, **kwargs)


field = ChoicesField()
field2 = copy.deepcopy(field)
self.assertTrue(isinstance(field2, ChoicesField))
Expand Down
Loading

0 comments on commit bab9123

Please sign in to comment.