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
|
|
@ -33,8 +33,10 @@ from lxml import etree
|
|||
from datetime import date
|
||||
from StringIO import StringIO
|
||||
|
||||
|
||||
__all__ = ['CmbBackend']
|
||||
|
||||
|
||||
class CmbBackend(BaseBackend, ICapBank):
|
||||
NAME = 'cmb'
|
||||
MAINTAINER = 'Johann Broudin'
|
||||
|
|
@ -83,7 +85,6 @@ class CmbBackend(BaseBackend, ICapBank):
|
|||
)
|
||||
]
|
||||
|
||||
|
||||
cookie = None
|
||||
headers = {
|
||||
'User-Agent':
|
||||
|
|
@ -167,13 +168,13 @@ class CmbBackend(BaseBackend, ICapBank):
|
|||
|
||||
|
||||
balance = td[1].text
|
||||
balance = balance.replace(',','.').replace(u"\xa0",'')
|
||||
balance = balance.replace(',', '.').replace(u"\xa0", '')
|
||||
account.balance = float(balance)
|
||||
|
||||
span = td[3].xpath('a/span')
|
||||
if len(span):
|
||||
coming = span[0].text.replace(' ','').replace(',','.')
|
||||
coming = coming.replace(u"\xa0",'')
|
||||
coming = span[0].text.replace(' ', '').replace(',', '.')
|
||||
coming = coming.replace(u"\xa0", '')
|
||||
account.coming = float(coming)
|
||||
else:
|
||||
account.coming = NotAvailable
|
||||
|
|
@ -248,7 +249,7 @@ class CmbBackend(BaseBackend, ICapBank):
|
|||
operation.date = date(*reversed([int(x) for x in d]))
|
||||
|
||||
div = td[2].xpath('div')
|
||||
label = div[0].xpath('a')[0].text.replace('\n','')
|
||||
label = div[0].xpath('a')[0].text.replace('\n', '')
|
||||
operation.raw = unicode(' '.join(label.split()))
|
||||
for pattern, _type, _label in self.LABEL_PATTERNS:
|
||||
mm = pattern.match(operation.raw)
|
||||
|
|
@ -260,12 +261,11 @@ class CmbBackend(BaseBackend, ICapBank):
|
|||
amount = td[3].text
|
||||
if amount.count(',') != 1:
|
||||
amount = td[4].text
|
||||
amount = amount.replace(',','.').replace(u'\xa0','')
|
||||
amount = amount.replace(',', '.').replace(u'\xa0', '')
|
||||
operation.amount = float(amount)
|
||||
else:
|
||||
amount = amount.replace(',','.').replace(u'\xa0','')
|
||||
amount = amount.replace(',', '.').replace(u'\xa0', '')
|
||||
operation.amount = - float(amount)
|
||||
|
||||
i += 1
|
||||
yield operation
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue