Fix PEP8 errors reported by the new flake8 version (except E128, which we ignore for the time being)

This commit is contained in:
Mathieu Pillard
2012-07-17 15:24:39 +02:00
parent 3723a67bf4
commit 73f8127b0f
8 changed files with 25 additions and 33 deletions

View File

@@ -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 File

@@ -91,8 +91,7 @@ class CompressorMixin(object):
# 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)}

View File

@@ -219,8 +219,7 @@ class PrecompilerTemplatetagTestCase(TestCase):
</script>
{% endcompress %}"""
out = '\n'.join([
script(src="/media/CACHE/js/one.95cfb869eead.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")])
@@ -239,8 +238,7 @@ class PrecompilerTemplatetagTestCase(TestCase):
<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" />',
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))
@@ -259,8 +257,7 @@ class PrecompilerTemplatetagTestCase(TestCase):
<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" />',
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))

View File

@@ -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 File

@@ -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

View File

@@ -32,8 +32,7 @@ standard_exclude_directories = ('.*', 'CVS', '_darcs', './build',
# 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='',
def find_package_data(where='.', package='',
exclude=standard_exclude,
exclude_directories=standard_exclude_directories,
only_in_packages=True,
@@ -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, (