Skip to content
This repository was archived by the owner on Oct 27, 2021. It is now read-only.

Commit 428c0bb

Browse files
committed
Appeased flake8 2.1.0.
1 parent df3b1a0 commit 428c0bb

File tree

13 files changed

+26
-28
lines changed

13 files changed

+26
-28
lines changed

django/contrib/auth/management/__init__.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,9 @@ def create_permissions(app_config, verbosity=2, interactive=True, using=DEFAULT_
9797
))
9898

9999
perms = [
100-
Permission(codename=codename, name=name, content_type=ctype)
101-
for ctype, (codename, name) in searched_perms
102-
if (ctype.pk, codename) not in all_perms
100+
Permission(codename=codename, name=name, content_type=ct)
101+
for ct, (codename, name) in searched_perms
102+
if (ct.pk, codename) not in all_perms
103103
]
104104
# Validate the permissions before bulk_creation to avoid cryptic
105105
# database error when the verbose_name is longer than 50 characters

django/contrib/gis/views.py

+1-5
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,7 @@ def feed(request, url, feed_dict=None):
99
if not feed_dict:
1010
raise Http404(_("No feeds are registered."))
1111

12-
try:
13-
slug, param = url.split('/', 1)
14-
except ValueError:
15-
slug, param = url, ''
16-
12+
slug = url.partition('/')[0]
1713
try:
1814
f = feed_dict[slug]
1915
except KeyError:

django/contrib/staticfiles/management/commands/collectstatic.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
from django.utils.encoding import smart_text
1010
from django.utils.six.moves import input
1111

12-
from django.contrib.staticfiles import finders, storage
12+
from django.contrib.staticfiles.finders import get_finders
13+
from django.contrib.staticfiles.storage import staticfiles_storage
1314

1415

1516
class Command(NoArgsCommand):
@@ -52,7 +53,7 @@ def __init__(self, *args, **kwargs):
5253
self.symlinked_files = []
5354
self.unmodified_files = []
5455
self.post_processed_files = []
55-
self.storage = storage.staticfiles_storage
56+
self.storage = staticfiles_storage
5657
try:
5758
self.storage.path('')
5859
except NotImplementedError:
@@ -93,7 +94,7 @@ def collect(self):
9394
handler = self.copy_file
9495

9596
found_files = OrderedDict()
96-
for finder in finders.get_finders():
97+
for finder in get_finders():
9798
for path, storage in finder.list(self.ignore_patterns):
9899
# Prefix the relative path if the source storage contains it
99100
if getattr(storage, 'prefix', None):

django/core/management/commands/loaddata.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -239,9 +239,9 @@ def fixture_dirs(self):
239239
for app_config in apps.get_app_configs():
240240
if self.app_label and app_config.label != self.app_label:
241241
continue
242-
d = os.path.join(app_config.path, 'fixtures')
243-
if os.path.isdir(d):
244-
dirs.append(d)
242+
app_dir = os.path.join(app_config.path, 'fixtures')
243+
if os.path.isdir(app_dir):
244+
dirs.append(app_dir)
245245
dirs.extend(list(settings.FIXTURE_DIRS))
246246
dirs.append('')
247247
dirs = [upath(os.path.abspath(os.path.realpath(d))) for d in dirs]

django/db/models/base.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1106,7 +1106,7 @@ def _check_managers(cls, **kwargs):
11061106

11071107
errors = []
11081108
managers = cls._meta.concrete_managers + cls._meta.abstract_managers
1109-
for (_, _, manager) in managers:
1109+
for __, __, manager in managers:
11101110
errors.extend(manager.check(**kwargs))
11111111
return errors
11121112

django/db/models/expressions.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ class ExpressionNode(tree.Node):
1515
MUL = '*'
1616
DIV = '/'
1717
POW = '^'
18-
MOD = '%%' # This is a quoted % operator - it is quoted
19-
# because it can be used in strings that also
20-
# have parameter substitution.
18+
# The following is a quoted % operator - it is quoted because it can be
19+
# used in strings that also have parameter substitution.
20+
MOD = '%%'
2121

