Permalink
Browse files

Fixed flake8 E241

  • Loading branch information...
1 parent ee48f4a commit e737c009b81df4a0126d61234e1d55f19956a78b @brabadu brabadu committed Nov 2, 2013
@@ -234,7 +234,7 @@ class Distance(MeasureBase):
'british_yd': 0.914398414616,
'clarke_ft': 0.3047972654,
'clarke_link': 0.201166195164,
- 'fathom': 1.8288,
+ 'fathom': 1.8288,
'ft': 0.3048,
'german_m': 1.0000135965,
'gold_coast_ft': 0.304799710181508,
@@ -49,7 +49,7 @@ def test_geofeed_rss(self):
# Incrementing through the feeds.
for feed in [feed1, feed2]:
# Ensuring the georss namespace was added to the <rss> element.
- self.assertEqual(feed.getAttribute('xmlns:georss'), 'http://www.georss.org/georss')
+ self.assertEqual(feed.getAttribute('xmlns:georss'), 'http://www.georss.org/georss')
chan = feed.getElementsByTagName('channel')[0]
items = chan.getElementsByTagName('item')
self.assertEqual(len(items), City.objects.count())
@@ -69,7 +69,7 @@ def test_geofeed_atom(self):
for feed in [feed1, feed2]:
# Ensuring the georsss namespace was added to the <feed> element.
- self.assertEqual(feed.getAttribute('xmlns:georss'), 'http://www.georss.org/georss')
+ self.assertEqual(feed.getAttribute('xmlns:georss'), 'http://www.georss.org/georss')
entries = feed.getElementsByTagName('entry')
self.assertEqual(len(entries), City.objects.count())
@@ -27,7 +27,7 @@ def test02_select_related(self):
cities = (
('Aurora', 'TX', -97.516111, 33.058333),
('Roswell', 'NM', -104.528056, 33.387222),
- ('Kecksburg', 'PA', -79.460734, 40.18476),
+ ('Kecksburg', 'PA', -79.460734, 40.18476),
)
for qs in (qs1, qs2, qs3):
@@ -6,9 +6,11 @@
PING_URL = "http://www.google.com/webmasters/tools/ping"
+
class SitemapNotFound(Exception):
pass
+
def ping_google(sitemap_url=None, ping_url=PING_URL):
"""
Alerts Google that the sitemap for the current site has been updated.
@@ -35,6 +37,7 @@ def ping_google(sitemap_url=None, ping_url=PING_URL):
params = urlencode({'sitemap': url})
urlopen("%s?%s" % (ping_url, params))
+
class Sitemap(object):
# This limit is defined by Google. See the index documentation at
# http://sitemaps.org/protocol.php#index.
@@ -94,22 +97,24 @@ def get_urls(self, page=1, site=None, protocol=None):
(latest_lastmod is None or lastmod > latest_lastmod)):
latest_lastmod = lastmod
url_info = {
- 'item': item,
- 'location': loc,
- 'lastmod': lastmod,
+ 'item': item,
+ 'location': loc,
+ 'lastmod': lastmod,
'changefreq': self.__get('changefreq', item, None),
- 'priority': str(priority if priority is not None else ''),
+ 'priority': str(priority if priority is not None else ''),
}
urls.append(url_info)
if all_items_lastmod and latest_lastmod:
self.latest_lastmod = latest_lastmod
return urls
+
class FlatPageSitemap(Sitemap):
def items(self):
current_site = Site.objects.get_current()
return current_site.flatpage_set.filter(registration_required=False)
+
class GenericSitemap(Sitemap):
priority = None
changefreq = None
@@ -72,9 +72,9 @@ def loaddata(self, fixture_labels):
self.serialization_formats = serializers.get_public_serializer_formats()
self.compression_formats = {
- None: open,
- 'gz': gzip.GzipFile,
- 'zip': SingleZipReader
+ None: open,
+ 'gz': gzip.GzipFile,
+ 'zip': SingleZipReader
}
if has_bz2:
self.compression_formats['bz2'] = bz2.BZ2File
@@ -111,7 +111,7 @@ def get_validation_errors(outfile, app=None):
try:
max_digits = int(f.max_digits)
if max_digits <= 0:
- e.add(opts, mdigits_msg % f.name)
+ e.add(opts, mdigits_msg % f.name)
else:
mdigits_ok = True
except (ValueError, TypeError):
@@ -19,6 +19,7 @@
RE_DATE = re.compile(r'(\d{4})-(\d\d?)-(\d\d?)$')
+
def _parse_date_fmt():
fmt = get_format('DATE_FORMAT')
escaped = False
@@ -39,6 +40,7 @@ def _parse_date_fmt():
#if not self.first_select: self.first_select = 'day'
return output
+
class SelectDateWidget(Widget):
"""
A Widget that splits date input into three <select> boxes.
@@ -90,7 +92,7 @@ def render(self, name, value, attrs=None):
choices = list(six.iteritems(self.months))
month_html = self.create_select(name, self.month_field, value, month_val, choices)
choices = [(i, i) for i in range(1, 32)]
- day_html = self.create_select(name, self.day_field, value, day_val, choices)
+ day_html = self.create_select(name, self.day_field, value, day_val, choices)
output = []
for field in _parse_date_fmt():
View
@@ -222,21 +222,21 @@ def _base_environ(self, **request):
# - REMOTE_ADDR: often useful, see #8551.
# See http://www.python.org/dev/peps/pep-3333/#environ-variables
environ = {
- 'HTTP_COOKIE': self.cookies.output(header='', sep='; '),
- 'PATH_INFO': str('/'),
- 'REMOTE_ADDR': str('127.0.0.1'),
- 'REQUEST_METHOD': str('GET'),
- 'SCRIPT_NAME': str(''),
- 'SERVER_NAME': str('testserver'),
- 'SERVER_PORT': str('80'),
- 'SERVER_PROTOCOL': str('HTTP/1.1'),
- 'wsgi.version': (1, 0),
- 'wsgi.url_scheme': str('http'),
- 'wsgi.input': FakePayload(b''),
- 'wsgi.errors': self.errors,
+ 'HTTP_COOKIE': self.cookies.output(header='', sep='; '),
+ 'PATH_INFO': str('/'),
+ 'REMOTE_ADDR': str('127.0.0.1'),
+ 'REQUEST_METHOD': str('GET'),
+ 'SCRIPT_NAME': str(''),
+ 'SERVER_NAME': str('testserver'),
+ 'SERVER_PORT': str('80'),
+ 'SERVER_PROTOCOL': str('HTTP/1.1'),
+ 'wsgi.version': (1, 0),
+ 'wsgi.url_scheme': str('http'),
+ 'wsgi.input': FakePayload(b''),
+ 'wsgi.errors': self.errors,
'wsgi.multiprocess': True,
- 'wsgi.multithread': False,
- 'wsgi.run_once': False,
+ 'wsgi.multithread': False,
+ 'wsgi.run_once': False,
}
environ.update(self.defaults)
environ.update(request)
@@ -327,16 +327,16 @@ def generic(self, method, path, data='',
parsed = urlparse(path)
data = force_bytes(data, settings.DEFAULT_CHARSET)
r = {
- 'PATH_INFO': self._get_path(parsed),
+ 'PATH_INFO': self._get_path(parsed),
'REQUEST_METHOD': str(method),
'SERVER_PORT': str('443') if secure else str('80'),
'wsgi.url_scheme': str('https') if secure else str('http'),
}
if data:
r.update({
'CONTENT_LENGTH': len(data),
- 'CONTENT_TYPE': str(content_type),
- 'wsgi.input': FakePayload(data),
+ 'CONTENT_TYPE': str(content_type),
+ 'wsgi.input': FakePayload(data),
})
r.update(extra)
# If QUERY_STRING is absent or empty, we want to extract it from the URL.
@@ -23,7 +23,7 @@
__all__ = (
- 'Approximate', 'ContextList', 'get_runner', 'override_settings',
+ 'Approximate', 'ContextList', 'get_runner', 'override_settings',
'requires_tz_support', 'setup_test_environment', 'teardown_test_environment',
)
View
@@ -2,6 +2,7 @@
# Originally from https://bitbucket.org/ned/jslex
import re
+
class Tok(object):
"""
A specification for a token class.
@@ -15,6 +16,7 @@ def __init__(self, name, regex, next=None):
self.regex = regex
self.next = next
+
def literals(choices, prefix="", suffix=""):
"""
Create a regex from a space-separated list of literal `choices`.
@@ -97,49 +99,49 @@ class JsLexer(Lexer):
# http://inimino.org/~inimino/blog/javascript_semicolons
both_before = [
- Tok("comment", r"/\*(.|\n)*?\*/"),
- Tok("linecomment", r"//.*?$"),
- Tok("ws", r"\s+"),
- Tok("keyword", literals("""
- break case catch class const continue debugger
- default delete do else enum export extends
- finally for function if import in instanceof
- new return super switch this throw try typeof
- var void while with
- """, suffix=r"\b"), next='reg'),
- Tok("reserved", literals("null true false", suffix=r"\b"), next='div'),
- Tok("id", r"""
- ([a-zA-Z_$ ]|\\u[0-9a-fA-Z]{4}) # first char
- ([a-zA-Z_$0-9]|\\u[0-9a-fA-F]{4})* # rest chars
- """, next='div'),
- Tok("hnum", r"0[xX][0-9a-fA-F]+", next='div'),
- Tok("onum", r"0[0-7]+"),
- Tok("dnum", r"""
- ( (0|[1-9][0-9]*) # DecimalIntegerLiteral
- \. # dot
- [0-9]* # DecimalDigits-opt
- ([eE][-+]?[0-9]+)? # ExponentPart-opt
- |
- \. # dot
- [0-9]+ # DecimalDigits
- ([eE][-+]?[0-9]+)? # ExponentPart-opt
- |
- (0|[1-9][0-9]*) # DecimalIntegerLiteral
- ([eE][-+]?[0-9]+)? # ExponentPart-opt
- )
- """, next='div'),
- Tok("punct", literals("""
- >>>= === !== >>> <<= >>= <= >= == != << >> &&
- || += -= *= %= &= |= ^=
- """), next="reg"),
- Tok("punct", literals("++ -- ) ]"), next='div'),
- Tok("punct", literals("{ } ( [ . ; , < > + - * % & | ^ ! ~ ? : ="), next='reg'),
- Tok("string", r'"([^"\\]|(\\(.|\n)))*?"', next='div'),
- Tok("string", r"'([^'\\]|(\\(.|\n)))*?'", next='div'),
+ Tok("comment", r"/\*(.|\n)*?\*/"),
+ Tok("linecomment", r"//.*?$"),
+ Tok("ws", r"\s+"),
+ Tok("keyword", literals("""
+ break case catch class const continue debugger
+ default delete do else enum export extends
+ finally for function if import in instanceof
+ new return super switch this throw try typeof
+ var void while with
+ """, suffix=r"\b"), next='reg'),
+ Tok("reserved", literals("null true false", suffix=r"\b"), next='div'),
+ Tok("id", r"""
+ ([a-zA-Z_$ ]|\\u[0-9a-fA-Z]{4}) # first char
+ ([a-zA-Z_$0-9]|\\u[0-9a-fA-F]{4})* # rest chars
+ """, next='div'),
+ Tok("hnum", r"0[xX][0-9a-fA-F]+", next='div'),
+ Tok("onum", r"0[0-7]+"),
+ Tok("dnum", r"""
+ ( (0|[1-9][0-9]*) # DecimalIntegerLiteral
+ \. # dot
+ [0-9]* # DecimalDigits-opt
+ ([eE][-+]?[0-9]+)? # ExponentPart-opt
+ |
+ \. # dot
+ [0-9]+ # DecimalDigits
+ ([eE][-+]?[0-9]+)? # ExponentPart-opt
+ |
+ (0|[1-9][0-9]*) # DecimalIntegerLiteral
+ ([eE][-+]?[0-9]+)? # ExponentPart-opt
+ )
+ """, next='div'),
+ Tok("punct", literals("""
+ >>>= === !== >>> <<= >>= <= >= == != << >> &&
+ || += -= *= %= &= |= ^=
+ """), next="reg"),
+ Tok("punct", literals("++ -- ) ]"), next='div'),
+ Tok("punct", literals("{ } ( [ . ; , < > + - * % & | ^ ! ~ ? : ="), next='reg'),
+ Tok("string", r'"([^"\\]|(\\(.|\n)))*?"', next='div'),
+ Tok("string", r"'([^'\\]|(\\(.|\n)))*?'", next='div'),
]
both_after = [
- Tok("other", r"."),
+ Tok("other", r"."),
]
states = {
Oops, something went wrong. Retry.

0 comments on commit e737c00

Please sign in to comment.