Skip to content

Commit 73f8127

Browse files
committed
Fix PEP8 errors reported by the new flake8 version (except E128, which we ignore for the time being)
1 parent 3723a67 commit 73f8127

File tree

8 files changed

+25
-33
lines changed

8 files changed

+25
-33
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ install:
1212
- pip install -e .
1313
- pip install -r requirements/tests.txt Django==$DJANGO
1414
before_script:
15-
- flake8 compressor --ignore=E501
15+
- flake8 compressor --ignore=E501,E128
1616
script:
1717
- make test
1818
env:

compressor/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ def get_filecontent(self, filename, charset):
113113
return fd.read()
114114
except IOError, e:
115115
raise UncompressableFileError("IOError while processing "
116-
"'%s': %s" % (filename, e))
116+
"'%s': %s" % (filename, e))
117117
except UnicodeDecodeError, e:
118118
raise UncompressableFileError("UnicodeDecodeError while "
119119
"processing '%s' with "

compressor/contrib/jinja2ext.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def parse(self, parser):
1919
if args[0].value not in self.compressors:
2020
raise TemplateSyntaxError('compress kind may be one of: %s' %
2121
(', '.join(self.compressors.keys())),
22-
lineno)
22+
lineno)
2323
if parser.stream.skip_if('comma'):
2424
modearg = parser.parse_expression()
2525
# Allow mode to be defined as jinja2 name node

compressor/templatetags/compress.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,7 @@ def render_compressed(self, context, kind, mode, forced=False):
9191

9292
# Take a shortcut if we really don't have anything to do
9393
if ((not settings.COMPRESS_ENABLED and
94-
not settings.COMPRESS_PRECOMPILERS)
95-
and not forced):
94+
not settings.COMPRESS_PRECOMPILERS) and not forced):
9695
return self.get_original_content(context)
9796

9897
context['compressed'] = {'name': getattr(self, 'name', None)}

compressor/tests/test_templatetags.py

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -219,10 +219,9 @@ def test_multiple_file_order_conserved(self):
219219
</script>
220220
{% endcompress %}"""
221221

222-
out = '\n'.join([
223-
script(src="/media/CACHE/js/one.95cfb869eead.js"),
224-
script(scripttype="", src="/media/js/one.js"),
225-
script(src="/media/CACHE/js/one.81a2cd965815.js")])
222+
out = '\n'.join([script(src="/media/CACHE/js/one.95cfb869eead.js"),
223+
script(scripttype="", src="/media/js/one.js"),
224+
script(src="/media/CACHE/js/one.81a2cd965815.js")])
226225

227226
self.assertEqual(out, render(template, self.context))
228227
finally:
@@ -239,9 +238,8 @@ def test_css_multiple_files_disabled_compression(self):
239238
<link rel="stylesheet" type="text/css" href="{{ MEDIA_URL }}css/two.css"></link>
240239
{% endcompress %}"""
241240

242-
out = ''.join([
243-
'<link rel="stylesheet" type="text/css" href="/media/css/one.css" />',
244-
'<link rel="stylesheet" type="text/css" href="/media/css/two.css" />'])
241+
out = ''.join(['<link rel="stylesheet" type="text/css" href="/media/css/one.css" />',
242+
'<link rel="stylesheet" type="text/css" href="/media/css/two.css" />'])
245243

246244
self.assertEqual(out, render(template, self.context))
247245
finally:
@@ -259,10 +257,9 @@ def test_css_multiple_files_mixed_precompile_disabled_compression(self):
259257
<link rel="stylesheet" type="text/less" href="{{ MEDIA_URL }}css/url/test.css"/>
260258
{% endcompress %}"""
261259

262-
out = ''.join([
263-
'<link rel="stylesheet" type="text/css" href="/media/css/one.css" />',
264-
'<link rel="stylesheet" type="text/css" href="/media/css/two.css" />',
265-
'<link rel="stylesheet" href="/media/CACHE/css/test.c4f8a285c249.css" type="text/css" />'])
260+
out = ''.join(['<link rel="stylesheet" type="text/css" href="/media/css/one.css" />',
261+
'<link rel="stylesheet" type="text/css" href="/media/css/two.css" />',
262+
'<link rel="stylesheet" href="/media/CACHE/css/test.c4f8a285c249.css" type="text/css" />'])
266263
self.assertEqual(out, render(template, self.context))
267264
finally:
268265
settings.COMPRESS_ENABLED = self.old_enabled

compressor/utils/stringformat.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,7 @@ def _strformat(value, format_spec=""):
6161
# TODO: thousand separator
6262
pass
6363
try:
64-
if ((is_numeric and conversion == 's') or
65-
(not is_integer and conversion in set('cdoxX'))):
64+
if ((is_numeric and conversion == 's') or (not is_integer and conversion in set('cdoxX'))):
6665
raise ValueError
6766
if conversion == 'c':
6867
conversion = 's'

docs/conf.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
# All configuration values have a default; values that are commented out
1212
# serve to show the default.
1313

14-
import sys, os
14+
import sys
15+
import os
1516

1617
# If extensions (or modules to document with autodoc) are in another directory,
1718
# add these directories to sys.path here. If the directory is relative to the
@@ -182,8 +183,8 @@
182183
# Grouping the document tree into LaTeX files. List of tuples
183184
# (source start file, target name, title, author, documentclass [howto/manual]).
184185
latex_documents = [
185-
('index', 'django-compressor.tex', u'Django Compressor Documentation',
186-
u'Django Compressor authors', 'manual'),
186+
('index', 'django-compressor.tex', u'Django Compressor Documentation',
187+
u'Django Compressor authors', 'manual'),
187188
]
188189

189190
# The name of an image file (relative to this directory) to place at the top of

setup.py

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,11 @@ def find_version(*file_paths):
3232
# Note: you may want to copy this into your setup.py file verbatim, as
3333
# you can't import this from another package, when you don't know if
3434
# that package is installed yet.
35-
def find_package_data(
36-
where='.', package='',
37-
exclude=standard_exclude,
38-
exclude_directories=standard_exclude_directories,
39-
only_in_packages=True,
40-
show_ignored=False):
35+
def find_package_data(where='.', package='',
36+
exclude=standard_exclude,
37+
exclude_directories=standard_exclude_directories,
38+
only_in_packages=True,
39+
show_ignored=False):
4140
"""
4241
Return a dictionary suitable for use in ``package_data``
4342
in a distutils ``setup.py`` file.
@@ -74,8 +73,7 @@ def find_package_data(
7473
if os.path.isdir(fn):
7574
bad_name = False
7675
for pattern in exclude_directories:
77-
if (fnmatchcase(name, pattern)
78-
or fn.lower() == pattern.lower()):
76+
if (fnmatchcase(name, pattern) or fn.lower() == pattern.lower()):
7977
bad_name = True
8078
if show_ignored:
8179
print >> sys.stderr, (
@@ -84,8 +82,7 @@ def find_package_data(
8482
break
8583
if bad_name:
8684
continue
87-
if (os.path.isfile(os.path.join(fn, '__init__.py'))
88-
and not prefix):
85+
if (os.path.isfile(os.path.join(fn, '__init__.py')) and not prefix):
8986
if not package:
9087
new_package = name
9188
else:
@@ -97,8 +94,7 @@ def find_package_data(
9794
# is a file
9895
bad_name = False
9996
for pattern in exclude:
100-
if (fnmatchcase(name, pattern)
101-
or fn.lower() == pattern.lower()):
97+
if (fnmatchcase(name, pattern) or fn.lower() == pattern.lower()):
10298
bad_name = True
10399
if show_ignored:
104100
print >> sys.stderr, (

0 commit comments

Comments
 (0)