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 -e .
- pip install -r requirements/tests.txt Django==$DJANGO - pip install -r requirements/tests.txt Django==$DJANGO
before_script: before_script:
- flake8 compressor --ignore=E501 - flake8 compressor --ignore=E501,E128
script: script:
- make test - make test
env: env:

View File

@@ -91,8 +91,7 @@ class CompressorMixin(object):
# Take a shortcut if we really don't have anything to do # Take a shortcut if we really don't have anything to do
if ((not settings.COMPRESS_ENABLED and if ((not settings.COMPRESS_ENABLED and
not settings.COMPRESS_PRECOMPILERS) not settings.COMPRESS_PRECOMPILERS) and not forced):
and not forced):
return self.get_original_content(context) return self.get_original_content(context)
context['compressed'] = {'name': getattr(self, 'name', None)} context['compressed'] = {'name': getattr(self, 'name', None)}

View File

@@ -219,8 +219,7 @@ class PrecompilerTemplatetagTestCase(TestCase):
</script> </script>
{% endcompress %}""" {% endcompress %}"""
out = '\n'.join([ out = '\n'.join([script(src="/media/CACHE/js/one.95cfb869eead.js"),
script(src="/media/CACHE/js/one.95cfb869eead.js"),
script(scripttype="", src="/media/js/one.js"), script(scripttype="", src="/media/js/one.js"),
script(src="/media/CACHE/js/one.81a2cd965815.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> <link rel="stylesheet" type="text/css" href="{{ MEDIA_URL }}css/two.css"></link>
{% endcompress %}""" {% endcompress %}"""
out = ''.join([ out = ''.join(['<link rel="stylesheet" type="text/css" href="/media/css/one.css" />',
'<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" type="text/css" href="/media/css/two.css" />'])
self.assertEqual(out, render(template, self.context)) 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"/> <link rel="stylesheet" type="text/less" href="{{ MEDIA_URL }}css/url/test.css"/>
{% endcompress %}""" {% endcompress %}"""
out = ''.join([ out = ''.join(['<link rel="stylesheet" type="text/css" href="/media/css/one.css" />',
'<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" type="text/css" href="/media/css/two.css" />',
'<link rel="stylesheet" href="/media/CACHE/css/test.c4f8a285c249.css" type="text/css" />']) '<link rel="stylesheet" href="/media/CACHE/css/test.c4f8a285c249.css" type="text/css" />'])
self.assertEqual(out, render(template, self.context)) self.assertEqual(out, render(template, self.context))

View File

@@ -61,8 +61,7 @@ def _strformat(value, format_spec=""):
# TODO: thousand separator # TODO: thousand separator
pass pass
try: try:
if ((is_numeric and conversion == 's') or if ((is_numeric and conversion == 's') or (not is_integer and conversion in set('cdoxX'))):
(not is_integer and conversion in set('cdoxX'))):
raise ValueError raise ValueError
if conversion == 'c': if conversion == 'c':
conversion = 's' conversion = 's'

View File

@@ -11,7 +11,8 @@
# All configuration values have a default; values that are commented out # All configuration values have a default; values that are commented out
# serve to show the default. # serve to show the default.
import sys, os import sys
import os
# If extensions (or modules to document with autodoc) are in another directory, # 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 # 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 # 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 # you can't import this from another package, when you don't know if
# that package is installed yet. # that package is installed yet.
def find_package_data( def find_package_data(where='.', package='',
where='.', package='',
exclude=standard_exclude, exclude=standard_exclude,
exclude_directories=standard_exclude_directories, exclude_directories=standard_exclude_directories,
only_in_packages=True, only_in_packages=True,
@@ -74,8 +73,7 @@ def find_package_data(
if os.path.isdir(fn): if os.path.isdir(fn):
bad_name = False bad_name = False
for pattern in exclude_directories: for pattern in exclude_directories:
if (fnmatchcase(name, pattern) if (fnmatchcase(name, pattern) or fn.lower() == pattern.lower()):
or fn.lower() == pattern.lower()):
bad_name = True bad_name = True
if show_ignored: if show_ignored:
print >> sys.stderr, ( print >> sys.stderr, (
@@ -84,8 +82,7 @@ def find_package_data(
break break
if bad_name: if bad_name:
continue continue
if (os.path.isfile(os.path.join(fn, '__init__.py')) if (os.path.isfile(os.path.join(fn, '__init__.py')) and not prefix):
and not prefix):
if not package: if not package:
new_package = name new_package = name
else: else:
@@ -97,8 +94,7 @@ def find_package_data(
# is a file # is a file
bad_name = False bad_name = False
for pattern in exclude: for pattern in exclude:
if (fnmatchcase(name, pattern) if (fnmatchcase(name, pattern) or fn.lower() == pattern.lower()):
or fn.lower() == pattern.lower()):
bad_name = True bad_name = True
if show_ignored: if show_ignored:
print >> sys.stderr, ( print >> sys.stderr, (