Fixed all E261 warnings

This commit is contained in:
coagulant 2013-11-03 01:02:56 +04:00 committed by Tim Graham
parent 2a03a9a9a1
commit 3bc0d46a84
154 changed files with 647 additions and 647 deletions

View File

@ -36,11 +36,11 @@ DATETIME_INPUT_FORMATS = (
'%d.%m.%y. %H:%M', # '25.10.06. 14:30'
'%d.%m.%y.', # '25.10.06.'
'%d. %m. %Y. %H:%M:%S', # '25. 10. 2006. 14:30:59'
'%d. %m. %Y. %H:%M:%S.%f',# '25. 10. 2006. 14:30:59.000200'
'%d. %m. %Y. %H:%M:%S.%f', # '25. 10. 2006. 14:30:59.000200'
'%d. %m. %Y. %H:%M', # '25. 10. 2006. 14:30'
'%d. %m. %Y.', # '25. 10. 2006.'
'%d. %m. %y. %H:%M:%S', # '25. 10. 06. 14:30:59'
'%d. %m. %y. %H:%M:%S.%f',# '25. 10. 06. 14:30:59.000200'
'%d. %m. %y. %H:%M:%S.%f', # '25. 10. 06. 14:30:59.000200'
'%d. %m. %y. %H:%M', # '25. 10. 06. 14:30'
'%d. %m. %y.', # '25. 10. 06.'
)

View File

@ -91,7 +91,7 @@ class LineString(GEOSGeometry):
_get_single_internal = _get_single_external
def _set_list(self, length, items):
ndim = self._cs.dims #
ndim = self._cs.dims
hasz = self._cs.hasz # I don't understand why these are different
# create a new coordinate sequence and populate accordingly

View File