2222
# Bitwise operators - note that these are generated by .bitand()
2323
# and .bitor(), the '&' and '|' are reserved for boolean operator

django/db/models/fields/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -728,7 +728,7 @@ def get_choices(self, include_blank=True, blank_choice=BLANK_CHOICE_DASH):
728728
"""Returns choices with a default blank choices included, for use
729729
as SelectField choices for this field."""
730730
blank_defined = False
731-
for choice, _ in self.choices:
731+
for choice, __ in self.choices:
732732
if choice in ('', None):
733733
blank_defined = True
734734
break

django/utils/ipv6.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ def _explode_shorthand_ip_string(ip_str):
239239
sep = len(hextet[0].split(':')) + len(hextet[1].split(':'))
240240
new_ip = hextet[0].split(':')
241241

242-
for _ in xrange(fill_to - sep):
242+
for __ in xrange(fill_to - sep):
243243
new_ip.append('0000')
244244
new_ip += hextet[1].split(':')
245245

setup.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ install-script = scripts/rpm-install.sh
44

55
[flake8]
66
exclude=build,.git,./django/utils/dictconfig.py,./django/utils/unittest.py,./django/utils/lru_cache.py,./django/utils/six.py,./django/conf/app_template/*,./django/dispatch/weakref_backports.py
7-
ignore=E128,E501,W601
7+
ignore=E123,E128,E265,E501,W601
88

99
[metadata]
1010
license-file = LICENSE

tests/cache/tests.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1097,8 +1097,8 @@ def test_invalid_keys(self):
10971097
"cache with python-memcached library not available")
10981098
def test_memcached_uses_highest_pickle_version(self):
10991099
# Regression test for #19810
1100-
for cache_key, cache in settings.CACHES.items():
1101-
if cache['BACKEND'] == 'django.core.cache.backends.memcached.MemcachedCache':
1100+
for cache_key, cache_config in settings.CACHES.items():
1101+
if cache_config['BACKEND'] == 'django.core.cache.backends.memcached.MemcachedCache':
11021102
self.assertEqual(caches[cache_key]._cache.pickleProtocol,
11031103
pickle.HIGHEST_PROTOCOL)
11041104

tests/migrations/test_writer.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ def test_simple_migration(self):
160160
# In order to preserve compatibility with Python 3.2 unicode literals
161161
# prefix shouldn't be added to strings.
162162
tokens = tokenize.generate_tokens(six.StringIO(str(output)).readline)
163-
for token_type, token_source, (srow, scol), _, line in tokens:
163+
for token_type, token_source, (srow, scol), __, line in tokens:
164164
if token_type == tokenize.STRING:
165165
self.assertFalse(
166166
token_source.startswith('u'),

tests/model_inheritance/tests.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from django.core.management import call_command
77
from django.db import connection
88
from django.test import TestCase
9-
from django.test.utils import CaptureQueriesContext, override_settings
9+
from django.test.utils import CaptureQueriesContext
1010
from django.utils import six
1111

1212
from .models import (

tests/staticfiles_tests/tests.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -848,9 +848,10 @@ def setUp(self):
848848
self.find_all = ('media-file.txt', [test_file_path])
849849

850850

851-
@override_settings(STATICFILES_FINDERS=
852-
('django.contrib.staticfiles.finders.FileSystemFinder',),
853-
STATICFILES_DIRS=[os.path.join(TEST_ROOT, 'project', 'documents')])
851+
@override_settings(
852+
STATICFILES_FINDERS=('django.contrib.staticfiles.finders.FileSystemFinder',),
853+
STATICFILES_DIRS=[os.path.join(TEST_ROOT, 'project', 'documents')],
854+
)
854855
class TestMiscFinder(TestCase):
855856
"""
856857
A few misc finder tests.

0 commit comments

Comments
 (0)