pep8: Various manual fixes

This commit is contained in:
Laurent Bachelier 2014-10-13 22:31:29 +02:00
commit db1618e86f
11 changed files with 30 additions and 34 deletions

View file

@ -239,7 +239,7 @@ class Citibank(object):
@retrying @retrying
def wait_file(self, suffix): def wait_file(self, suffix):
self._logger.debug('Waiting for file "*%s" to finish downloading.' % \ self._logger.debug('Waiting for file "*%s" to finish downloading.' %
suffix) suffix)
for name in os.listdir(self._downloads): for name in os.listdir(self._downloads):
if not name.endswith(suffix): if not name.endswith(suffix):

View file

@ -66,7 +66,6 @@ class CreditMutuelBrowser(LoginBrowser):
currentSubBank = None currentSubBank = None
def do_login(self): def do_login(self):
self.login.stay_or_go() self.login.stay_or_go()

View file

@ -164,8 +164,8 @@ class Transaction(FrenchTransaction):
(re.compile('^RETRAIT DAB (?P<dd>\d{2})(?P<mm>\d{2}) (?P<text>.*) CARTE [\*\d]+'), (re.compile('^RETRAIT DAB (?P<dd>\d{2})(?P<mm>\d{2}) (?P<text>.*) CARTE [\*\d]+'),
FrenchTransaction.TYPE_WITHDRAWAL), FrenchTransaction.TYPE_WITHDRAWAL),
(re.compile('^CHEQUE( (?P<text>.*))?$'), FrenchTransaction.TYPE_CHECK), (re.compile('^CHEQUE( (?P<text>.*))?$'), FrenchTransaction.TYPE_CHECK),
(re.compile('^(F )?COTIS\.? (?P<text>.*)'),FrenchTransaction.TYPE_BANK), (re.compile('^(F )?COTIS\.? (?P<text>.*)'), FrenchTransaction.TYPE_BANK),
(re.compile('^(REMISE|REM CHQ) (?P<text>.*)'),FrenchTransaction.TYPE_DEPOSIT), (re.compile('^(REMISE|REM CHQ) (?P<text>.*)'), FrenchTransaction.TYPE_DEPOSIT),
] ]
_is_coming = False _is_coming = False

View file

@ -54,7 +54,6 @@ class HSBC(LoginBrowser):
return preq return preq
def home(self): def home(self):
return self.login.go() return self.login.go()

View file

@ -106,11 +106,11 @@ class Pagination(object):
links = self.page.doc.xpath('//a[@class="fleche"]') links = self.page.doc.xpath('//a[@class="fleche"]')
if len(links) == 0: if len(links) == 0:
return return
current_page_found= False current_page_found = False
for link in links: for link in links:
l = link.attrib.get('href') l = link.attrib.get('href')
if current_page_found and "#op" not in l: if current_page_found and "#op" not in l:
#Adding CB_IdPrestation so browser2 use CBOperationPage # Adding CB_IdPrestation so browser2 use CBOperationPage
return l + "&CB_IdPrestation" return l + "&CB_IdPrestation"
elif "#op" in l: elif "#op" in l:
current_page_found = True current_page_found = True
@ -172,7 +172,7 @@ class LoginPage(HTMLPage):
raise BrowserIncorrectPassword('Your password must be %d chars long' % len(inputs)) raise BrowserIncorrectPassword('Your password must be %d chars long' % len(inputs))
for i, inpu in enumerate(inputs): for i, inpu in enumerate(inputs):
#The good field are 1,2,3 and the bad one are 11,12,21,23,24,31 and so one # The good field are 1,2,3 and the bad one are 11,12,21,23,24,31 and so one
if int(inpu.attrib['id'].split('first')[1]) < 10: if int(inpu.attrib['id'].split('first')[1]) < 10:
split_pass += password[i] split_pass += password[i]
form['password'] = split_pass form['password'] = split_pass

View file

