[amazon] pep8 fixes

This commit is contained in:
Kitof 2015-03-03 17:26:08 +01:00 committed by Florent Fourcot
commit f7e7e45760
5 changed files with 56 additions and 50 deletions

View file

@ -30,6 +30,7 @@ from .pages import HomePage, LoginPage, AmazonPage, HistoryPage, \
__all__ = ['Amazon'] __all__ = ['Amazon']
class Amazon(LoginBrowser): class Amazon(LoginBrowser):
BASEURL = 'https://www.amazon.com' BASEURL = 'https://www.amazon.com'
MAX_RETRIES = 10 MAX_RETRIES = 10

View file

@ -26,6 +26,7 @@ OrderOldPage, OrderNewPage
__all__ = ['AmazonFR'] __all__ = ['AmazonFR']
class AmazonFR(Amazon): class AmazonFR(Amazon):
BASEURL = 'https://www.amazon.fr' BASEURL = 'https://www.amazon.fr'
CURRENCY = u'' CURRENCY = u''

10
modules/amazon/fr/pages.py Executable file → Normal file
View file

@ -28,6 +28,7 @@ import re
# Ugly array to avoid the use of french locale # Ugly array to avoid the use of french locale
FRENCH_MONTHS = [u'janvier', u'février', u'mars', u'avril', u'mai', u'juin', u'juillet', u'août', u'septembre', u'octobre', u'novembre', u'décembre'] FRENCH_MONTHS = [u'janvier', u'février', u'mars', u'avril', u'mai', u'juin', u'juillet', u'août', u'septembre', u'octobre', u'novembre', u'décembre']
class AmazonPage(HTMLPage): class AmazonPage(HTMLPage):
@property @property
def logged(self): def logged(self):
@ -84,8 +85,8 @@ class OrderPage(AmazonPage):
# finalized payment amounts. # finalized payment amounts.
# Payment for not yet shipped orders may change, and is not always # Payment for not yet shipped orders may change, and is not always
# available. # available.
# TODO : Other French status applied ?
return bool([x for s in [u'En préparation pour expédition'] return bool([x for s in [u'En préparation pour expédition'] # TODO : Other French status applied ?
for x in self.doc.xpath(u'//*[contains(text(),"%s")]' % s)]) for x in self.doc.xpath(u'//*[contains(text(),"%s")]' % s)])
def decimal_amount(self, amount): def decimal_amount(self, amount):
@ -98,7 +99,9 @@ class OrderPage(AmazonPage):
text = text.replace(month, str(idx + 1)) text = text.replace(month, str(idx + 1))
return text return text
class OrderNewPage(OrderPage): class OrderNewPage(OrderPage):
# Need to force encoding because of mixed encoding
forced_encoding = True forced_encoding = True
ENCODING = 'ISO-8859-15' ENCODING = 'ISO-8859-15'
is_here = u'//*[contains(text(),"Commandé le")]' is_here = u'//*[contains(text(),"Commandé le")]'
@ -157,7 +160,8 @@ class OrderNewPage(OrderPage):
'/following-sibling::div[1]/span/text()')[0].strip()) '/following-sibling::div[1]/span/text()')[0].strip())
def date_num(self): def date_num(self):
return u' '.join(self.doc.xpath( return u' '.join(
self.doc.xpath(
'//span[@class="order-date-invoice-item"]/text()' '//span[@class="order-date-invoice-item"]/text()'
)).replace('\n', '') )).replace('\n', '')

View file

@ -28,6 +28,7 @@ from .fr.browser import AmazonFR
__all__ = ['AmazonModule'] __all__ = ['AmazonModule']
class AmazonModule(Module, CapShop): class AmazonModule(Module, CapShop):
NAME = 'amazon' NAME = 'amazon'
MAINTAINER = u'Oleg Plakhotniuk' MAINTAINER = u'Oleg Plakhotniuk'
@ -63,7 +64,6 @@ class AmazonModule(Module, CapShop):
return self.browser.get_order(id_) return self.browser.get_order(id_)
def iter_orders(self): def iter_orders(self):
return self.browser.iter_orders() return self.browser.iter_orders()
def iter_payments(self, order): def iter_payments(self, order):