@ -286,7 +286,7 @@ class LayerMapping(object):
else:
raise TypeError('Unique keyword argument must be set with a tuple, list, or string.')
#### Keyword argument retrieval routines ####
# Keyword argument retrieval routines ####
def feature_kwargs(self, feat):
"""
Given an OGR Feature, this will return a dictionary of keyword arguments

View File

@ -388,7 +388,7 @@ class CacheDBSessionTests(SessionTestsMixin, TestCase):
@override_settings(SESSION_CACHE_ALIAS='sessions')
def test_non_default_cache(self):
#21000 - CacheDB backend should respect SESSION_CACHE_ALIAS.
# 21000 - CacheDB backend should respect SESSION_CACHE_ALIAS.
self.assertRaises(InvalidCacheBackendError, self.backend)

View File

@ -64,7 +64,7 @@ class FileUploadHandler(object):
"""
Base class for streaming upload handlers.
"""
chunk_size = 64 * 2 ** 10 #: The default chunk size is 64 KB.
chunk_size = 64 * 2 ** 10 # : The default chunk size is 64 KB.
def __init__(self, request=None):
self.file_name = None

View File

@ -127,7 +127,7 @@ class MultiPartParser(object):
self._content_length,
self._boundary,
encoding)
#Check to see if it was handled
# Check to see if it was handled
if result is not None:
return result[0], result[1]
@ -483,7 +483,7 @@ class BoundaryIter(six.Iterator):
else:
# make sure we dont treat a partial boundary (and
# its separators) as data
if not chunk[:-rollback]:# and len(chunk) >= (len(self._boundary) + 6):
if not chunk[:-rollback]: # and len(chunk) >= (len(self._boundary) + 6):
# There's nothing left, we should just return and mark as done.
self._done = True
return chunk

View File

@ -249,13 +249,13 @@ class HttpRequest(object):
else:
self._post, self._files = QueryDict('', encoding=self._encoding), MultiValueDict()
## File-like and iterator interface.
##
## Expects self._stream to be set to an appropriate source of bytes by
## a corresponding request subclass (e.g. WSGIRequest).
## Also when request data has already been read by request.POST or
## request.body, self._stream points to a BytesIO instance
## containing that data.
# File-like and iterator interface.
#
# Expects self._stream to be set to an appropriate source of bytes by
# a corresponding request subclass (e.g. WSGIRequest).
# Also when request data has already been read by request.POST or
# request.body, self._stream points to a BytesIO instance
# containing that data.
def read(self, *args, **kwargs):
self._read_started = True

View File

@ -71,7 +71,7 @@ class ConvertingDict(dict):
def __getitem__(self, key):
value = dict.__getitem__(self, key)
result = self.configurator.convert(value)
#If the converted value is different, save for next time
# If the converted value is different, save for next time
if value is not result:
self[key] = result
if type(result) in (ConvertingDict, ConvertingList,
@ -83,7 +83,7 @@ class ConvertingDict(dict):
def get(self, key, default=None):
value = dict.get(self, key, default)
result = self.configurator.convert(value)
#If the converted value is different, save for next time
# If the converted value is different, save for next time
if value is not result:
self[key] = result
if type(result) in (ConvertingDict, ConvertingList,
@ -107,7 +107,7 @@ class ConvertingList(list):
def __getitem__(self, key):
value = list.__getitem__(self, key)
result = self.configurator.convert(value)
#If the converted value is different, save for next time
# If the converted value is different, save for next time
if value is not result:
self[key] = result
if type(result) in (ConvertingDict, ConvertingList,
@ -197,7 +197,7 @@ class BaseConfigurator(object):
else:
rest = rest[m.end():]
d = self.config[m.groups()[0]]
#print d, rest
# print d, rest
while rest:
m = self.DOT_PATTERN.match(rest)
if m:
@ -219,7 +219,7 @@ class BaseConfigurator(object):
else:
raise ValueError('Unable to convert '
'%r at %r' % (value, rest))
#rest should be empty
# rest should be empty
return d
def convert(self, value):
@ -359,25 +359,25 @@ class DictConfigurator(BaseConfigurator):
'%r: %s' % (name, e))
# Next, do loggers - they refer to handlers and filters
#we don't want to lose the existing loggers,
#since other threads may have pointers to them.
#existing is set to contain all existing loggers,
#and as we go through the new configuration we
#remove any which are configured. At the end,
#what's left in existing is the set of loggers
#which were in the previous configuration but
#which are not in the new configuration.
# we don't want to lose the existing loggers,
# since other threads may have pointers to them.
# existing is set to contain all existing loggers,
# and as we go through the new configuration we
# remove any which are configured. At the end,
# what's left in existing is the set of loggers
# which were in the previous configuration but
# which are not in the new configuration.
root = logging.root
existing = list(root.manager.loggerDict)
#The list needs to be sorted so that we can
#avoid disabling child loggers of explicitly
#named loggers. With a sorted list it is easier
#to find the child loggers.
# The list needs to be sorted so that we can
# avoid disabling child loggers of explicitly
# named loggers. With a sorted list it is easier
# to find the child loggers.
existing.sort()
#We'll keep the list of existing loggers
#which are children of named loggers here...
# We'll keep the list of existing loggers
# which are children of named loggers here...
child_loggers = []
#now set up the new ones...
# now set up the new ones...
loggers = config.get('loggers', EMPTY_DICT)
for name in loggers:
if name in existing:
@ -397,11 +397,11 @@ class DictConfigurator(BaseConfigurator):
raise ValueError('Unable to configure logger '
'%r: %s' % (name, e))
#Disable any old loggers. There's no point deleting
#them as other threads may continue to hold references
#and by disabling them, you stop them doing any logging.
#However, don't disable children of named loggers, as that's
#probably not what was intended by the user.
# Disable any old loggers. There's no point deleting
# them as other threads may continue to hold references
# and by disabling them, you stop them doing any logging.
# However, don't disable children of named loggers, as that's
# probably not what was intended by the user.
for log in existing:
logger = root.manager.loggerDict[log]
if log in child_loggers:
@ -431,9 +431,9 @@ class DictConfigurator(BaseConfigurator):
except TypeError as te:
if "'format'" not in str(te):
raise
#Name of parameter changed from fmt to format.
#Retry with old name.
#This is so that code can be used with older Python versions
# Name of parameter changed from fmt to format.
# Retry with old name.
# This is so that code can be used with older Python versions
#(e.g. by Django)
config['fmt'] = config.pop('format')
config['()'] = factory
@ -479,7 +479,7 @@ class DictConfigurator(BaseConfigurator):
factory = c
else:
klass = self.resolve(config.pop('class'))
#Special case for handler which refers to another handler
# Special case for handler which refers to another handler
if issubclass(klass, logging.handlers.MemoryHandler) and\
'target' in config:
try:
@ -500,9 +500,9 @@ class DictConfigurator(BaseConfigurator):
except TypeError as te:
if "'stream'" not in str(te):
raise
#The argument name changed from strm to stream
#Retry with old name.
#This is so that code can be used with older Python versions
# The argument name changed from strm to stream
# Retry with old name.
# This is so that code can be used with older Python versions
#(e.g. by Django)
kwargs['strm'] = kwargs.pop('stream')
result = factory(**kwargs)
@ -530,7 +530,7 @@ class DictConfigurator(BaseConfigurator):
if level is not None:
logger.setLevel(_checkLevel(level))
if not incremental:
#Remove any existing handlers
# Remove any existing handlers
for h in logger.handlers[:]:
logger.removeHandler(h)
handlers = config.get('handlers', None)

View File

@ -4,7 +4,7 @@ install-script = scripts/rpm-install.sh
[flake8]
exclude=./django/utils/dictconfig.py,./django/contrib/comments/*,./django/utils/unittest.py,./tests/comment_tests/*,./django/test/_doctest.py,./django/utils/six.py,./django/conf/app_template/*
ignore=E124,E125,E127,E128,E226,E251,E302,E501,E261,W601
ignore=E124,E125,E127,E128,E226,E251,E302,E501,W601
[metadata]
license-file = LICENSE

View File

@ -70,7 +70,7 @@ class AggregationTests(TestCase):
Regression test for #11916: Extra params + aggregation creates
incorrect SQL.
"""
#oracle doesn't support subqueries in group by clause
# oracle doesn't support subqueries in group by clause
shortest_book_sql = """
SELECT name
FROM aggregation_regress_book b

View File

@ -304,12 +304,12 @@ class AdminActionsTests(CommentTestCase):
makeModerator("normaluser")
self.client.login(username="normaluser", password="normaluser")
with translation.override('en'):
#Test approving
# Test approving
self.performActionAndCheckMessage('approve_comments', one_comment, '1 comment was successfully approved')
self.performActionAndCheckMessage('approve_comments', many_comments, '3 comments were successfully approved')
#Test flagging
# Test flagging
self.performActionAndCheckMessage('flag_comments', one_comment, '1 comment was successfully flagged')
self.performActionAndCheckMessage('flag_comments', many_comments, '3 comments were successfully flagged')
#Test removing
# Test removing
self.performActionAndCheckMessage('remove_comments', one_comment, '1 comment was successfully removed')
self.performActionAndCheckMessage('remove_comments', many_comments, '3 comments were successfully removed')

View File

@ -37,7 +37,7 @@ class DataTypesTestCase(TestCase):
self.assertEqual(d2.consumed_at, datetime.datetime(2007, 4, 20, 16, 19, 59))
def test_time_field(self):
#Test for ticket #12059: TimeField wrongly handling datetime.datetime object.
# Test for ticket #12059: TimeField wrongly handling datetime.datetime object.
d = Donut(name='Apple Fritter')
d.baked_time = datetime.datetime(year=2007, month=4, day=20, hour=16, minute=19, second=59)
d.save()

View File

@ -191,7 +191,7 @@ class CustomTimeInputFormatsTests(SimpleTestCase):
result = f.clean('13.30.05')
self.assertEqual(result, time(13, 30, 5))
# # Check that the parsed result does a round trip to the same format
# Check that the parsed result does a round trip to the same format
text = f.widget._format_value(result)
self.assertEqual(text, "01:30:05 PM")
@ -385,7 +385,7 @@ class LocalizedDateTests(SimpleTestCase):
result = f.clean('12.21.2010')
self.assertEqual(result, date(2010, 12, 21))
# # Check that the parsed result does a round trip to the same format
# Check that the parsed result does a round trip to the same format
text = f.widget._format_value(result)
self.assertEqual(text, "21.12.2010")
@ -478,7 +478,7 @@ class CustomDateInputFormatsTests(SimpleTestCase):
result = f.clean('12.21.2010')
self.assertEqual(result, date(2010, 12, 21))
# # Check that the parsed result does a round trip to the same format
# Check that the parsed result does a round trip to the same format
text = f.widget._format_value(result)
self.assertEqual(text, "21.12.2010")
@ -671,7 +671,7 @@ class LocalizedDateTimeTests(SimpleTestCase):
result = f.clean('13.30.05 12.21.2010')
self.assertEqual(result, datetime(2010, 12, 21, 13, 30, 5))
# # Check that the parsed result does a round trip to the same format
# Check that the parsed result does a round trip to the same format
text = f.widget._format_value(result)
self.assertEqual(text, "21.12.2010 13:30:05")
@ -764,7 +764,7 @@ class CustomDateTimeInputFormatsTests(SimpleTestCase):
result = f.clean('12.21.2010 13:30:05')
self.assertEqual(result, datetime(2010, 12, 21, 13, 30, 5))
# # Check that the parsed result does a round trip to the same format
# Check that the parsed result does a round trip to the same format
text = f.widget._format_value(result)
self.assertEqual(text, "01:30:05 PM 21/12/2010")

View File

@ -315,11 +315,11 @@ class HttpResponseTests(unittest.TestCase):
self.assertEqual(r.get('test'), None)
def test_non_string_content(self):
#Bug 16494: HttpResponse should behave consistently with non-strings
# Bug 16494: HttpResponse should behave consistently with non-strings
r = HttpResponse(12345)
self.assertEqual(r.content, b'12345')
#test content via property
# test content via property
r = HttpResponse()
r.content = 12345
self.assertEqual(r.content, b'12345')
@ -328,7 +328,7 @@ class HttpResponseTests(unittest.TestCase):
r = HttpResponse(['abc', 'def', 'ghi'])
self.assertEqual(r.content, b'abcdefghi')
#test iter content via property
# test iter content via property
r = HttpResponse()
r.content = ['idan', 'alex', 'jacob']
self.assertEqual(r.content, b'idanalexjacob')
@ -337,13 +337,13 @@ class HttpResponseTests(unittest.TestCase):
r.content = [1, 2, 3]
self.assertEqual(r.content, b'123')
#test odd inputs
# test odd inputs
r = HttpResponse()
r.content = ['1', '2', 3, '\u079e']
#'\xde\x9e' == unichr(1950).encode('utf-8')
self.assertEqual(r.content, b'123\xde\x9e')
#with Content-Encoding header
# with Content-Encoding header
r = HttpResponse()
r['Content-Encoding'] = 'winning'
r.content = [b'abc', b'def']

View File

@ -423,7 +423,7 @@ class LocationCommentsTests(ExtractorTests):
# #21208 -- Leaky paths in comments on Windows e.g. #: path\to\file.html.py:123
bad_suffix = '.py'
bad_string = 'templates%stest.html%s' % (os.sep, bad_suffix) #
bad_string = 'templates%stest.html%s' % (os.sep, bad_suffix)
self.assertFalse(bad_string in po_contents, '"%s" shouldn\'t be in final .po file.' % bad_string)

View File

@ -1,4 +1,4 @@
#encoding=utf-8
# encoding=utf-8
"""
26. Invalid models