@ -42,7 +42,7 @@ class RoadmapSearchPage(Page):
try: try:
self.browser['dateFull'] = '%02d/%02d/%d' % (time.day, time.month, time.year) self.browser['dateFull'] = '%02d/%02d/%d' % (time.day, time.month, time.year)
self.browser['hour'] = ['%02d' % time.hour] self.browser['hour'] = ['%02d' % time.hour]
self.browser['minute'] = ['%02d' % (time.minute - (time.minute%5))] self.browser['minute'] = ['%02d' % (time.minute - (time.minute % 5))]
except ClientForm.ItemNotFoundError: except ClientForm.ItemNotFoundError:
raise RoadmapError('Unable to establish a roadmap with %s time at "%s"' % ('departure' if departure_time else 'arrival', time)) raise RoadmapError('Unable to establish a roadmap with %s time at "%s"' % ('departure' if departure_time else 'arrival', time))
self.browser.submit() self.browser.submit()
@ -63,7 +63,7 @@ class RoadmapResultsPage(Page):
if len(best) == 0: if len(best) == 0:
best = self.parser.select(self.document.getroot(), 'div.bloc-iti') best = self.parser.select(self.document.getroot(), 'div.bloc-iti')
if len(best) == 0: if len(best) == 0:
raise RoadmapError('Unable to get the best roadmap'); raise RoadmapError('Unable to get the best roadmap')
link = self.parser.select(best[0], 'a.btn-submit') link = self.parser.select(best[0], 'a.btn-submit')
if len(link) == 0: if len(link) == 0:

View file

@ -58,14 +58,14 @@ class OneyBrowser(LoginBrowser):
@need_login @need_login
def iter_history(self, account): def iter_history(self, account):
post = {'task': 'Synthese', 'process': 'SyntheseCompte', 'taskid':'Releve'} post = {'task': 'Synthese', 'process': 'SyntheseCompte', 'taskid': 'Releve'}
self.operations.go(data=post) self.operations.go(data=post)
return self.page.iter_transactions(seen=set()) return self.page.iter_transactions(seen=set())
@need_login @need_login
def iter_coming(self, account): def iter_coming(self, account):
post = {'task': 'OperationRecente', 'process': 'OperationRecente', 'taskid':'OperationRecente'} post = {'task': 'OperationRecente', 'process': 'OperationRecente', 'taskid': 'OperationRecente'}
self.operations.go(data=post) self.operations.go(data=post)
return self.page.iter_transactions(seen=set()) return self.page.iter_transactions(seen=set())

View file

@ -33,4 +33,4 @@ class SFRTest(BackendTest):
def test_get_account_status(self): def test_get_account_status(self):
nbSms = self.backend.get_account_status() nbSms = self.backend.get_account_status()
assert nbSms assert nbSms
assert isinstance(nbSms[0].value, str); assert isinstance(nbSms[0].value, str)

View file

@ -311,4 +311,3 @@ class StatementParser(object):
t = self._tok.tok(pos) t = self._tok.tok(pos)
return (pos+1, [float(v) for v in t.value()]) \ return (pos+1, [float(v) for v in t.value()]) \
if t.is_layout_tm() else (pos, None) if t.is_layout_tm() else (pos, None)

View file

@ -19,7 +19,6 @@
import re import re
__all__ = ['ReTokenizer'] __all__ = ['ReTokenizer']
@ -102,7 +101,7 @@ def test():
('og', r'^one(g.*)$'), ('og', r'^one(g.*)$'),
('mg', r'^(m.*)(g.*)$')]) ('mg', r'^(m.*)(g.*)$')])
assert t.tok(-1).value() == None assert t.tok(-1).value() is None
assert t.tok(0).value() == 'nogroup' assert t.tok(0).value() == 'nogroup'
assert t.tok(1).value() == 'group' assert t.tok(1).value() == 'group'
assert t.tok(2).value() == ('multi', 'group') assert t.tok(2).value() == ('multi', 'group')