diff --git a/modules/banqueaccord/pages.py b/modules/banqueaccord/pages.py index 85f0b835..11720f05 100644 --- a/modules/banqueaccord/pages.py +++ b/modules/banqueaccord/pages.py @@ -66,8 +66,9 @@ class VirtKeyboard(MappedVirtKeyboard): return True - def get_symbol_coords(self, (x1, y1, x2, y2)): + def get_symbol_coords(self, coords): # strip borders + x1, y1, x2, y2 = coords return MappedVirtKeyboard.get_symbol_coords(self, (x1+10, y1+10, x2-10, y2-10)) def get_symbol_code(self, md5sum_list): diff --git a/modules/banquepopulaire/module.py b/modules/banquepopulaire/module.py index abfe8da6..058f9cbc 100644 --- a/modules/banquepopulaire/module.py +++ b/modules/banquepopulaire/module.py @@ -56,7 +56,7 @@ class BanquePopulaireModule(Module, CapBank): 'www.ibps.rivesparis.banquepopulaire.fr': u'Rives de Paris', 'www.ibps.sud.banquepopulaire.fr': u'Sud', 'www.ibps.valdefrance.banquepopulaire.fr': u'Val de France', - }.iteritems(), key=lambda (k, v): (v, k))]) + }.iteritems(), key=lambda k_v: (k_v[1], k_v[0]))]) CONFIG = BackendConfig(Value('website', label=u'Région', choices=website_choices), ValueBackendPassword('login', label='Identifiant', masked=False), ValueBackendPassword('password', label='Mot de passee')) diff --git a/modules/bnporc/enterprise/pages.py b/modules/bnporc/enterprise/pages.py index 1d6752c2..1657325c 100644 --- a/modules/bnporc/enterprise/pages.py +++ b/modules/bnporc/enterprise/pages.py @@ -80,8 +80,9 @@ class BNPVirtKeyboard(MappedVirtKeyboard): MappedVirtKeyboard.__init__(self, imgdata, basepage.document, img, self.color) self.check_symbols(self.symbols, basepage.browser.responses_dirname) - def get_symbol_coords(self, (x1, y1, x2, y2)): + def get_symbol_coords(self, coords): # strip borders + x1, y1, x2, y2 = coords return MappedVirtKeyboard.get_symbol_coords(self, (x1+6, y1+1, x2-6, y2-4)) def get_symbol_code(self, md5sum): @@ -96,8 +97,9 @@ class BNPVirtKeyboard(MappedVirtKeyboard): code += self.get_symbol_code(self.symbols[c]) return code - def checksum(self, (x1, y1, x2, y2)): + def checksum(self, coords): """Copy of parent checksum(), but cropping (removes empty lines)""" + x1, y1, x2, y2 = coords s = '' for y in range(y1, min(y2 + 1, self.height)): for x in range(x1, min(x2 + 1, self.width)): diff --git a/modules/boursorama/pages/login.py b/modules/boursorama/pages/login.py index 332e66a1..7dbaf7de 100644 --- a/modules/boursorama/pages/login.py +++ b/modules/boursorama/pages/login.py @@ -41,7 +41,8 @@ class VirtKeyboard(MappedVirtKeyboard): color=(0,0,0) - def check_color(self, (r, g, b)): + def check_color(self, color): + r, g, b = color return r > 240 and g > 240 and b > 240 def __init__(self, page): @@ -61,7 +62,8 @@ class VirtKeyboard(MappedVirtKeyboard): code += self.get_symbol_code(self.symbols[c]) return code - def checksum(self, (x1, y1, x2, y2)): + def checksum(self, coords): + x1, y1, x2, y2 = coords s = '' for y in range(y1, min(y2 + 1, self.height)): for x in range(x1, min(x2 + 1, self.width)): diff --git a/modules/bp/pages/login.py b/modules/bp/pages/login.py index 651adbcc..5fda4a1e 100644 --- a/modules/bp/pages/login.py +++ b/modules/bp/pages/login.py @@ -81,8 +81,9 @@ class Keyboard(VirtKeyboard): code += self.get_symbol_code(self.symbols[c]) return code - def get_symbol_coords(self, (x1, y1, x2, y2)): + def get_symbol_coords(self, coords): # strip borders + x1, y1, x2, y2 = coords return VirtKeyboard.get_symbol_coords(self, (x1+3, y1+3, x2-3, y2-3)) class LoginPage(Page): diff --git a/modules/creditdunord/module.py b/modules/creditdunord/module.py index ecb3a1ce..5f2a6b6c 100644 --- a/modules/creditdunord/module.py +++ b/modules/creditdunord/module.py @@ -43,7 +43,7 @@ class CreditDuNordModule(Module, CapBank): 'www.banque-kolb.fr': u'Banque Kolb', 'www.banque-rhone-alpes.fr': u'Banque Rhône-Alpes', 'www.tarneaud.fr': u'Tarneaud', - }.iteritems(), key=lambda (k, v): (v, k))]) + }.iteritems(), key=lambda k_v: (k_v[1], k_v[0]))]) CONFIG = BackendConfig(Value('website', label='Banque', choices=website_choices, default='www.credit-du-nord.fr'), ValueBackendPassword('login', label='Identifiant', masked=False), ValueBackendPassword('password', label='Code confidentiel')) diff --git a/modules/ganassurances/module.py b/modules/ganassurances/module.py index d790c1d6..771580a0 100644 --- a/modules/ganassurances/module.py +++ b/modules/ganassurances/module.py @@ -39,7 +39,7 @@ class GanAssurancesModule(Module, CapBank): website_choices = OrderedDict([(k, u'%s (%s)' % (v, k)) for k, v in sorted({ 'espaceclient.groupama.fr': u'Groupama Banque', 'espaceclient.ganassurances.fr': u'Gan Assurances', - }.iteritems(), key=lambda (k, v): (v, k))]) + }.iteritems(), key=lambda k_v: (k_v[1], k_v[0]))]) CONFIG = BackendConfig(Value('website', label='Banque', choices=website_choices, default='espaceclient.ganassurances.fr'), ValueBackendPassword('login', label=u'Numéro client', masked=False), ValueBackendPassword('password', label=u"Code d'accès")) diff --git a/modules/societegenerale/captcha.py b/modules/societegenerale/captcha.py index 1e5a4b6c..ef3f5833 100644 --- a/modules/societegenerale/captcha.py +++ b/modules/societegenerale/captcha.py @@ -44,7 +44,8 @@ class Captcha(object): self.tiles = [[Tile(y * self.nbc + x) for y in xrange(4)] for x in xrange(4)] - def __getitem__(self, (x, y)): + def __getitem__(self, coords): + x, y = coords return self.inmat[x % self.nx, y % self.ny] def all_coords(self): diff --git a/modules/wellsfargo/parsers.py b/modules/wellsfargo/parsers.py index 5320bfcf..2f84b65f 100644 --- a/modules/wellsfargo/parsers.py +++ b/modules/wellsfargo/parsers.py @@ -231,7 +231,7 @@ class StatementParser(object): # Infer amount type by its indentation in the layout. amount_total = clean_amount('0') for (_, _, _, _, indent, _), amount in amounts: - within = lambda (xmin, xmax): xmin <= indent <= xmax + within = lambda xmin_xmax: xmin_xmax[0] <= indent <= xmin_xmax[1] if within(range_skip): continue elif within(range_plus): diff --git a/weboob/tools/captcha/virtkeyboard.py b/weboob/tools/captcha/virtkeyboard.py index 4c9ca1f6..1a015346 100644 --- a/weboob/tools/captcha/virtkeyboard.py +++ b/weboob/tools/captcha/virtkeyboard.py @@ -98,7 +98,8 @@ class VirtKeyboard(object): def check_color(self, pixel): return pixel == self.color - def get_symbol_coords(self, (x1, y1, x2, y2)): + def get_symbol_coords(self, coords): + (x1, y1, x2, y2) = coords if self.margin: top, right, bottom, left = self.margin x1, y1, x2, y2 = x1 + left, y1 + top, x2 - right, y2 - bottom @@ -133,7 +134,8 @@ class VirtKeyboard(object): newX2 = x return (newX1, newY1, newX2, newY2) - def checksum(self, (x1, y1, x2, y2)): + def checksum(self, coords): + (x1, y1, x2, y2) = coords s = '' for y in range(y1, min(y2 + 1, self.height)): for x in range(x1, min(x2 + 1, self.width)):