View File

@ -415,7 +415,7 @@ class ModelFormBaseTest(TestCase):
)
def test_bad_form(self):
#First class with a Meta class wins...
# First class with a Meta class wins...
class BadForm(ArticleForm, BaseCategoryForm):
pass
@ -818,10 +818,10 @@ class ModelToDictTests(TestCase):
with self.assertNumQueries(1):
d = model_to_dict(art)
#Ensure all many-to-many categories appear in model_to_dict
# Ensure all many-to-many categories appear in model_to_dict
for c in categories:
self.assertIn(c.pk, d['categories'])
#Ensure many-to-many relation appears as a list
# Ensure many-to-many relation appears as a list
self.assertIsInstance(d['categories'], list)
class OldFormForXTests(TestCase):

View File

@ -288,7 +288,7 @@ The end."""),
(im2m_obj, 470, M2MIntermediateData, None),
#testing post- and prereferences and extra fields
# testing post- and prereferences and extra fields
(im_obj, 480, Intermediate, {'right': 300, 'left': 470}),
(im_obj, 481, Intermediate, {'right': 300, 'left': 490}),
(im_obj, 482, Intermediate, {'right': 500, 'left': 470}),

View File

@ -352,7 +352,7 @@ def get_filter_tests():
'date01': (r'{{ d|date:"m" }}', {'d': datetime(2008, 1, 1)}, '01'),
'date02': (r'{{ d|date }}', {'d': datetime(2008, 1, 1)}, 'Jan. 1, 2008'),
#Ticket 9520: Make sure |date doesn't blow up on non-dates
# Ticket 9520: Make sure |date doesn't blow up on non-dates
'date03': (r'{{ d|date:"m" }}', {'d': 'fail_string'}, ''),
# ISO date formats
'date04': (r'{{ d|date:"o" }}', {'d': datetime(2008, 12, 29)}, '2009'),

View File

@ -840,7 +840,7 @@ class TemplateTests(TransRealMixin, TestCase):
# Numbers as filter arguments should work
'filter-syntax19': ('{{ var|truncatewords:1 }}', {"var": "hello world"}, "hello ..."),
#filters should accept empty string constants
# filters should accept empty string constants
'filter-syntax20': ('{{ ""|default_if_none:"was none" }}', {}, ""),
# Fail silently for non-callable attribute and dict lookups which

View File

@ -438,7 +438,7 @@ class ClientTest(TestCase):
"Request a page that is known to throw an error"
self.assertRaises(KeyError, self.client.get, "/test_client/broken_view/")
#Try the same assertion, a different way
# Try the same assertion, a different way
try:
self.client.get('/test_client/broken_view/')
self.fail('Should raise an error')

View File

@ -121,14 +121,14 @@ class AssertContainsTests(TestCase):
def test_unicode_contains(self):
"Unicode characters can be found in template context"
#Regression test for #10183
# Regression test for #10183
r = self.client.get('/test_client_regress/check_unicode/')
self.assertContains(r, 'さかき')
self.assertContains(r, b'\xe5\xb3\xa0'.decode('utf-8'))
def test_unicode_not_contains(self):
"Unicode characters can be searched for, and not found in template context"
#Regression test for #10183
# Regression test for #10183
r = self.client.get('/test_client_regress/check_unicode/')
self.assertNotContains(r, 'はたけ')
self.assertNotContains(r, b'\xe3\x81\xaf\xe3\x81\x9f\xe3\x81\x91'.decode('utf-8'))
@ -1193,7 +1193,7 @@ class UnicodePayloadTests(TestCase):
def test_unicode_payload_non_utf(self):
"A non-ASCII unicode data as a non-UTF based encoding can be POSTed"
#Regression test for #10571
# Regression test for #10571
json = '{"dog": "собака"}'
response = self.client.post("/test_client_regress/parse_unicode_json/", json,
content_type="application/json; charset=koi8-r")