pep8 blank lines fixes

flake8 --select W391,E302,E301,E304

autopep8 can't fix W391 even though it claims it can.
Fixed using a simple custom script.
This commit is contained in:
Laurent Bachelier 2014-10-10 23:04:08 +02:00
commit 448c06d125
142 changed files with 249 additions and 25 deletions

View file

@ -47,6 +47,7 @@ class JsonFormatter(IFormatter):
"""
Formats the whole list as a single JSON list object.
"""
def __init__(self):
IFormatter.__init__(self)
self.queue = []
@ -66,9 +67,11 @@ class JsonLineFormatter(IFormatter):
Formats the list as received, with a JSON object per line.
The advantage is that it can be streamed.
"""
def format_dict(self, item):
self.output(json.dumps(item, cls=Encoder))
def test():
from .iformatter import formatter_test_output as fmt
assert fmt(JsonFormatter, {'foo': 'bar'}) == '[{"foo": "bar"}]\n'

View file

@ -100,6 +100,7 @@ class TableFormatter(IFormatter):
class HTMLTableFormatter(TableFormatter):
HTML = True
def test():
from .iformatter import formatter_test_output as fmt
assert fmt(TableFormatter, {'foo': 'bar'}) == \

View file

@ -61,6 +61,7 @@ class MediaPlayer(object):
world, the media player used is chosen from a static list of
programs. See PLAYERS for more information.
"""
def __init__(self, logger=None):
self.logger = getLogger('mediaplayer', logger)

View file

@ -178,6 +178,7 @@ class QtApplication(QApplication, Application):
QMessageBox.information(None, self.tr('Update of repositories'),
self.tr('Repositories updated!'), QMessageBox.Ok)
class QtMainWindow(QMainWindow):
def __init__(self, parent=None):
QMainWindow.__init__(self, parent)

View file

@ -44,6 +44,7 @@ class BackendStorage(object):
:param storage: storage object
:type storage: :class:`weboob.tools.storage.IStorage`
"""
def __init__(self, name, storage):
self.name = name
self.storage = storage

View file

@ -38,6 +38,7 @@ __all__ = ['FrenchTransaction', 'AmericanTransaction']
class classproperty(object):
def __init__(self, f):
self.f = f
def __get__(self, obj, owner):
return self.f(owner)
@ -225,6 +226,7 @@ class FrenchTransaction(Transaction):
@classmethod
def Raw(klass, *args, **kwargs):
patterns = klass.PATTERNS
class Filter(CleanText):
def __call__(self, item):
raw = super(Filter, self).__call__(item)
@ -286,6 +288,7 @@ class FrenchTransaction(Transaction):
break
return raw
def filter(self, text):
text = super(Filter, self).filter(text)
return to_unicode(text.replace(u'\n', u' ').strip())
@ -332,6 +335,7 @@ class AmericanTransaction(Transaction):
text = text.replace(',', ' ').replace('.', ',')
return FrenchTransaction.clean_amount(text)
def test():
clean_amount = AmericanTransaction.clean_amount
assert clean_amount('42') == '42'

View file

@ -70,6 +70,7 @@ def image_mime(data_base64, supported_formats=('gif', 'jpeg', 'png')):
'MM\x2a\x00' in beginning):
return 'image/tiff'
def test():
class MockPasteModule(BasePasteModule):
def __init__(self, expirations):

View file

@ -39,4 +39,3 @@ class StreamInfo(BaseObject):
return u'%s - %s' % (self.who, self.what)
else:
return self.what

View file

@ -214,6 +214,7 @@ class ChaoticDateGuesser(LinearDateGuesser):
This class aim to find the guess the date when you know the
day and month and the minimum year
"""
def __init__(self, min_date, current_date=None, date_max_bump=timedelta(7)):
if min_date is None:
raise ValueError("min_date is not set")

View file

@ -59,6 +59,7 @@ class ColoredFormatter(Formatter):
Class written by airmind:
http://stackoverflow.com/questions/384076/how-can-i-make-the-python-logging-output-to-be-colored
"""
def format(self, record):
levelname = record.levelname
msg = Formatter.format(self, record)

View file

@ -50,6 +50,7 @@ ESCAPE_MAPPINGS = {
"Z": None,
}
class Choice(list):
"""
Used to represent multiple possibilities at this point in a pattern string.
@ -57,16 +58,19 @@ class Choice(list):
code is clear.
"""
class Group(list):
"""
Used to represent a capturing group in the pattern string.
"""
class NonCapture(list):
"""
Used to represent a non-capturing group in the pattern string.
"""
def normalize(pattern):
"""
Given a reg-exp pattern, normalizes it to a list of forms that suffice for
@ -222,6 +226,7 @@ def normalize(pattern):
return zip(*flatten_result(result))
def next_char(input_iter):
"""
An iterator that yields the next character from "pattern_iter", respecting
@ -242,6 +247,7 @@ def next_char(input_iter):
continue
yield representative, True
def walk_to_end(ch, input_iter):
"""
The iterator is currently inside a capturing group. We want to walk to the
@ -262,6 +268,7 @@ def walk_to_end(ch, input_iter):
return
nesting -= 1
def get_quantifier(ch, input_iter):
"""
Parse a quantifier from the input, where "ch" is the first character in the
@ -298,6 +305,7 @@ def get_quantifier(ch, input_iter):
ch = None
return int(values[0]), ch
def contains(source, inst):
"""
Returns True if the "source" contains an instance of "inst". False,
@ -311,6 +319,7 @@ def contains(source, inst):
return True
return False
def flatten_result(source):
"""
Turns the given source sequence into a list of reg-exp possibilities and
@ -363,4 +372,3 @@ def flatten_result(source):
for i in range(len(result)):
result[i] += piece
return result, result_args

View file

@ -33,6 +33,7 @@ class ValuesDict(OrderedDict):
>>> ValuesDict(Value('a', label='Test'), ValueInt('b', label='Test2'))
"""
def __init__(self, *values):
OrderedDict.__init__(self)
for v in values: