PEP8 style fixes and other small style fixes
I used autopep8 on some files and did carefully check the changes. I ignored E501,E302,E231,E225,E222,E221,E241,E203 in my search, and at least E501 on any autopep8 run. Other style fixes not related to PEP8: * Only use new-style classes. I don't think the usage of old-style classes was voluntary. Old-style classes are removed in Python 3. * Convert an if/else to a one-liner in mediawiki, change docstring style change to a comment something that wasn't really appropriate for a docstring. * Unneeded first if condition in meteofrance
This commit is contained in:
parent
1e000acf3a
commit
006e97a8be
99 changed files with 441 additions and 350 deletions
|
|
@ -49,6 +49,7 @@ class QifFormatter(IFormatter):
|
|||
self.count += 1
|
||||
return result
|
||||
|
||||
|
||||
class TransactionsFormatter(IFormatter):
|
||||
MANDATORY_FIELDS = ('date', 'label', 'amount')
|
||||
TYPES = ['', 'Transfer', 'Order', 'Check', 'Deposit', 'Payback', 'Withdrawal', 'Card', 'Loan', 'Bank']
|
||||
|
|
@ -82,6 +83,7 @@ class TransactionsFormatter(IFormatter):
|
|||
result += ' %-10s %-12s %-50s %10.2f' % (item['date'].strftime('%Y-%m-%d'), _type, label[:50], item['amount'])
|
||||
return result
|
||||
|
||||
|
||||
class TransferFormatter(IFormatter):
|
||||
MANDATORY_FIELDS = ('id', 'date', 'origin', 'recipient', 'amount')
|
||||
|
||||
|
|
@ -96,6 +98,7 @@ class TransferFormatter(IFormatter):
|
|||
result += u'Amount: %.2f\n' % item['amount']
|
||||
return result
|
||||
|
||||
|
||||
class RecipientListFormatter(IFormatter):
|
||||
MANDATORY_FIELDS = ('id', 'label')
|
||||
|
||||
|
|
@ -115,6 +118,7 @@ class RecipientListFormatter(IFormatter):
|
|||
|
||||
return u'%s %-30s %s %s' % (self.BOLD, id, self.NC, item['label'])
|
||||
|
||||
|
||||
class AccountListFormatter(IFormatter):
|
||||
MANDATORY_FIELDS = ('id', 'label', 'balance', 'coming')
|
||||
|
||||
|
|
@ -122,13 +126,12 @@ class AccountListFormatter(IFormatter):
|
|||
tot_balance = 0.0
|
||||
tot_coming = 0.0
|
||||
|
||||
|
||||
def flush(self):
|
||||
if self.count < 1:
|
||||
return
|
||||
|
||||
result = u'------------------------------------------%s+----------+----------\n' % (('-' * 15) if not self.interactive else '')
|
||||
result +=u'%s Total %8s %8s' % ((' ' * 15) if not self.interactive else '',
|
||||
result += u'%s Total %8s %8s' % ((' ' * 15) if not self.interactive else '',
|
||||
'%.2f' % self.tot_balance, '%.2f' % self.tot_coming)
|
||||
self.after_format(result)
|
||||
self.tot_balance = 0.0
|
||||
|
|
@ -156,6 +159,7 @@ class AccountListFormatter(IFormatter):
|
|||
self.tot_coming += item['coming']
|
||||
return result
|
||||
|
||||
|
||||
class Boobank(ReplApplication):
|
||||
APPNAME = 'boobank'
|
||||
VERSION = '0.b'
|
||||
|
|
@ -278,7 +282,7 @@ class Boobank(ReplApplication):
|
|||
|
||||
try:
|
||||
amount = float(amount)
|
||||
except (TypeError,ValueError):
|
||||
except (TypeError, ValueError):
|
||||
print >>sys.stderr, 'Error: please give a decimal amount to transfer'
|
||||
return 2
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue