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

@ -48,7 +48,7 @@ def retrying(func):
except OnceAgain:
sleep(min(1 << i, MAX_DELAY))
raise BrowserUnavailable('Unexpected site behavior. '
'Perhaps this module needs some fixing...')
'Perhaps this module needs some fixing...')
return inner
@ -109,7 +109,7 @@ class Citibank(object):
HOME_URL = 'https://online.citibank.com/US/JPS/portal/Home.do'
WIDTH = 1920
HEIGHT = 10000 # So that everything fits...
HEIGHT = 10000 # So that everything fits...
self._downloads = mkdtemp()
self._logger.debug('Saving downloaded files to %s' % self._downloads)
@ -239,7 +239,7 @@ class Citibank(object):
@retrying
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)
for name in os.listdir(self._downloads):
if not name.endswith(suffix):

View file

@ -29,7 +29,7 @@ from weboob.tools.compat import basestring
from weboob.browser.browsers import LoginBrowser, need_login
from weboob.browser.profiles import Wget
from weboob.browser.url import URL
from weboob.exceptions import BrowserIncorrectPassword
from weboob.exceptions import BrowserIncorrectPassword
from weboob.capabilities.bank import Transfer, TransferError
from .pages import LoginPage, LoginErrorPage, AccountsPage, UserSpacePage, \
@ -66,7 +66,6 @@ class CreditMutuelBrowser(LoginBrowser):
currentSubBank = None
def do_login(self):
self.login.stay_or_go()

View file

@ -31,7 +31,7 @@ from weboob.browser.pages import HTMLPage, FormNotFound, LoggedPage
from weboob.browser.elements import ListElement, ItemElement, SkipItem, method
from weboob.browser.filters.standard import Filter, Env, CleanText, CleanDecimal, Field, TableCell
from weboob.browser.filters.html import Link
from weboob.exceptions import BrowserIncorrectPassword
from weboob.exceptions import BrowserIncorrectPassword
from weboob.capabilities import NotAvailable
from weboob.capabilities.bank import Account
from weboob.tools.capabilities.bank.transactions import FrenchTransaction
@ -164,8 +164,8 @@ class Transaction(FrenchTransaction):
(re.compile('^RETRAIT DAB (?P<dd>\d{2})(?P<mm>\d{2}) (?P<text>.*) CARTE [\*\d]+'),
FrenchTransaction.TYPE_WITHDRAWAL),
(re.compile('^CHEQUE( (?P<text>.*))?$'), FrenchTransaction.TYPE_CHECK),
(re.compile('^(F )?COTIS\.? (?P<text>.*)'),FrenchTransaction.TYPE_BANK),
(re.compile('^(REMISE|REM CHQ) (?P<text>.*)'),FrenchTransaction.TYPE_DEPOSIT),
(re.compile('^(F )?COTIS\.? (?P<text>.*)'), FrenchTransaction.TYPE_BANK),
(re.compile('^(REMISE|REM CHQ) (?P<text>.*)'), FrenchTransaction.TYPE_DEPOSIT),
]
_is_coming = False

View file

@ -22,7 +22,7 @@ import ssl
from datetime import timedelta
from weboob.tools.date import LinearDateGuesser
from weboob.exceptions import BrowserIncorrectPassword
from weboob.exceptions import BrowserIncorrectPassword
from weboob.browser import LoginBrowser, URL, need_login
from .pages import AccountsPage, CBOperationPage, CPTOperationPage, LoginPage
@ -54,7 +54,6 @@ class HSBC(LoginBrowser):
return preq
def home(self):
return self.login.go()

View file

@ -24,7 +24,7 @@ from weboob.capabilities import NotAvailable
from weboob.capabilities.bank import Account
from weboob.tools.capabilities.bank.transactions import FrenchTransaction
from weboob.exceptions import BrowserIncorrectPassword
from weboob.exceptions import BrowserIncorrectPassword
from weboob.browser.elements import ListElement, ItemElement, SkipItem, method
from weboob.browser.pages import HTMLPage, LoggedPage, pagination
from weboob.browser.filters.standard import Filter, Env, CleanText, CleanDecimal, Field, DateGuesser, TableCell
@ -35,9 +35,9 @@ class Transaction(FrenchTransaction):
PATTERNS = [(re.compile(r'^VIR(EMENT)? (?P<text>.*)'), FrenchTransaction.TYPE_TRANSFER),
(re.compile(r'^PRLV (?P<text>.*)'), FrenchTransaction.TYPE_ORDER),
(re.compile(r'^CB (?P<text>.*)\s+(?P<dd>\d+)/(?P<mm>\d+)\s*(?P<loc>.*)'),
FrenchTransaction.TYPE_CARD),
FrenchTransaction.TYPE_CARD),
(re.compile(r'^DAB (?P<dd>\d{2})/(?P<mm>\d{2}) ((?P<HH>\d{2})H(?P<MM>\d{2}) )?(?P<text>.*?)( CB N°.*)?$'),
FrenchTransaction.TYPE_WITHDRAWAL),
FrenchTransaction.TYPE_WITHDRAWAL),
(re.compile(r'^CHEQUE$'), FrenchTransaction.TYPE_CHECK),
(re.compile(r'^COTIS\.? (?P<text>.*)'), FrenchTransaction.TYPE_BANK),
(re.compile(r'^REMISE (?P<text>.*)'), FrenchTransaction.TYPE_DEPOSIT),
@ -106,11 +106,11 @@ class Pagination(object):
links = self.page.doc.xpath('//a[@class="fleche"]')
if len(links) == 0:
return
current_page_found= False
current_page_found = False
for link in links:
l = link.attrib.get('href')
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"
elif "#op" in l:
current_page_found = True
@ -172,7 +172,7 @@ class LoginPage(HTMLPage):
raise BrowserIncorrectPassword('Your password must be %d chars long' % len(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:
split_pass += password[i]
form['password'] = split_pass

View file

@ -42,7 +42,7 @@ class RoadmapSearchPage(Page):
try:
self.browser['dateFull'] = '%02d/%02d/%d' % (time.day, time.month, time.year)
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:
raise RoadmapError('Unable to establish a roadmap with %s time at "%s"' % ('departure' if departure_time else 'arrival', time))
self.browser.submit()
@ -63,7 +63,7 @@ class RoadmapResultsPage(Page):
if len(best) == 0:
best = self.parser.select(self.document.getroot(), 'div.bloc-iti')
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')
if len(link) == 0:
@ -114,14 +114,14 @@ class RoadmapPage(Page):
for tr in self.parser.select(self.document.getroot(), 'table.itineraire-detail tr'):
if current_step is None:
current_step = {
'id': i,
'start_time': datetime.datetime.now(),
'end_time': datetime.datetime.now(),
'line': '',
'departure': '',
'arrival': '',
'duration': datetime.timedelta()
}
'id': i,
'start_time': datetime.datetime.now(),
'end_time': datetime.datetime.now(),
'line': '',
'departure': '',
'arrival': '',
'duration': datetime.timedelta()
}
if 'class' in tr.attrib:
if 'bg-ligne' in tr.attrib['class']:

View file

@ -19,7 +19,7 @@
from weboob.capabilities.bank import Account
from weboob.exceptions import BrowserIncorrectPassword
from weboob.exceptions import BrowserIncorrectPassword
from weboob.browser import LoginBrowser, URL, need_login
from .pages import LoginPage, IndexPage, OperationsPage
@ -58,14 +58,14 @@ class OneyBrowser(LoginBrowser):
@need_login
def iter_history(self, account):
post = {'task': 'Synthese', 'process': 'SyntheseCompte', 'taskid':'Releve'}
post = {'task': 'Synthese', 'process': 'SyntheseCompte', 'taskid': 'Releve'}
self.operations.go(data=post)
return self.page.iter_transactions(seen=set())
@need_login
def iter_coming(self, account):
post = {'task': 'OperationRecente', 'process': 'OperationRecente', 'taskid':'OperationRecente'}
post = {'task': 'OperationRecente', 'process': 'OperationRecente', 'taskid': 'OperationRecente'}
self.operations.go(data=post)
return self.page.iter_transactions(seen=set())

View file

@ -121,7 +121,7 @@ class IndexPage(LoggedPage, HTMLPage):
is_here = "//div[@id='situation']"
def get_balance(self):
return -CleanDecimal('.', replace_dots=True)(self.doc.xpath('//div[@id = "total-sommes-dues"]/p[contains(text(), "sommes dues")]/span[@class = "montant"]')[0])
return -CleanDecimal('.', replace_dots=True)(self.doc.xpath('//div[@id = "total-sommes-dues"]/p[contains(text(), "sommes dues")]/span[@class = "montant"]')[0])
class OperationsPage(LoggedPage, HTMLPage):

View file

@ -33,4 +33,4 @@ class SFRTest(BackendTest):
def test_get_account_status(self):
nbSms = self.backend.get_account_status()
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)
return (pos+1, [float(v) for v in t.value()]) \
if t.is_layout_tm() else (pos, None)