Permalink
Browse files

Fix PEP8 errors reported by the new flake8 version (except E128, whic…

…h we ignore for the time being)
  • Loading branch information...
1 parent 3723a67 commit 73f8127b0f3f094e63f30f06e96c11ca51811090 @diox diox committed Jul 17, 2012
View
@@ -12,7 +12,7 @@ install:
- pip install -e .
- pip install -r requirements/tests.txt Django==$DJANGO
before_script:
- - flake8 compressor --ignore=E501
+ - flake8 compressor --ignore=E501,E128
script:
- make test
env:
View
@@ -113,7 +113,7 @@ def get_filecontent(self, filename, charset):
return fd.read()
except IOError, e:
raise UncompressableFileError("IOError while processing "
- "'%s': %s" % (filename, e))
+ "'%s': %s" % (filename, e))
except UnicodeDecodeError, e:
raise UncompressableFileError("UnicodeDecodeError while "
"processing '%s' with "
@@ -19,7 +19,7 @@ def parse(self, parser):
if args[0].value not in self.compressors:
raise TemplateSyntaxError('compress kind may be one of: %s' %
(', '.join(self.compressors.keys())),
- lineno)
+ lineno)
if parser.stream.skip_if('comma'):
modearg = parser.parse_expression()
# Allow mode to be defined as jinja2 name node
@@ -91,8 +91,7 @@ def render_compressed(self, context, kind, mode, forced=False):
# Take a shortcut if we really don't have anything to do
if ((not settings.COMPRESS_ENABLED and
- not settings.COMPRESS_PRECOMPILERS)
- and not forced):
+ not settings.COMPRESS_PRECOMPILERS) and not forced):
return self.get_original_content(context)
context['compressed'] = {'name': getattr(self, 'name', None)}
@@ -219,10 +219,9 @@ def test_multiple_file_order_conserved(self):
</script>
{% endcompress %}"""
- out = '\n'.join([
- script(src="/media/CACHE/js/one.95cfb869eead.js"),
- script(scripttype="", src="/media/js/one.js"),
- script(src="/media/CACHE/js/one.81a2cd965815.js")])
+ out = '\n'.join([script(src="/media/CACHE/js/one.95cfb869eead.js"),
+ script(scripttype="", src="/media/js/one.js"),
+ script(src="/media/CACHE/js/one.81a2cd965815.js")])
self.assertEqual(out, render(template, self.context))
finally:
@@ -239,9 +238,8 @@ def test_css_multiple_files_disabled_compression(self):
<link rel="stylesheet" type="text/css" href="{{ MEDIA_URL }}css/two.css"></link>
{% endcompress %}"""
- out = ''.join([
- '<link rel="stylesheet" type="text/css" href="/media/css/one.css" />',
- '<link rel="stylesheet" type="text/css" href="/media/css/two.css" />'])
+ out = ''.join(['<link rel="stylesheet" type="text/css" href="/media/css/one.css" />',
+ '<link rel="stylesheet" type="text/css" href="/media/css/two.css" />'])
self.assertEqual(out, render(template, self.context))
finally:
@@ -259,10 +257,9 @@ def test_css_multiple_files_mixed_precompile_disabled_compression(self):
<link rel="stylesheet" type="text/less" href="{{ MEDIA_URL }}css/url/test.css"/>
{% endcompress %}"""
- out = ''.join([
- '<link rel="stylesheet" type="text/css" href="/media/css/one.css" />',
- '<link rel="stylesheet" type="text/css" href="/media/css/two.css" />',
- '<link rel="stylesheet" href="/media/CACHE/css/test.c4f8a285c249.css" type="text/css" />'])
+ out = ''.join(['<link rel="stylesheet" type="text/css" href="/media/css/one.css" />',
+ '<link rel="stylesheet" type="text/css" href="/media/css/two.css" />',
+ '<link rel="stylesheet" href="/media/CACHE/css/test.c4f8a285c249.css" type="text/css" />'])
self.assertEqual(out, render(template, self.context))
finally:
settings.COMPRESS_ENABLED = self.old_enabled
@@ -61,8 +61,7 @@ def _strformat(value, format_spec=""):
# TODO: thousand separator
pass
try:
- if ((is_numeric and conversion == 's') or
- (not is_integer and conversion in set('cdoxX'))):
+ if ((is_numeric and conversion == 's') or (not is_integer and conversion in set('cdoxX'))):
raise ValueError
if conversion == 'c':
conversion = 's'
View
@@ -11,7 +11,8 @@
# All configuration values have a default; values that are commented out
# serve to show the default.
-import sys, os
+import sys
+import os
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
@@ -182,8 +183,8 @@
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
- ('index', 'django-compressor.tex', u'Django Compressor Documentation',
- u'Django Compressor authors', 'manual'),
+ ('index', 'django-compressor.tex', u'Django Compressor Documentation',
+ u'Django Compressor authors', 'manual'),
]
# The name of an image file (relative to this directory) to place at the top of
View
@@ -32,12 +32,11 @@ def find_version(*file_paths):
# Note: you may want to copy this into your setup.py file verbatim, as
# you can't import this from another package, when you don't know if
# that package is installed yet.
-def find_package_data(
- where='.', package='',
- exclude=standard_exclude,
- exclude_directories=standard_exclude_directories,
- only_in_packages=True,
- show_ignored=False):
+def find_package_data(where='.', package='',
+ exclude=standard_exclude,
+ exclude_directories=standard_exclude_directories,
+ only_in_packages=True,
+ show_ignored=False):
"""
Return a dictionary suitable for use in ``package_data``
in a distutils ``setup.py`` file.
@@ -74,8 +73,7 @@ def find_package_data(
if os.path.isdir(fn):
bad_name = False
for pattern in exclude_directories:
- if (fnmatchcase(name, pattern)
- or fn.lower() == pattern.lower()):
+ if (fnmatchcase(name, pattern) or fn.lower() == pattern.lower()):
bad_name = True
if show_ignored:
print >> sys.stderr, (
@@ -84,8 +82,7 @@ def find_package_data(
break
if bad_name:
continue
- if (os.path.isfile(os.path.join(fn, '__init__.py'))
- and not prefix):
+ if (os.path.isfile(os.path.join(fn, '__init__.py')) and not prefix):
if not package:
new_package = name
else:
@@ -97,8 +94,7 @@ def find_package_data(
# is a file
bad_name = False
for pattern in exclude:
- if (fnmatchcase(name, pattern)
- or fn.lower() == pattern.lower()):
+ if (fnmatchcase(name, pattern) or fn.lower() == pattern.lower()):
bad_name = True
if show_ignored:
print >> sys.stderr, (

0 comments on commit 73f8127

Please sign in to comment.