diff --git a/contrib/boobot.py b/contrib/boobot.py index 7bbfe6df..8ffb5766 100755 --- a/contrib/boobot.py +++ b/contrib/boobot.py @@ -33,6 +33,7 @@ IRC_NICKNAME = 'boobot' IRC_SERVER = 'irc.freenode.org' STORAGE_FILE = 'boobot.storage' + class MyThread(Thread): def __init__(self, bot): Thread.__init__(self) @@ -50,9 +51,9 @@ class MyThread(Thread): self.weboob.loop() def find_keywords(self, text): - for word in ['weboob', 'videoob', 'havesex', 'havedate', 'monboob', 'boobmsg', \ - 'flatboob', 'boobill', 'pastoob', 'radioob', 'translaboob', 'traveloob', \ - 'boobathon', 'boobank', 'boobtracker', 'comparoob', 'wetboobs', \ + for word in ['weboob', 'videoob', 'havesex', 'havedate', 'monboob', 'boobmsg', + 'flatboob', 'boobill', 'pastoob', 'radioob', 'translaboob', 'traveloob', + 'boobathon', 'boobank', 'boobtracker', 'comparoob', 'wetboobs', 'webcontentedit', 'weboorrents', 'capabilit', u'sàt', u'salut à toi']: if word in text.lower(): return word @@ -80,6 +81,7 @@ class MyThread(Thread): def stop(self): self.weboob.want_stop() + class TestBot(SingleServerIRCBot): def __init__(self, channel, nickname, server, port=6667): SingleServerIRCBot.__init__(self, [(server, port)], nickname, nickname + "`") @@ -121,6 +123,7 @@ class TestBot(SingleServerIRCBot): if h: self.send_message(u'Housing: %s (%sm² / %s%s)' % (h.title, h.area, h.cost, h.currency)) + def main(): logging.basicConfig(level=logging.DEBUG) bot = TestBot(IRC_CHANNEL, IRC_NICKNAME, IRC_SERVER) diff --git a/contrib/downloadboob/downloadboob.py b/contrib/downloadboob/downloadboob.py index babce1c4..49e9fceb 100755 --- a/contrib/downloadboob/downloadboob.py +++ b/contrib/downloadboob/downloadboob.py @@ -39,14 +39,18 @@ if sys.stdout.encoding is None: # end of hack + def removeNonAscii(s): return "".join(i for i in s if ord(i)<128) rx = re.compile(u'[ \\/\\?\\:\\>\\<\\!\\\\\\*]+', re.UNICODE) + + def removeSpecial(s): return rx.sub(u' ', u'%s' % s) DOWNLOAD_DIRECTORY=".files" + class Downloadboob: def __init__(self, backend_name, download_directory, links_directory): diff --git a/contrib/videoob_web/videoob_web/videoob_web.py b/contrib/videoob_web/videoob_web/videoob_web.py index 46553144..822e5386 100644 --- a/contrib/videoob_web/videoob_web/videoob_web.py +++ b/contrib/videoob_web/videoob_web/videoob_web.py @@ -100,7 +100,7 @@ class VideoobWeb(BaseApplication): page_url=video.page_url, url=video.url if video.url else '/download?id=%s' % video.id, thumbnail_url=video.thumbnail.url, - ) \ + ) for video in backend.search_videos(pattern=q, nsfw=nsfw)] if videos: if merge: diff --git a/docs/source/genapi.py b/docs/source/genapi.py index 53a6c092..9994c52a 100755 --- a/docs/source/genapi.py +++ b/docs/source/genapi.py @@ -4,6 +4,7 @@ from __future__ import with_statement import os + def genapi(): os.system('rm -rf api') os.system('mkdir api') diff --git a/modules/arte/pages.py b/modules/arte/pages.py index e391ee03..230b73fc 100644 --- a/modules/arte/pages.py +++ b/modules/arte/pages.py @@ -75,6 +75,7 @@ class IndexPage(BasePage): yield video + class VideoPage(BasePage): def get_video(self, video=None, lang='fr', quality='hd'): if not video: diff --git a/modules/attilasub/pages.py b/modules/attilasub/pages.py index 3cd0ae1f..31b2092a 100644 --- a/modules/attilasub/pages.py +++ b/modules/attilasub/pages.py @@ -87,7 +87,7 @@ class SubtitlesPage(BasePage): traduced_title_words = traduced_title.split() original_title_words = original_title.split() - # if the pattern is one word and in the title OR if the + # if the pattern is one word and in the title OR if the # intersection between pattern and the title is at least 2 words if (len(pattern_words) == 1 and pattern in traduced_title_words) or\ (len(pattern_words) == 1 and pattern in original_title_words) or\ diff --git a/modules/attilasub/test.py b/modules/attilasub/test.py index 942d37ef..2746db65 100644 --- a/modules/attilasub/test.py +++ b/modules/attilasub/test.py @@ -22,6 +22,7 @@ from weboob.tools.test import BackendTest import urllib from random import choice + class AttilasubTest(BackendTest): BACKEND = 'attilasub' diff --git a/modules/aum/backend.py b/modules/aum/backend.py index f640008c..bf57762f 100644 --- a/modules/aum/backend.py +++ b/modules/aum/backend.py @@ -55,6 +55,7 @@ def parse_dt(s): d = _parse_dt(s) return local2utc(d) + class AuMBackend(BaseBackend, ICapMessages, ICapMessagesPost, ICapDating, ICapChat, ICapContact, ICapAccount): NAME = 'aum' MAINTAINER = u'Romain Bignon' @@ -503,6 +504,7 @@ class AuMBackend(BaseBackend, ICapMessages, ICapMessagesPost, ICapDating, ICapCh browser = None REGISTER_REGEXP = re.compile('.*http://www.adopteunmec.com/register4.php\?([^\' ]*)\'') + def confirm_account(self, mail): msg = email.message_from_string(mail) diff --git a/modules/aum/browser.py b/modules/aum/browser.py index f15b368b..c420e5a6 100644 --- a/modules/aum/browser.py +++ b/modules/aum/browser.py @@ -64,6 +64,7 @@ class AuMException(UserError): Exception.__init__(self, self.ERRORS.get(code, code)) self.code = code + class AuMBrowser(BaseBrowser): DOMAIN = 'www.adopteunmec.com' APIKEY = 'fb0123456789abcd' diff --git a/modules/aum/captcha.py b/modules/aum/captcha.py index 462d359a..44683a95 100644 --- a/modules/aum/captcha.py +++ b/modules/aum/captcha.py @@ -26,8 +26,10 @@ try: except ImportError: raise ImportError('Please install python-imaging') + class CaptchaError(Exception): pass + class Tile(object): hash = { 'bc8d52d96058478a6def26226145d53b': 'A', @@ -115,6 +117,7 @@ class Tile(object): print 'hash: %s' % checksum raise CaptchaError() + class Captcha(object): def __init__(self, f): self.img = Image.open(f) @@ -156,6 +159,7 @@ class Captcha(object): s += tile.letter return s + class Decoder(object): def __init__(self): self.hash = {} diff --git a/modules/aum/contact.py b/modules/aum/contact.py index 73556556..edf28680 100644 --- a/modules/aum/contact.py +++ b/modules/aum/contact.py @@ -140,6 +140,7 @@ class FieldConst(FieldBase): labels.append(consts[self.key][i]) return labels + class Contact(_Contact): TABLE = OrderedDict(( ('_info', OrderedDict(( diff --git a/modules/axabanque/pages.py b/modules/axabanque/pages.py index e74565de..41d0265b 100644 --- a/modules/axabanque/pages.py +++ b/modules/axabanque/pages.py @@ -40,6 +40,7 @@ class UnavailablePage(BasePage): def on_loaded(self): raise BrowserUnavailable() + class VirtKeyboard(MappedVirtKeyboard): symbols={'0':'f47e48cfdf3abc6716a6b0aadf8eebe3', '1':'3495abaf658dc550e51c5c92ea56b60b', @@ -148,6 +149,7 @@ class AccountsPage(BasePage): account._args = args yield account + class Transaction(FrenchTransaction): PATTERNS = [(re.compile('^RET(RAIT) DAB (?P
\d{2})/(?P\d{2}) (?P.*)'), FrenchTransaction.TYPE_WITHDRAWAL), diff --git a/modules/axabanque/test.py b/modules/axabanque/test.py index b170710e..8853c506 100644 --- a/modules/axabanque/test.py +++ b/modules/axabanque/test.py @@ -20,6 +20,7 @@ from weboob.tools.test import BackendTest + class AXABanqueTest(BackendTest): BACKEND = 'axabanque' diff --git a/modules/banquepopulaire/pages.py b/modules/banquepopulaire/pages.py index f8d4993a..76771c30 100644 --- a/modules/banquepopulaire/pages.py +++ b/modules/banquepopulaire/pages.py @@ -39,6 +39,7 @@ class UnavailablePage(BasePage): else: self.browser.location(a.attrib['href']) + class LoginPage(BasePage): def login(self, login, passwd): self.browser.select_form(name='Login') @@ -46,6 +47,7 @@ class LoginPage(BasePage): self.browser['IDToken2'] = passwd.encode(self.browser.ENCODING) self.browser.submit(nologin=True) + class IndexPage(BasePage): def get_token(self): url = self.document.getroot().xpath('//frame[@name="portalHeader"]')[0].attrib['src'] @@ -53,6 +55,7 @@ class IndexPage(BasePage): args = dict(parse_qsl(v.query)) return args['token'] + class AccountsPage(BasePage): ACCOUNT_TYPES = {u'Mes comptes d\'épargne': Account.TYPE_SAVINGS, u'Mes comptes': Account.TYPE_CHECKING, @@ -101,6 +104,7 @@ class AccountsPage(BasePage): return + class Transaction(FrenchTransaction): PATTERNS = [(re.compile('^RET DAB (?P.*?) RETRAIT (DU|LE) (?P
\d{2})(?P\d{2})(?P\d+).*'), FrenchTransaction.TYPE_WITHDRAWAL), diff --git a/modules/banquepopulaire/test.py b/modules/banquepopulaire/test.py index 61a9db28..08aabe21 100644 --- a/modules/banquepopulaire/test.py +++ b/modules/banquepopulaire/test.py @@ -20,6 +20,7 @@ from weboob.tools.test import BackendTest + class BanquePopulaireTest(BackendTest): BACKEND = 'banquepopulaire' diff --git a/modules/barclays/pages.py b/modules/barclays/pages.py index 0e640041..90742b59 100644 --- a/modules/barclays/pages.py +++ b/modules/barclays/pages.py @@ -44,6 +44,7 @@ class LoginPage(BasePage): else: return True + class Login2Page(BasePage): def login(self, secret): label = self.document.xpath('//span[@class="PF_LABEL"]')[0].text.strip() @@ -55,9 +56,11 @@ class Login2Page(BasePage): self.browser['word'] = letters self.browser.submit(name='valider', nologin=True) + class IndexPage(BasePage): pass + class AccountsPage(BasePage): ACCOUNT_TYPES = {u'Epargne': Account.TYPE_SAVINGS, u'Liquidités': Account.TYPE_CHECKING, @@ -170,11 +173,13 @@ class Transaction(FrenchTransaction): FrenchTransaction.TYPE_UNKNOWN), ] + class HistoryBasePage(BasePage): def get_history(self): self.logger.warning('Do not support account of type %s' % type(self).__name__) return iter([]) + class TransactionsPage(HistoryBasePage): def get_history(self): for tr in self.document.xpath('//table[@id="operation"]/tbody/tr'): @@ -229,11 +234,14 @@ class CardPage(HistoryBasePage): t.set_amount(amount) yield t + class ValuationPage(HistoryBasePage): pass + class LoanPage(HistoryBasePage): pass + class MarketPage(HistoryBasePage): pass diff --git a/modules/barclays/test.py b/modules/barclays/test.py index ab919703..3c951909 100644 --- a/modules/barclays/test.py +++ b/modules/barclays/test.py @@ -20,6 +20,7 @@ from weboob.tools.test import BackendTest + class BarclaysTest(BackendTest): BACKEND = 'barclays' diff --git a/modules/bnporc/perso/login.py b/modules/bnporc/perso/login.py index 0a560e12..423961bd 100644 --- a/modules/bnporc/perso/login.py +++ b/modules/bnporc/perso/login.py @@ -28,6 +28,7 @@ from weboob.tools.captcha.virtkeyboard import MappedVirtKeyboard,VirtKeyboardErr __all__ = ['LoginPage', 'ConfirmPage', 'ChangePasswordPage'] + class BNPVirtKeyboard(MappedVirtKeyboard): symbols={'0':'9cc4789a2cb223e8f2d5e676e90264b5', '1':'e10b58fc085f9683052d5a63c96fc912', @@ -100,10 +101,12 @@ class ConfirmPage(BasePage): if m: return m.group(1) + class InfoMessagePage(BasePage): def on_loaded(self): pass + class ChangePasswordPage(BasePage): def change_password(self, current, new): try: diff --git a/modules/bnporc/perso/transactions.py b/modules/bnporc/perso/transactions.py index 6c4899dd..bdf1ca8c 100644 --- a/modules/bnporc/perso/transactions.py +++ b/modules/bnporc/perso/transactions.py @@ -44,6 +44,7 @@ class Transaction(FrenchTransaction): (re.compile('^(?PREMISE CHEQUES)(?P.*)'), FrenchTransaction.TYPE_DEPOSIT), ] + class AccountHistory(BasePage): def iter_operations(self): for tr in self.document.xpath('//table[@id="tableCompte"]//tr'): diff --git a/modules/bnporc/perso/transfer.py b/modules/bnporc/perso/transfer.py index cdfdaad4..e771667c 100644 --- a/modules/bnporc/perso/transfer.py +++ b/modules/bnporc/perso/transfer.py @@ -35,6 +35,7 @@ class Account(object): self.send_checkbox = send_checkbox self.receive_checkbox = receive_checkbox + class TransferPage(BasePage): def on_loaded(self): for td in self.document.xpath('//td[@class="hdvon1"]'): diff --git a/modules/bnporc/pro.py b/modules/bnporc/pro.py index 023bef6c..5ea82274 100644 --- a/modules/bnporc/pro.py +++ b/modules/bnporc/pro.py @@ -36,6 +36,7 @@ class ProAccountsList(BasePage): COL_ID = 2 COL_BALANCE = 3 COL_COMING = 5 + def get_list(self): for tr in self.document.xpath('//tr[@class="comptes"]'): cols = tr.findall('td') @@ -57,6 +58,7 @@ class ProAccountsList(BasePage): yield account + class ProAccountHistory(BasePage): COL_DATE = 0 COL_LABEL = 1 diff --git a/modules/boursorama/pages/__init__.py b/modules/boursorama/pages/__init__.py index 615a7ef3..1b670040 100644 --- a/modules/boursorama/pages/__init__.py +++ b/modules/boursorama/pages/__init__.py @@ -23,6 +23,7 @@ from .account_history import AccountHistory from .accounts_list import AccountsList from .login import LoginPage, UpdateInfoPage + class AccountPrelevement(AccountsList): pass diff --git a/modules/boursorama/pages/account_history.py b/modules/boursorama/pages/account_history.py index 7b1aa6ae..70537520 100644 --- a/modules/boursorama/pages/account_history.py +++ b/modules/boursorama/pages/account_history.py @@ -29,6 +29,7 @@ from weboob.tools.capabilities.bank.transactions import FrenchTransaction __all__ = ['AccountHistory'] + class Transaction(FrenchTransaction): PATTERNS = [(re.compile(u'^CHQ\. (?P.*)'), FrenchTransaction.TYPE_CHECK), (re.compile('^(ACHAT|PAIEMENT) CARTE (?P
\d{2})(?P\d{2})(?P\d{2}) (?P.*)'), @@ -42,6 +43,7 @@ class Transaction(FrenchTransaction): (re.compile('^REM CHQ (?P.*)'), FrenchTransaction.TYPE_DEPOSIT), ] + class AccountHistory(BasePage): def on_loaded(self): diff --git a/modules/boursorama/pages/login.py b/modules/boursorama/pages/login.py index 14504d6b..5732bcd9 100644 --- a/modules/boursorama/pages/login.py +++ b/modules/boursorama/pages/login.py @@ -75,6 +75,7 @@ class VirtKeyboard(MappedVirtKeyboard): s += " " return hashlib.md5(s).hexdigest() + class LoginPage(BasePage): def on_loaded(self): pass @@ -98,6 +99,7 @@ class LoginPage(BasePage): self.browser.location(form.attrib['action'], urllib.urlencode(args), no_login=True) + class UpdateInfoPage(BasePage): def on_loaded(self): raise BrowserIncorrectPassword('Please update your user informations') diff --git a/modules/boursorama/test.py b/modules/boursorama/test.py index 667b3210..40e2ad26 100644 --- a/modules/boursorama/test.py +++ b/modules/boursorama/test.py @@ -21,6 +21,7 @@ from weboob.tools.test import BackendTest + class BoursoramaTest(BackendTest): BACKEND = 'boursorama' diff --git a/modules/bouygues/test.py b/modules/bouygues/test.py index 8bdf6745..511554fc 100644 --- a/modules/bouygues/test.py +++ b/modules/bouygues/test.py @@ -20,6 +20,7 @@ from weboob.tools.test import BackendTest + class BouyguesTest(BackendTest): BACKEND = 'bouygues' diff --git a/modules/bp/pages/accounthistory.py b/modules/bp/pages/accounthistory.py index 2a04fa6e..a5fa82ef 100644 --- a/modules/bp/pages/accounthistory.py +++ b/modules/bp/pages/accounthistory.py @@ -47,6 +47,7 @@ class Transaction(FrenchTransaction): (re.compile('^(?PREMISE DE CHEQUE) (?P.*)'), FrenchTransaction.TYPE_DEPOSIT), ] + class AccountHistory(BasePage): def get_next_link(self): for a in self.document.xpath('//a[@class="btn_crt"]'): @@ -105,6 +106,7 @@ class AccountHistory(BasePage): operations.append(op) return operations + class CardsList(BasePage): def get_cards(self): cards = [] diff --git a/modules/bp/pages/login.py b/modules/bp/pages/login.py index c0a3e5a0..3b939ea7 100644 --- a/modules/bp/pages/login.py +++ b/modules/bp/pages/login.py @@ -30,6 +30,7 @@ def md5(f): md5.update(f.read()) return md5.hexdigest() + class UnavailablePage(BasePage): def on_loaded(self): raise BrowserUnavailable() @@ -57,14 +58,17 @@ class LoginPage(BasePage): self.browser['username'] = login self.browser.submit() + class repositionnerCheminCourant(BasePage): def on_loaded(self): self.browser.open("https://voscomptesenligne.labanquepostale.fr/voscomptes/canalXHTML/securite/authentification/initialiser-identif.ea") + class Initident(BasePage): def on_loaded(self): self.browser.open("https://voscomptesenligne.labanquepostale.fr/voscomptes/canalXHTML/securite/authentification/verifierMotDePasse-identif.ea") + class CheckPassword(BasePage): def on_loaded(self): self.browser.open("https://voscomptesenligne.labanquepostale.fr/voscomptes/canalXHTML/comptesCommun/synthese_assurancesEtComptes/init-synthese.ea") diff --git a/modules/bred/pages.py b/modules/bred/pages.py index 4d36d331..accdb48b 100644 --- a/modules/bred/pages.py +++ b/modules/bred/pages.py @@ -37,6 +37,7 @@ class LoginPage(BasePage): self.browser['pass'] = passwd.encode(self.browser.ENCODING) self.browser.submit(nologin=True) + class LoginResultPage(BasePage): def confirm(self): self.browser.location('MainAuth?typeDemande=AC', no_login=True) @@ -52,9 +53,11 @@ class LoginResultPage(BasePage): return error.text.strip() + class EmptyPage(BasePage): pass + class BredBasePage(BasePage): def js2args(self, s): cur_arg = None @@ -70,6 +73,7 @@ class BredBasePage(BasePage): return args + class AccountsPage(BredBasePage): def get_list(self): accounts = [] @@ -123,6 +127,7 @@ class AccountsPage(BredBasePage): return accounts + class Transaction(FrenchTransaction): PATTERNS = [(re.compile('^RETRAIT G.A.B. \d+ (?P.*?)( CARTE .*)? LE (?P
\d{2})/(?P\d{2})/(?P\d{2}).*'), FrenchTransaction.TYPE_WITHDRAWAL), diff --git a/modules/bred/test.py b/modules/bred/test.py index 4e24f66d..105901a7 100644 --- a/modules/bred/test.py +++ b/modules/bred/test.py @@ -20,6 +20,7 @@ from weboob.tools.test import BackendTest + class BredTest(BackendTest): BACKEND = 'bred' diff --git a/modules/btmon/pages.py b/modules/btmon/pages.py index 98a1e03c..7b343e48 100644 --- a/modules/btmon/pages.py +++ b/modules/btmon/pages.py @@ -64,7 +64,6 @@ class TorrentsPage(BasePage): torrent.description = NotLoaded torrent.files = NotLoaded yield torrent - class TorrentPage(BasePage): @@ -86,7 +85,7 @@ class TorrentPage(BasePage): href_t = self.parser.select(div,'a.down',1).attrib.get('href','') url = u'http://%s%s'%(self.browser.DOMAIN,href_t) magnet = unicode(self.parser.select(div,'a.magnet',1).attrib.get('href','')) - + divtabs = self.parser.select(div,'div#tabs',1) files_div = self.parser.select(divtabs,'div.body > div.doubleblock > div.leftblock') files = [] diff --git a/modules/btmon/test.py b/modules/btmon/test.py index 6ba714fc..bc356ae5 100644 --- a/modules/btmon/test.py +++ b/modules/btmon/test.py @@ -22,6 +22,7 @@ from weboob.capabilities.base import NotLoaded from random import choice + class BtmonTest(BackendTest): BACKEND = 'btmon' diff --git a/modules/caissedepargne/pages.py b/modules/caissedepargne/pages.py index 1c161f0c..f1fafdff 100644 --- a/modules/caissedepargne/pages.py +++ b/modules/caissedepargne/pages.py @@ -54,6 +54,7 @@ class LoginPage(BasePage): self.browser.form.action = m.group(1) self.browser.submit(nologin=True) + class ErrorPage(BasePage): def get_error(self): try: @@ -61,6 +62,7 @@ class ErrorPage(BasePage): except BrokenPageError: return None + class UnavailablePage(BasePage): def on_loaded(self): try: @@ -68,6 +70,7 @@ class UnavailablePage(BasePage): except BrokenPageError: raise BrowserUnavailable() + class Transaction(FrenchTransaction): PATTERNS = [(re.compile('^CB (?P.*?) FACT (?P
\d{2})(?P\d{2})(?P\d{2})'), FrenchTransaction.TYPE_CARD), @@ -87,6 +90,7 @@ class Transaction(FrenchTransaction): (re.compile('^CB [\d\*]+ (?P.*)'), FrenchTransaction.TYPE_CARD), ] + class IndexPage(BasePage): ACCOUNT_TYPES = {u'Epargne liquide': Account.TYPE_SAVINGS, u'Compte Courant': Account.TYPE_CHECKING, diff --git a/modules/caissedepargne/test.py b/modules/caissedepargne/test.py index 41beac04..8b489abe 100644 --- a/modules/caissedepargne/test.py +++ b/modules/caissedepargne/test.py @@ -20,6 +20,7 @@ from weboob.tools.test import BackendTest + class CaisseEpargneTest(BackendTest): BACKEND = 'caissedepargne' diff --git a/modules/canalplus/test.py b/modules/canalplus/test.py index e7d75689..41b76cc9 100644 --- a/modules/canalplus/test.py +++ b/modules/canalplus/test.py @@ -21,6 +21,7 @@ from weboob.tools.test import BackendTest from weboob.capabilities.video import BaseVideo + class CanalPlusTest(BackendTest): BACKEND = 'canalplus' diff --git a/modules/canaltp/test.py b/modules/canaltp/test.py index 23b02cf5..5207b319 100644 --- a/modules/canaltp/test.py +++ b/modules/canaltp/test.py @@ -20,6 +20,7 @@ from weboob.tools.test import BackendTest + class CanalTPTest(BackendTest): BACKEND = 'canaltp' diff --git a/modules/carrefourbanque/pages.py b/modules/carrefourbanque/pages.py index 74b2c6a1..4647e952 100644 --- a/modules/carrefourbanque/pages.py +++ b/modules/carrefourbanque/pages.py @@ -39,9 +39,11 @@ class LoginPage(BasePage): except FormNotFoundError: raise BrowserIncorrectPassword() + class HomePage(BasePage): pass + class AccountsPage(BasePage): def get_list(self): div = self.document.xpath('//div[@id="descriptifdroite"]')[0] @@ -73,6 +75,7 @@ class AccountsPage(BasePage): yield account + class TransactionsPage(BasePage): COL_DATE = 0 COL_TEXT = 1 diff --git a/modules/carrefourbanque/test.py b/modules/carrefourbanque/test.py index 2fd36ba6..e67a3da7 100644 --- a/modules/carrefourbanque/test.py +++ b/modules/carrefourbanque/test.py @@ -20,6 +20,7 @@ from weboob.tools.test import BackendTest + class CarrefourBanqueTest(BackendTest): BACKEND = 'carrefourbanque' diff --git a/modules/cic/pages.py b/modules/cic/pages.py index b3875474..54bf887e 100644 --- a/modules/cic/pages.py +++ b/modules/cic/pages.py @@ -28,6 +28,7 @@ from weboob.tools.ordereddict import OrderedDict from weboob.capabilities.bank import Account from weboob.tools.capabilities.bank.transactions import FrenchTransaction + class LoginPage(BasePage): def login(self, login, passwd): self.browser.select_form(name='ident') @@ -35,25 +36,32 @@ class LoginPage(BasePage): self.browser['_cm_pwd'] = passwd self.browser.submit(nologin=True) + class LoginErrorPage(BasePage): pass + class ChangePasswordPage(BasePage): def on_loaded(self): raise BrowserIncorrectPassword('Please change your password') + class InfoPage(BasePage): pass + class EmptyPage(BasePage): pass + class TransfertPage(BasePage): pass + class UserSpacePage(BasePage): pass + class AccountsPage(BasePage): def get_list(self): accounts = OrderedDict() @@ -102,6 +110,7 @@ class AccountsPage(BasePage): return accounts.itervalues() + class Transaction(FrenchTransaction): PATTERNS = [(re.compile('^VIR(EMENT)? (?P.*)'), FrenchTransaction.TYPE_TRANSFER), (re.compile('^PRLV (?P.*)'), FrenchTransaction.TYPE_ORDER), @@ -116,6 +125,7 @@ class Transaction(FrenchTransaction): _is_coming = False + class OperationsPage(BasePage): def get_history(self): index = 0 @@ -181,6 +191,7 @@ class OperationsPage(BasePage): return True + class CardPage(OperationsPage): def get_history(self): index = 0 @@ -200,6 +211,7 @@ class CardPage(OperationsPage): tr.set_amount(tds[-1].text) yield tr + class NoOperationsPage(OperationsPage): def get_history(self): return iter([]) diff --git a/modules/cic/test.py b/modules/cic/test.py index 2391716b..50b96311 100644 --- a/modules/cic/test.py +++ b/modules/cic/test.py @@ -20,6 +20,7 @@ from weboob.tools.test import BackendTest + class CICTest(BackendTest): BACKEND = 'cic' diff --git a/modules/cmb/hellhttp.py b/modules/cmb/hellhttp.py index f7559471..56c445ac 100644 --- a/modules/cmb/hellhttp.py +++ b/modules/cmb/hellhttp.py @@ -29,6 +29,7 @@ __all__ = ['HTTPSVerifiedConnection', 'HellHTTPS'] PROXY_PORT = 8080 + class HTTPSVerifiedConnection(httplib.HTTPSConnection): """ This class allows communication via SSL, and will checks certificates @@ -54,7 +55,7 @@ class HTTPSVerifiedConnection(httplib.HTTPSConnection): if self._tunnel_host: self.sock = sock self._tunnel() - + if self.ca_file: self.sock = ssl.wrap_socket(sock, self.key_file, @@ -102,7 +103,7 @@ class HellHTTPS: else: self.conn = HTTPSVerifiedConnection(host, port, key_file, cert_file, ca_file, strict, timeout, callBack) - + def request(self, *args, **kwargs): self.conn.request(*args, **kwargs) diff --git a/modules/cmso/pages.py b/modules/cmso/pages.py index b3361dd8..dca98bd5 100644 --- a/modules/cmso/pages.py +++ b/modules/cmso/pages.py @@ -37,6 +37,7 @@ class LoginPage(BasePage): self.browser['motDePasse'] = passwd.encode(self.browser.ENCODING) self.browser.submit(nologin=True) + class AccountsPage(BasePage): def get_list(self): names = set() diff --git a/modules/cmso/test.py b/modules/cmso/test.py index d13661b9..86456875 100644 --- a/modules/cmso/test.py +++ b/modules/cmso/test.py @@ -20,6 +20,7 @@ from weboob.tools.test import BackendTest + class CmsoTest(BackendTest): BACKEND = 'cmso' diff --git a/modules/cragr/browser.py b/modules/cragr/browser.py index 2eed4e97..f8e5ff12 100644 --- a/modules/cragr/browser.py +++ b/modules/cragr/browser.py @@ -26,6 +26,7 @@ import mechanize from datetime import datetime import re + class Cragr(BaseBrowser): PROTOCOL = 'https' ENCODING = 'utf-8' diff --git a/modules/cragr/pages/accounts_list.py b/modules/cragr/pages/accounts_list.py index 1432c69b..2d881ca9 100644 --- a/modules/cragr/pages/accounts_list.py +++ b/modules/cragr/pages/accounts_list.py @@ -25,6 +25,7 @@ from .base import CragrBasePage from .tokenextractor import TokenExtractor from weboob.tools.capabilities.bank.transactions import FrenchTransaction + class Transaction(FrenchTransaction): PATTERNS = [ (re.compile('^(Vp|Vt|Vrt|Virt|Vir(ement)?)\s*(?P.*)', re.IGNORECASE), FrenchTransaction.TYPE_TRANSFER), @@ -44,6 +45,7 @@ class Transaction(FrenchTransaction): (re.compile('^RET.CARTE (?P.*)', re.IGNORECASE), FrenchTransaction.TYPE_WITHDRAWAL), ] + class AccountsList(CragrBasePage): """ Unlike most pages used with the Browser class, this class represents diff --git a/modules/cragr/pages/base.py b/modules/cragr/pages/base.py index 8b40651e..bf969c9e 100644 --- a/modules/cragr/pages/base.py +++ b/modules/cragr/pages/base.py @@ -21,6 +21,7 @@ from weboob.tools.browser import BasePage from weboob.tools.browser import BrowserUnavailable + class CragrBasePage(BasePage): def on_loaded(self): # Check for an error diff --git a/modules/cragr/pages/tokenextractor.py b/modules/cragr/pages/tokenextractor.py index abdd280e..d5997023 100644 --- a/modules/cragr/pages/tokenextractor.py +++ b/modules/cragr/pages/tokenextractor.py @@ -17,16 +17,19 @@ # You should have received a copy of the GNU Affero General Public License # along with weboob. If not, see . + class TokenExtractor: """ Extracts texts token from an HTML document """ def __init__(self): self.iterated_elements = [] + def clear(self): """ Reset any content stored within a TokenExtractor object. Useful to start a new parsing without creating a new instance. """ self.iterated_elements = [] + def element_iterated_already(self, html_element): if html_element in self.iterated_elements: return True @@ -34,6 +37,7 @@ class TokenExtractor: if ancestor in self.iterated_elements: return True return False + def extract_tokens(self, html_element): if self.element_iterated_already(html_element): return @@ -44,10 +48,12 @@ class TokenExtractor: for token in self.split_text_into_smaller_tokens(text): if self.token_looks_relevant(token): yield token.strip() + @staticmethod def split_text_into_smaller_tokens(text): for subtext1 in text.split('\t'): yield subtext1 + @staticmethod def token_looks_relevant(token): return len(token.strip()) > 1 diff --git a/modules/cragr/test.py b/modules/cragr/test.py index 8545f4a3..58424d17 100644 --- a/modules/cragr/test.py +++ b/modules/cragr/test.py @@ -20,6 +20,7 @@ from weboob.tools.test import BackendTest + class CrAgrTest(BackendTest): BACKEND = 'cragr' diff --git a/modules/creditcooperatif/perso/pages.py b/modules/creditcooperatif/perso/pages.py index 2cbd9a65..0fadd383 100644 --- a/modules/creditcooperatif/perso/pages.py +++ b/modules/creditcooperatif/perso/pages.py @@ -37,6 +37,7 @@ class LoginPage(BasePage): self.browser['j_password'] = password.encode('iso-8859-15') self.browser.submit(nologin=True) + class LoggedPage(BasePage): def get_error(self): div = self.document.xpath('//div[@class="errorForm-msg"]') @@ -46,6 +47,7 @@ class LoggedPage(BasePage): msg = u', '.join([li.text.strip() for li in div[0].xpath('.//li')]) return re.sub('[\r\n\t\xa0]+', ' ', msg) + class AccountsPage(BasePage): ACCOUNT_TYPES = {u'COMPTE NEF': Account.TYPE_CHECKING} @@ -65,6 +67,7 @@ class AccountsPage(BasePage): yield account + class Transaction(FrenchTransaction): PATTERNS = [(re.compile('^(?PRETRAIT DAB) (?P
\d{2})-(?P\d{2})-([\d\-]+)'), FrenchTransaction.TYPE_WITHDRAWAL), @@ -88,9 +91,11 @@ class Transaction(FrenchTransaction): FrenchTransaction.TYPE_UNKNOWN), ] + class TransactionsPage(BasePage): pass + class TransactionsJSONPage(BasePage): ROW_DATE = 0 ROW_TEXT = 2 @@ -104,6 +109,7 @@ class TransactionsJSONPage(BasePage): t.set_amount(tr[self.ROW_CREDIT], tr[self.ROW_DEBIT]) yield t + class ComingTransactionsPage(BasePage): ROW_REF = 0 ROW_TEXT = 1 diff --git a/modules/creditcooperatif/pro/pages.py b/modules/creditcooperatif/pro/pages.py index 1d30d131..44d66d84 100644 --- a/modules/creditcooperatif/pro/pages.py +++ b/modules/creditcooperatif/pro/pages.py @@ -29,6 +29,7 @@ from weboob.tools.capabilities.bank.transactions import FrenchTransaction __all__ = ['LoginPage', 'AccountsPage', 'TransactionsPage', 'ComingTransactionsPage'] + class LoginPage(BasePage): def login(self, login, pin, strong_auth): form_nb = 1 if strong_auth else 0 @@ -41,6 +42,7 @@ class LoginPage(BasePage): assert self.browser['identType'] == indentType self.browser.submit(nologin=True) + class AccountsPage(BasePage): ACCOUNT_TYPES = {u'COMPTE NEF': Account.TYPE_CHECKING} @@ -77,6 +79,7 @@ class AccountsPage(BasePage): return + class Transaction(FrenchTransaction): PATTERNS = [(re.compile('^RETRAIT DAB (?P.*?).*'), FrenchTransaction.TYPE_WITHDRAWAL), @@ -95,6 +98,7 @@ class Transaction(FrenchTransaction): FrenchTransaction.TYPE_UNKNOWN), ] + class TransactionsPage(BasePage): def get_next_url(self): # can be 'Suivant' or ' Suivant' @@ -109,6 +113,7 @@ class TransactionsPage(BasePage): TR_TEXT = 2 TR_DEBIT = 3 TR_CREDIT = 4 + def get_history(self): for tr in self.document.xpath('//table[@id="operation"]/tbody/tr'): tds = tr.findall('td') @@ -129,6 +134,7 @@ class TransactionsPage(BasePage): yield t + class ComingTransactionsPage(BasePage): COM_TR_COMMENT = 0 COM_TR_DATE = 1 diff --git a/modules/creditcooperatif/test.py b/modules/creditcooperatif/test.py index 1ba65654..39bd5d21 100644 --- a/modules/creditcooperatif/test.py +++ b/modules/creditcooperatif/test.py @@ -20,6 +20,7 @@ from weboob.tools.test import BackendTest + class CreditCooperatifTest(BackendTest): BACKEND = 'creditcooperatif' diff --git a/modules/creditdunord/pages.py b/modules/creditdunord/pages.py index 193907db..17712f9a 100644 --- a/modules/creditdunord/pages.py +++ b/modules/creditdunord/pages.py @@ -34,6 +34,7 @@ __all__ = ['LoginPage', 'AccountsPage', 'TransactionsPage'] class LoginPage(BasePage): pass + class CDNBasePage(BasePage): def get_from_js(self, pattern, end, is_list=False): """ @@ -69,6 +70,7 @@ class CDNBasePage(BasePage): def get_execution(self): return self.get_from_js("name: 'execution', value: '", "'") + class AccountsPage(CDNBasePage): COL_HISTORY = 2 COL_ID = 4 @@ -113,6 +115,7 @@ class AccountsPage(CDNBasePage): return iter(accounts) + class Transaction(FrenchTransaction): PATTERNS = [(re.compile(r'^(?PRET DAB \w+ .*?) LE (?P
\d{2})(?P\d{2})$'), FrenchTransaction.TYPE_WITHDRAWAL), diff --git a/modules/creditdunord/test.py b/modules/creditdunord/test.py index 4cf04dbd..d23db48f 100644 --- a/modules/creditdunord/test.py +++ b/modules/creditdunord/test.py @@ -20,6 +20,7 @@ from weboob.tools.test import BackendTest + class CreditDuNordTest(BackendTest): BACKEND = 'creditdunord' diff --git a/modules/creditmutuel/pages.py b/modules/creditmutuel/pages.py index 5cf0794f..bb933c6a 100644 --- a/modules/creditmutuel/pages.py +++ b/modules/creditmutuel/pages.py @@ -28,6 +28,7 @@ from weboob.tools.ordereddict import OrderedDict from weboob.capabilities.bank import Account from weboob.tools.capabilities.bank.transactions import FrenchTransaction + class LoginPage(BasePage): def login(self, login, passwd): self.browser.select_form(nr=0) @@ -35,25 +36,32 @@ class LoginPage(BasePage): self.browser['_cm_pwd'] = passwd self.browser.submit(nologin=True) + class LoginErrorPage(BasePage): pass + class ChangePasswordPage(BasePage): def on_loaded(self): raise BrowserIncorrectPassword('Please change your password') + class InfoPage(BasePage): pass + class EmptyPage(BasePage): pass + class TransfertPage(BasePage): pass + class UserSpacePage(BasePage): pass + class AccountsPage(BasePage): def get_list(self): accounts = OrderedDict() @@ -102,6 +110,7 @@ class AccountsPage(BasePage): return accounts.itervalues() + class Transaction(FrenchTransaction): PATTERNS = [(re.compile('^VIR(EMENT)? (?P.*)'), FrenchTransaction.TYPE_TRANSFER), (re.compile('^PRLV (?P.*)'), FrenchTransaction.TYPE_ORDER), @@ -116,6 +125,7 @@ class Transaction(FrenchTransaction): _is_coming = False + class OperationsPage(BasePage): def get_history(self): index = 0 @@ -181,6 +191,7 @@ class OperationsPage(BasePage): return True + class CardPage(OperationsPage): def get_history(self): index = 0 @@ -200,6 +211,7 @@ class CardPage(OperationsPage): tr.set_amount(tds[-1].text) yield tr + class NoOperationsPage(OperationsPage): def get_history(self): return iter([]) diff --git a/modules/creditmutuel/test.py b/modules/creditmutuel/test.py index e34a480b..b152b39e 100644 --- a/modules/creditmutuel/test.py +++ b/modules/creditmutuel/test.py @@ -20,6 +20,7 @@ from weboob.tools.test import BackendTest + class CreditMutuelTest(BackendTest): BACKEND = 'creditmutuel' @@ -28,5 +29,3 @@ class CreditMutuelTest(BackendTest): if len(l) > 0: a = l[0] list(self.backend.iter_history(a)) - - diff --git a/modules/dailymotion/backend.py b/modules/dailymotion/backend.py index 03a05896..b348f2f7 100644 --- a/modules/dailymotion/backend.py +++ b/modules/dailymotion/backend.py @@ -45,6 +45,7 @@ class DailymotionBackend(BaseBackend, ICapVideo, ICapCollection): return self.browser.get_video(_id) SORTBY = ['relevance', 'rated', 'visited', None] + def search_videos(self, pattern, sortby=ICapVideo.SEARCH_RELEVANCE, nsfw=False, max_results=None): with self.browser: return self.browser.search_videos(pattern, self.SORTBY[sortby]) diff --git a/modules/dailymotion/pages.py b/modules/dailymotion/pages.py index dd90c35c..dda038c1 100644 --- a/modules/dailymotion/pages.py +++ b/modules/dailymotion/pages.py @@ -85,6 +85,7 @@ class IndexPage(BasePage): self.browser.logger.warning('Unable to parse rating: %s' % div.attrib['style']) return 0 + class VideoPage(BasePage): def get_video(self, video=None): if video is None: diff --git a/modules/dlfp/backend.py b/modules/dlfp/backend.py index a0874ab4..59ca9a6d 100644 --- a/modules/dlfp/backend.py +++ b/modules/dlfp/backend.py @@ -167,7 +167,7 @@ class DLFPBackend(BaseBackend, ICapMessages, ICapMessagesPost, ICapContent): date=com.date, parent=parent, content=com.body, - signature=com.signature + \ + signature=com.signature + '
'.join(['Score: %d' % com.score, 'URL: %s' % com.url]), children=[], diff --git a/modules/dlfp/browser.py b/modules/dlfp/browser.py index bb20ba90..a597636c 100644 --- a/modules/dlfp/browser.py +++ b/modules/dlfp/browser.py @@ -33,6 +33,8 @@ from .pages.wiki import WikiEditPage from .tools import id2url, url2id # Browser + + class DLFP(BaseBrowser): DOMAIN = 'linuxfr.org' PROTOCOL = 'https' diff --git a/modules/dlfp/pages/board.py b/modules/dlfp/pages/board.py index 122feaeb..9bf60ad4 100644 --- a/modules/dlfp/pages/board.py +++ b/modules/dlfp/pages/board.py @@ -23,8 +23,10 @@ from logging import warning from weboob.tools.browser import BasePage + class Message(object): TIMESTAMP_REGEXP = re.compile(r'(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})') + def __init__(self, id, timestamp, login, message, is_me): self.id = id self.timestamp = timestamp @@ -40,6 +42,7 @@ class Message(object): else: warning('Unable to parse timestamp "%s"' % timestamp) + class BoardIndexPage(BasePage): def is_logged(self): return True diff --git a/modules/dlfp/pages/index.py b/modules/dlfp/pages/index.py index 27e0620f..227f768f 100644 --- a/modules/dlfp/pages/index.py +++ b/modules/dlfp/pages/index.py @@ -20,6 +20,7 @@ from weboob.tools.browser import BasePage + class DLFPPage(BasePage): def is_logged(self): for form in self.document.getiterator('form'): @@ -28,6 +29,7 @@ class DLFPPage(BasePage): return True + class IndexPage(DLFPPage): def get_login_token(self): form = self.parser.select(self.document.getroot(), 'form#new_account_sidebar', 1) @@ -35,5 +37,6 @@ class IndexPage(DLFPPage): if i.attrib['name'] == 'authenticity_token': return i.attrib['value'] + class LoginPage(DLFPPage): pass diff --git a/modules/dlfp/pages/news.py b/modules/dlfp/pages/news.py index d363a693..b49bd228 100644 --- a/modules/dlfp/pages/news.py +++ b/modules/dlfp/pages/news.py @@ -26,10 +26,12 @@ from ..tools import url2id from .index import DLFPPage + class RSSComment(DLFPPage): def on_loaded(self): pass + class Content(object): TAGGABLE = False @@ -50,6 +52,7 @@ class Content(object): def is_taggable(self): return False + class Comment(Content): def __init__(self, article, div, reply_id): Content.__init__(self, article.browser) @@ -105,6 +108,7 @@ class Comment(Content): def __repr__(self): return u"" % (self.id, self.author, self.title) + class Article(Content): TAGGABLE = True @@ -149,11 +153,13 @@ class Article(Content): for c in comment.iter_all_comments(): yield c + class CommentPage(DLFPPage): def get_comment(self): article = Article(self.browser, self.url, None) return Comment(article, self.parser.select(self.document.getroot(), 'li.comment', 1), 0) + class ContentPage(DLFPPage): def on_loaded(self): self.article = None @@ -192,9 +198,11 @@ class ContentPage(DLFPPage): def get_tag_url(self): return self.parser.select(self.document.getroot(), 'div.tag_in_place', 1).find('a').attrib['href'] + class NewCommentPage(DLFPPage): pass + class NewTagPage(DLFPPage): def _is_tag_form(self, form): return form.action.endswith('/tags') @@ -204,6 +212,7 @@ class NewTagPage(DLFPPage): self.browser['tags'] = tag self.browser.submit() + class NodePage(DLFPPage): def get_errors(self): try: diff --git a/modules/dlfp/pages/wiki.py b/modules/dlfp/pages/wiki.py index 655b6fcf..e59165fe 100644 --- a/modules/dlfp/pages/wiki.py +++ b/modules/dlfp/pages/wiki.py @@ -21,6 +21,7 @@ from weboob.tools.browser import BrokenPageError from .index import DLFPPage + class WikiEditPage(DLFPPage): def get_body(self): try: diff --git a/modules/dlfp/tools.py b/modules/dlfp/tools.py index 52486565..5a2933b0 100644 --- a/modules/dlfp/tools.py +++ b/modules/dlfp/tools.py @@ -31,9 +31,11 @@ REGEXPS = {'/users/%s/journaux/%s': 'D%s.%s', '/forums/%s/posts/%s': 'B%s.%s', } + def f2re(f): return '.*' + f.replace('%s', '([^ /]+)') + def rssid(entry): m = RSSID_RE.match(entry.id) if not m: @@ -53,6 +55,7 @@ def rssid(entry): else: return '%s.%s' % (ind, m.group(2)) + def id2url(id): m = ID2URL_RE.match(id) if not m: @@ -67,6 +70,7 @@ def id2url(id): else: return url_re % m.group(3) + def url2id(url): for url_re, id_re in REGEXPS.iteritems(): m = re.match(f2re(url_re), url) @@ -75,6 +79,7 @@ def url2id(url): return id_re % m.groups() + def id2threadid(id): m = ID2URL_RE.match(id) if m: diff --git a/modules/dresdenwetter/pages.py b/modules/dresdenwetter/pages.py index b4faae81..abd7dbc6 100644 --- a/modules/dresdenwetter/pages.py +++ b/modules/dresdenwetter/pages.py @@ -26,7 +26,7 @@ __all__ = ['StartPage'] class StartPage(BasePage): - name = [u"Temperatur", u"Wind", u"Luftdruck", u"Luftfeuchtigkeit",\ + name = [u"Temperatur", u"Wind", u"Luftdruck", u"Luftfeuchtigkeit", u"Niederschlag", u"Globalstrahlung", u"Schneehoehe"] unit = [u"°C", u"km/h", u"hPa", u"%", u"mm", u"W/m²", u"cm"] @@ -54,7 +54,7 @@ class StartPage(BasePage): lastvalue.level = float(text.split('\n')[2].split('hPa')[0]) if i == 3: text = paraph.xpath('span/font[@size="4"]/b')[0].text - lastvalue.level = float(text.split('\n')[2].split(u'%')[0]\ + lastvalue.level = float(text.split('\n')[2].split(u'%')[0] .split(':')[1]) if i == 4: text = paraph.xpath('b/font[@size="4"]/span')[0].text diff --git a/modules/ehentai/backend.py b/modules/ehentai/backend.py index ba5df4e2..cab872a4 100644 --- a/modules/ehentai/backend.py +++ b/modules/ehentai/backend.py @@ -65,6 +65,7 @@ class EHentaiBackend(BaseBackend, ICapGallery, ICapCollection): ID_REGEXP = r'/?\d+/[\dabcdef]+/?' URL_REGEXP = r'.+/g/(%s)' % ID_REGEXP + def get_gallery(self, _id): match = re.match(r'^%s$' % self.URL_REGEXP, _id) if match: diff --git a/modules/ehentai/gallery.py b/modules/ehentai/gallery.py index 4b8ff830..4b839288 100644 --- a/modules/ehentai/gallery.py +++ b/modules/ehentai/gallery.py @@ -21,10 +21,12 @@ from weboob.capabilities.gallery import BaseGallery, BaseImage __all_ = ['EHentaiGallery', 'EHentaiImage'] + class EHentaiGallery(BaseGallery): def __init__(self, *args, **kwargs): BaseGallery.__init__(self, *args, **kwargs) + class EHentaiImage(BaseImage): def __init__(self, *args, **kwargs): BaseImage.__init__(self, *args, **kwargs) diff --git a/modules/europarl/pages.py b/modules/europarl/pages.py index 9e5378f3..4d10de31 100644 --- a/modules/europarl/pages.py +++ b/modules/europarl/pages.py @@ -34,6 +34,7 @@ from .video import EuroparlVideo __all__ = ['VideoPage'] + class VideoPage(BasePage): def get_video(self, video=None): if video is None: @@ -67,7 +68,7 @@ class VideoPage(BasePage): for span in self.parser.select(obj[0], 'span.ep_acronym, span.ep_theme'): if span.text_content(): title += ' ' + span.text_content().strip() - + return title def set_details(self, v): @@ -89,7 +90,7 @@ class VideoPage(BasePage): day=int(day), hour=int(hour), minute=int(minute)) - + obj = self.parser.select(self.document.getroot(), 'span.ep_subtitle', 1) if obj is not None: span = self.parser.select(obj, 'span.ep_date', 1) @@ -104,7 +105,7 @@ class VideoPage(BasePage): day = m.group(5) month = m.group(6) year = m.group(7) - + start = datetime.datetime(year=int(year), month=int(month), day=int(day), diff --git a/modules/europarl/video.py b/modules/europarl/video.py index c1cc3907..d4ce0087 100644 --- a/modules/europarl/video.py +++ b/modules/europarl/video.py @@ -47,4 +47,3 @@ class EuroparlVideo(BaseVideo): if m: return u'http://www.europarl.europa.eu/ep-live/en/plenary/video?debate=%s' % _id return None - diff --git a/modules/fortuneo/browser.py b/modules/fortuneo/browser.py index 481743fa..8000bd59 100644 --- a/modules/fortuneo/browser.py +++ b/modules/fortuneo/browser.py @@ -29,6 +29,7 @@ from .pages.accounts_list import GlobalAccountsList, AccountsList, AccountHistor __all__ = ['Fortuneo'] + class Fortuneo(BaseBrowser): DOMAIN_LOGIN = 'www.fortuneo.fr' DOMAIN = 'www.fortuneo.fr' diff --git a/modules/fortuneo/pages/accounts_list.py b/modules/fortuneo/pages/accounts_list.py index 36f46f3b..20447aa0 100644 --- a/modules/fortuneo/pages/accounts_list.py +++ b/modules/fortuneo/pages/accounts_list.py @@ -52,6 +52,7 @@ class Transaction(FrenchTransaction): (re.compile('^(?PREMISE CHEQUES)(?P.*)'), FrenchTransaction.TYPE_DEPOSIT), ] + class AccountHistoryPage(BasePage): def get_operations(self, _id): """history, see http://docs.weboob.org/api/capabilities/bank.html?highlight=transaction#weboob.capabilities.bank.Transaction""" @@ -85,6 +86,7 @@ class AccountHistoryPage(BasePage): yield operation + class AccountsList(BasePage): def on_loaded(self): warn = self.document.xpath('//div[@id="message_renouvellement_mot_passe"]') @@ -156,6 +158,7 @@ class AccountsList(BasePage): yield account + class GlobalAccountsList(BasePage): pass diff --git a/modules/fortuneo/pages/login.py b/modules/fortuneo/pages/login.py index 6893815d..285032f1 100644 --- a/modules/fortuneo/pages/login.py +++ b/modules/fortuneo/pages/login.py @@ -25,6 +25,7 @@ from weboob.tools.browser import BasePage, BrowserUnavailable __all__ = ['LoginPage'] + class LoginPage(BasePage): def login(self, login, passwd): msgb = self.document.xpath(".//*[@id='message_client']/text()") diff --git a/modules/fortuneo/test.py b/modules/fortuneo/test.py index 4894c651..04dcd655 100644 --- a/modules/fortuneo/test.py +++ b/modules/fortuneo/test.py @@ -20,6 +20,7 @@ from weboob.tools.test import BackendTest + class FortuneoTest(BackendTest): BACKEND = 'fortuneo' diff --git a/modules/fourchan/test.py b/modules/fourchan/test.py index 245e34eb..c60e97b9 100644 --- a/modules/fourchan/test.py +++ b/modules/fourchan/test.py @@ -21,6 +21,7 @@ from logging import debug from weboob.tools.test import BackendTest + class FourChanTest(BackendTest): BACKEND = 'fourchan' diff --git a/modules/francetelevisions/test.py b/modules/francetelevisions/test.py index 0d7acd29..5f3cb75c 100644 --- a/modules/francetelevisions/test.py +++ b/modules/francetelevisions/test.py @@ -21,6 +21,7 @@ from weboob.tools.test import BackendTest from weboob.capabilities.video import BaseVideo + class PluzzTest(BackendTest): BACKEND = 'francetelevisions' diff --git a/modules/ganassurances/pages.py b/modules/ganassurances/pages.py index b427448d..ae8da63b 100644 --- a/modules/ganassurances/pages.py +++ b/modules/ganassurances/pages.py @@ -37,6 +37,7 @@ class LoginPage(BasePage): self.browser['LoginPortletFormPassword1'] = passwd.encode(self.browser.ENCODING) self.browser.submit(nologin=True) + class AccountsPage(BasePage): ACCOUNT_TYPES = {u'Solde des comptes bancaires - Groupama Banque': Account.TYPE_CHECKING, u'Epargne bancaire constituée - Groupama Banque': Account.TYPE_SAVINGS, @@ -89,6 +90,7 @@ class Transaction(FrenchTransaction): (re.compile('(?PInt .*)'), FrenchTransaction.TYPE_BANK), ] + class TransactionsPage(BasePage): def get_history(self): count = 0 diff --git a/modules/ganassurances/test.py b/modules/ganassurances/test.py index 327cbe03..cd6c65ef 100644 --- a/modules/ganassurances/test.py +++ b/modules/ganassurances/test.py @@ -20,6 +20,7 @@ from weboob.tools.test import BackendTest + class GanAssurancesTest(BackendTest): BACKEND = 'ganassurances' diff --git a/modules/gazelle/test.py b/modules/gazelle/test.py index 330d7f97..b12b9d0d 100644 --- a/modules/gazelle/test.py +++ b/modules/gazelle/test.py @@ -19,6 +19,7 @@ from weboob.tools.test import BackendTest + class GazelleTest(BackendTest): BACKEND = 'gazelle' diff --git a/modules/gdcvault/pages.py b/modules/gdcvault/pages.py index 44316f9c..9df3663e 100644 --- a/modules/gdcvault/pages.py +++ b/modules/gdcvault/pages.py @@ -37,6 +37,7 @@ from .video import GDCVaultVideo __all__ = ['VideoPage'] + class VideoPage(BasePage): def get_video(self, video=None): if video is None: @@ -127,7 +128,7 @@ class VideoPage(BasePage): day=int(day), hour=int(hour), minute=int(minute)) - + obj = self.parser.select(self.document.getroot(), 'span.ep_subtitle', 1) if obj is not None: span = self.parser.select(obj, 'span.ep_date', 1) @@ -142,7 +143,7 @@ class VideoPage(BasePage): day = m.group(5) month = m.group(6) year = m.group(7) - + start = datetime.datetime(year=int(year), month=int(month), day=int(day), diff --git a/modules/gdcvault/video.py b/modules/gdcvault/video.py index a65fd471..6aab4804 100644 --- a/modules/gdcvault/video.py +++ b/modules/gdcvault/video.py @@ -41,4 +41,3 @@ class GDCVaultVideo(BaseVideo): if m: return u'http://www.gdcvault.com/play/%s#slides' % _id return u'http://www.gdcvault.com/play/%s' % _id - diff --git a/modules/geolocip/test.py b/modules/geolocip/test.py index 5191dadb..d1f88c23 100644 --- a/modules/geolocip/test.py +++ b/modules/geolocip/test.py @@ -20,6 +20,7 @@ from weboob.tools.test import BackendTest + class GeolocIPTest(BackendTest): BACKEND = 'geolocip' diff --git a/modules/googletranslate/browser.py b/modules/googletranslate/browser.py index c9390d3b..dce314ce 100644 --- a/modules/googletranslate/browser.py +++ b/modules/googletranslate/browser.py @@ -35,7 +35,7 @@ class GoogleTranslateBrowser(BaseBrowser): PAGES = { 'https?://translate\.google\.com': TranslatePage } - + def __init__(self, *args, **kwargs): BaseBrowser.__init__(self, *args, **kwargs) diff --git a/modules/hds/browser.py b/modules/hds/browser.py index 5bdb4b10..68c9a11e 100644 --- a/modules/hds/browser.py +++ b/modules/hds/browser.py @@ -23,6 +23,8 @@ from weboob.tools.browser import BaseBrowser from .pages import ValidationPage, HomePage, HistoryPage, StoryPage, AuthorPage # Browser + + class HDSBrowser(BaseBrowser): ENCODING = 'ISO-8859-1' DOMAIN = 'histoires-de-sexe.net' diff --git a/modules/hsbc/browser.py b/modules/hsbc/browser.py index 035ace1b..62ec4725 100644 --- a/modules/hsbc/browser.py +++ b/modules/hsbc/browser.py @@ -33,6 +33,7 @@ __all__ = ['HSBC'] class NotLoggedPage(BasePage): pass + class HSBC(BaseBrowser): DOMAIN = 'client.hsbc.fr' PROTOCOL = 'https' diff --git a/modules/hsbc/pages/accounts.py b/modules/hsbc/pages/accounts.py index 76a3373c..84d9d823 100644 --- a/modules/hsbc/pages/accounts.py +++ b/modules/hsbc/pages/accounts.py @@ -73,6 +73,7 @@ class AccountsListPage(BasePage): return iter(accounts) + class Transaction(FrenchTransaction): PATTERNS = [(re.compile('^VIR(EMENT)? (?P.*)'), FrenchTransaction.TYPE_TRANSFER), (re.compile('^PRLV (?P.*)'), FrenchTransaction.TYPE_ORDER), @@ -85,6 +86,7 @@ class Transaction(FrenchTransaction): (re.compile('^REMISE (?P.*)'), FrenchTransaction.TYPE_DEPOSIT), ] + class HistoryPage(BasePage): def get_next_link(self): return None @@ -92,6 +94,7 @@ class HistoryPage(BasePage): def get_operations(self, num_page, date_guesser): raise NotImplementedError() + class CPTHistoryPage(HistoryPage): def get_operations(self, num_page, date_guesser): for script in self.document.getiterator('script'): @@ -105,6 +108,7 @@ class CPTHistoryPage(HistoryPage): op._coming = (re.match('\d+/\d+/\d+', m.group(2)) is None) yield op + class CardHistoryPage(HistoryPage): def get_next_link(self): ok = False diff --git a/modules/hsbc/test.py b/modules/hsbc/test.py index 6ebce485..ea59dd2f 100644 --- a/modules/hsbc/test.py +++ b/modules/hsbc/test.py @@ -20,6 +20,7 @@ from weboob.tools.test import BackendTest + class HSBCTest(BackendTest): BACKEND = 'hsbc' diff --git a/modules/imdb/browser.py b/modules/imdb/browser.py index ecf72987..82fef92c 100644 --- a/modules/imdb/browser.py +++ b/modules/imdb/browser.py @@ -218,6 +218,8 @@ dict_hex = {'á': u'á', 'â': u'â', 'ç': u'ç' } + + def latin2unicode(word): for key in dict_hex.keys(): word = word.replace(key,dict_hex[key]) diff --git a/modules/imdb/pages.py b/modules/imdb/pages.py index 64fbe2b2..0c317111 100644 --- a/modules/imdb/pages.py +++ b/modules/imdb/pages.py @@ -187,6 +187,7 @@ class PersonPage(BasePage): person.thumbnail_url = thumbnail_url return person + class FilmographyPage(BasePage): ''' Page of detailed filmography of a person, sorted by type of role This page is easier to parse than the main person page filmography diff --git a/modules/imdb/test.py b/modules/imdb/test.py index 73a134e3..80a46972 100644 --- a/modules/imdb/test.py +++ b/modules/imdb/test.py @@ -19,6 +19,7 @@ from weboob.tools.test import BackendTest + class ImdbTest(BackendTest): BACKEND = 'imdb' @@ -26,7 +27,7 @@ class ImdbTest(BackendTest): movies = list(self.backend.iter_movies('spiderman')) for movie in movies: assert movie.id - + def test_get_movie(self): movie = self.backend.get_movie('tt0079980') assert movie.id diff --git a/modules/ina/test.py b/modules/ina/test.py index b8156cae..abc25a0a 100644 --- a/modules/ina/test.py +++ b/modules/ina/test.py @@ -20,6 +20,7 @@ from weboob.tools.test import BackendTest + class INATest(BackendTest): BACKEND = 'ina' diff --git a/modules/ing/pages/accounts_list.py b/modules/ing/pages/accounts_list.py index e518fed5..a173a170 100644 --- a/modules/ing/pages/accounts_list.py +++ b/modules/ing/pages/accounts_list.py @@ -31,6 +31,7 @@ from weboob.tools.capabilities.bank.transactions import FrenchTransaction __all__ = ['AccountsList'] + class Transaction(FrenchTransaction): PATTERNS = [(re.compile(u'^retrait dab (?P
\d{2})/(?P\d{2})/(?P\d{4}) (?P.*)'), FrenchTransaction.TYPE_WITHDRAWAL), (re.compile(u'^carte (?P
\d{2})/(?P\d{2})/(?P\d{4}) (?P.*)'), Transaction.TYPE_CARD), diff --git a/modules/inrocks/backend.py b/modules/inrocks/backend.py index 50917596..18628693 100644 --- a/modules/inrocks/backend.py +++ b/modules/inrocks/backend.py @@ -23,6 +23,7 @@ from weboob.tools.capabilities.messages.GenericBackend import GenericNewspaperBa from .browser import NewspaperInrocksBrowser from .tools import rssid + class NewspaperInrocksBackend(GenericNewspaperBackend, ICapMessages): MAINTAINER = u'Julien Hebert' EMAIL = 'juke@free.fr' diff --git a/modules/inrocks/pages/article.py b/modules/inrocks/pages/article.py index 3a499556..5c9dab31 100644 --- a/modules/inrocks/pages/article.py +++ b/modules/inrocks/pages/article.py @@ -23,6 +23,7 @@ from weboob.tools.capabilities.messages.genericArticle import GenericNewsPage, t try_remove_from_selector_list, \ drop_comments, NoneMainDiv + class ArticlePage(GenericNewsPage): "ArticlePage object for inrocks" def on_loaded(self): diff --git a/modules/inrocks/pages/inrockstv.py b/modules/inrocks/pages/inrockstv.py index dceebe2d..75caa1fe 100644 --- a/modules/inrocks/pages/inrockstv.py +++ b/modules/inrocks/pages/inrockstv.py @@ -20,6 +20,7 @@ from weboob.tools.capabilities.messages.genericArticle import GenericNewsPage + class InrocksTvPage(GenericNewsPage): "ArticlePage object for inrocks" def on_loaded(self): diff --git a/modules/inrocks/tools.py b/modules/inrocks/tools.py index c39dcf26..309cccae 100644 --- a/modules/inrocks/tools.py +++ b/modules/inrocks/tools.py @@ -20,6 +20,7 @@ import re + def id2url(_id): "return an url from an id" regexp2 = re.compile("(\w+).([0-9]+).(.*$)") diff --git a/modules/ipinfodb/backend.py b/modules/ipinfodb/backend.py index 38a28aa1..efd319e7 100644 --- a/modules/ipinfodb/backend.py +++ b/modules/ipinfodb/backend.py @@ -50,12 +50,12 @@ class IpinfodbBackend(BaseBackend, ICapGeolocIp): if 'Invalid IP or domain name' in content: raise Exception('Bad parameter') else: - tab = {'City' : 'NA' ,\ - 'Country name' : 'NA' ,\ - 'Region' : 'NA' ,\ - 'Latitude' : 'NA' ,\ - 'Longitude' : 'NA' ,\ - 'hostname' : 'NA' ,\ + tab = {'City' : 'NA' , + 'Country name' : 'NA' , + 'Region' : 'NA' , + 'Latitude' : 'NA' , + 'Longitude' : 'NA' , + 'hostname' : 'NA' , 'zipcode' : 'NA'} line = '' for line in content.split('\n'): diff --git a/modules/ipinfodb/test.py b/modules/ipinfodb/test.py index e3d62d60..8d0d16d8 100644 --- a/modules/ipinfodb/test.py +++ b/modules/ipinfodb/test.py @@ -20,6 +20,7 @@ from weboob.tools.test import BackendTest + class IpinfodbTest(BackendTest): BACKEND = 'ipinfodb' diff --git a/modules/isohunt/test.py b/modules/isohunt/test.py index 420ca647..d054ba21 100644 --- a/modules/isohunt/test.py +++ b/modules/isohunt/test.py @@ -21,6 +21,7 @@ from weboob.tools.test import BackendTest from random import choice + class IsohuntTest(BackendTest): BACKEND = 'isohunt' diff --git a/modules/kickass/pages.py b/modules/kickass/pages.py index cdedf432..92a60ae3 100644 --- a/modules/kickass/pages.py +++ b/modules/kickass/pages.py @@ -125,7 +125,7 @@ class TorrentPage(BasePage): for span in self.document.getiterator('span'): # sometimes there are others span, this is not so sure but the size of the children list # is enough to know if this is the right span - if (span.attrib.get('class', '') == 'folder' \ + if (span.attrib.get('class', '') == 'folder' or span.attrib.get('class', '') == 'folderopen') \ and len(span.getchildren()) > 2: size = span.getchildren()[1].tail diff --git a/modules/kickass/test.py b/modules/kickass/test.py index 4ce76f63..87a3ed1e 100644 --- a/modules/kickass/test.py +++ b/modules/kickass/test.py @@ -23,6 +23,7 @@ from weboob.capabilities.base import NotLoaded import urllib from random import choice + class KickassTest(BackendTest): BACKEND = 'kickass' diff --git a/modules/lcl/browser.py b/modules/lcl/browser.py index fc13b464..651ce554 100644 --- a/modules/lcl/browser.py +++ b/modules/lcl/browser.py @@ -63,7 +63,7 @@ class LCLBrowser(BaseBrowser): assert self.agency.isdigit() if not self.is_on_page(LoginPage): - self.location('%s://%s/outil/UAUT/Authentication/authenticate' \ + self.location('%s://%s/outil/UAUT/Authentication/authenticate' % (self.PROTOCOL, self.DOMAIN), no_login=True) @@ -71,7 +71,7 @@ class LCLBrowser(BaseBrowser): not self.is_logged() or \ (self.is_on_page(LoginPage) and self.page.is_error()) : raise BrowserIncorrectPassword("invalid login/password.\nIf you did not change anything, be sure to check for password renewal request\non the original web site.\nAutomatic renewal will be implemented later.") - self.location('%s://%s/outil/UWSP/Synthese' \ + self.location('%s://%s/outil/UWSP/Synthese' % (self.PROTOCOL, self.DOMAIN), no_login=True) diff --git a/modules/lcl/pages.py b/modules/lcl/pages.py index 7625c0a8..d8663a6a 100644 --- a/modules/lcl/pages.py +++ b/modules/lcl/pages.py @@ -136,6 +136,7 @@ class ContractsPage(BasePage): self.browser.select_form(predicate=lambda form: form.attrs.get('id', '') == 'mainForm') self.browser.submit() + class AccountsPage(BasePage): def on_loaded(self): warn = self.document.xpath('//div[@id="attTxt"]') @@ -222,6 +223,7 @@ class Transaction(FrenchTransaction): (re.compile('^(?PREM CHQ) (?P.*)'), FrenchTransaction.TYPE_DEPOSIT), ] + class AccountHistoryPage(BasePage): def get_table(self): tables=self.document.findall("//table[@class='tagTab pyjama']") @@ -303,6 +305,7 @@ class AccountHistoryPage(BasePage): operations.append(operation) return operations + class CBHistoryPage(AccountHistoryPage): def get_table(self): # there is only one table on the page @@ -320,6 +323,7 @@ class CBHistoryPage(AccountHistoryPage): tr.type = tr.TYPE_CARD yield tr + class CBListPage(CBHistoryPage): def get_cards(self): cards = [] diff --git a/modules/lcl/test.py b/modules/lcl/test.py index 30dcc66b..1c354019 100644 --- a/modules/lcl/test.py +++ b/modules/lcl/test.py @@ -20,6 +20,7 @@ from weboob.tools.test import BackendTest + class LCLtTest(BackendTest): BACKEND = 'lcl' diff --git a/modules/lefigaro/backend.py b/modules/lefigaro/backend.py index 68beba50..9fd58375 100644 --- a/modules/lefigaro/backend.py +++ b/modules/lefigaro/backend.py @@ -23,6 +23,7 @@ from weboob.tools.capabilities.messages.GenericBackend import GenericNewspaperBa from .browser import NewspaperFigaroBrowser from .tools import rssid + class NewspaperFigaroBackend(GenericNewspaperBackend, ICapMessages): MAINTAINER = u'Julien Hebert' EMAIL = 'juke@free.fr' diff --git a/modules/lefigaro/browser.py b/modules/lefigaro/browser.py index e64c15e1..a453a345 100644 --- a/modules/lefigaro/browser.py +++ b/modules/lefigaro/browser.py @@ -22,6 +22,7 @@ from .pages.article import ArticlePage, ActuPage from .pages.flashactu import FlashActuPage from weboob.tools.browser import BaseBrowser, BasePage + class IndexPage(BasePage): pass diff --git a/modules/lefigaro/tools.py b/modules/lefigaro/tools.py index 15d6b9ec..6f45c08c 100644 --- a/modules/lefigaro/tools.py +++ b/modules/lefigaro/tools.py @@ -20,6 +20,7 @@ import re + def id2url(_id): "return an url from an id" regexp2 = re.compile("(\w+).([0-9]+).(.*$)") diff --git a/modules/mangago/__init__.py b/modules/mangago/__init__.py index c3dff900..171bfe18 100644 --- a/modules/mangago/__init__.py +++ b/modules/mangago/__init__.py @@ -21,4 +21,3 @@ from .backend import MangagoBackend __all__ = ['MangagoBackend'] - diff --git a/modules/mangago/backend.py b/modules/mangago/backend.py index fb11ad5d..aa191b51 100644 --- a/modules/mangago/backend.py +++ b/modules/mangago/backend.py @@ -22,6 +22,7 @@ from weboob.tools.capabilities.gallery.genericcomicreader import GenericComicRea __all__ = ['MangagoBackend'] + class MangagoBackend(GenericComicReaderBackend): NAME = 'mangago' DESCRIPTION = 'Mangago manga reading site' @@ -33,4 +34,3 @@ class MangagoBackend(GenericComicReaderBackend): URL_REGEXP = r'.+mangago.com/r/l_manga/(%s).+' % ID_REGEXP ID_TO_URL = 'http://www.mangago.com/r/l_manga/%s' PAGES = { URL_REGEXP: DisplayPage } - diff --git a/modules/mangago/test.py b/modules/mangago/test.py index 0751f643..0e6d8199 100644 --- a/modules/mangago/test.py +++ b/modules/mangago/test.py @@ -19,8 +19,9 @@ from weboob.tools.capabilities.gallery.genericcomicreader import GenericComicReaderTest + class MangagoTest(GenericComicReaderTest): BACKEND = 'mangago' + def test_download(self): return self._test_download('manga/love_scar/mh/manga/love_scar/c001/') - diff --git a/modules/marmiton/browser.py b/modules/marmiton/browser.py index f68ba496..9c6a50b5 100644 --- a/modules/marmiton/browser.py +++ b/modules/marmiton/browser.py @@ -25,6 +25,7 @@ from .pages import RecipePage, ResultsPage __all__ = ['MarmitonBrowser'] + class MarmitonBrowser(BaseBrowser): DOMAIN = 'www.marmiton.org' PROTOCOL = 'http' diff --git a/modules/marmiton/pages.py b/modules/marmiton/pages.py index e6ed295e..69e31a56 100644 --- a/modules/marmiton/pages.py +++ b/modules/marmiton/pages.py @@ -53,7 +53,7 @@ class ResultsPage(BasePage): recipe.cooking_time = NotLoaded recipe.preparation_time = NotLoaded yield recipe - + class RecipePage(BasePage): """ Page which contains a recipe diff --git a/modules/marmiton/test.py b/modules/marmiton/test.py index 9e9885d5..d8f30ee5 100644 --- a/modules/marmiton/test.py +++ b/modules/marmiton/test.py @@ -19,6 +19,7 @@ from weboob.tools.test import BackendTest + class MarmitonTest(BackendTest): BACKEND = 'marmiton' @@ -30,4 +31,3 @@ class MarmitonTest(BackendTest): assert full_recipe.ingredients assert full_recipe.title assert full_recipe.preparation_time - diff --git a/modules/mediawiki/test.py b/modules/mediawiki/test.py index 2ee72fe1..0aced621 100644 --- a/modules/mediawiki/test.py +++ b/modules/mediawiki/test.py @@ -21,6 +21,7 @@ from weboob.tools.test import BackendTest from datetime import datetime + class MediawikiTest(BackendTest): BACKEND = 'mediawiki' diff --git a/modules/meteofrance/test.py b/modules/meteofrance/test.py index d748a869..1743ab10 100644 --- a/modules/meteofrance/test.py +++ b/modules/meteofrance/test.py @@ -20,6 +20,7 @@ from weboob.tools.test import BackendTest + class MeteoFranceTest(BackendTest): BACKEND = 'meteofrance' diff --git a/modules/nolifetv/pages/video.py b/modules/nolifetv/pages/video.py index 5c86dcad..2d2cec21 100644 --- a/modules/nolifetv/pages/video.py +++ b/modules/nolifetv/pages/video.py @@ -104,6 +104,7 @@ class VideoPage(BasePage): return video SALT = 'a53be1853770f0ebe0311d6993c7bcbe' + def genkey(self): # This website is really useful to get info: http://www.showmycode.com/ timestamp = str(int(time.time())) diff --git a/modules/nova/test.py b/modules/nova/test.py index 69c93982..9b806797 100644 --- a/modules/nova/test.py +++ b/modules/nova/test.py @@ -21,6 +21,7 @@ from weboob.tools.test import BackendTest from weboob.capabilities.radio import Radio + class NovaTest(BackendTest): BACKEND = 'nova' diff --git a/modules/okc/backend.py b/modules/okc/backend.py index 52745ba9..2e7fd3cf 100644 --- a/modules/okc/backend.py +++ b/modules/okc/backend.py @@ -38,6 +38,7 @@ from .browser import OkCBrowser __all__ = ['OkCBackend'] + def parse_dt(s): now = datetime.datetime.now() if s is None: @@ -62,6 +63,7 @@ def parse_dt(s): d = _parse_dt(s) return local2utc(d) + class OkCBackend(BaseBackend, ICapMessages, ICapContact, ICapMessagesPost): NAME = 'okc' MAINTAINER = u'Roger Philibert' diff --git a/modules/okc/browser.py b/modules/okc/browser.py index 57e6acce..57b13247 100644 --- a/modules/okc/browser.py +++ b/modules/okc/browser.py @@ -30,6 +30,7 @@ __all__ = ['OkCBrowser'] class OkCException(Exception): pass + class OkCBrowser(BaseBrowser): DOMAIN = 'm.okcupid.com' PROTOCOL = 'https' diff --git a/modules/okc/pages.py b/modules/okc/pages.py index 0b8dc034..15104e48 100644 --- a/modules/okc/pages.py +++ b/modules/okc/pages.py @@ -23,6 +23,7 @@ from weboob.tools.browser import BasePage from weboob.tools.ordereddict import OrderedDict from weboob.capabilities.contact import ProfileNode + class LoginPage(BasePage): def login(self, username, password): self.browser.select_form(name='loginf') @@ -30,6 +31,7 @@ class LoginPage(BasePage): self.browser['password'] = password.encode(self.browser.ENCODING) self.browser.submit(id='login_btn', nologin=True) + class ThreadPage(BasePage): def get_threads(self): li_elems = self.parser.select(self.document.getroot(), "//div[@id='page_content']//li", method= 'xpath') @@ -45,6 +47,7 @@ class ThreadPage(BasePage): return threads + class MessagesPage(BasePage): def get_thread_mails(self, count): ul_item = self.parser.select(self.document.getroot(), "//ul[@id='rows']", method='xpath')[0] @@ -158,11 +161,13 @@ class ProfilePage(BasePage): return profile + class PhotosPage(BasePage): def get_photos(self): imgs = self.parser.select(self.document.getroot(), "//div[@class='pic clearfix']//img", method='xpath') return [unicode(img.get('src')) for img in imgs] + class PostMessagePage(BasePage): def post_mail(self, id, content): self.browser.select_form(name='f2') diff --git a/modules/opacwebaloes/browser.py b/modules/opacwebaloes/browser.py index 3daea7c9..bb33d44a 100644 --- a/modules/opacwebaloes/browser.py +++ b/modules/opacwebaloes/browser.py @@ -55,7 +55,7 @@ class AloesBrowser(BaseBrowser): assert isinstance(self.username, basestring) assert isinstance(self.password, basestring) if not self.is_on_page(HomePage): - self.location('%s://%s/index.aspx' \ + self.location('%s://%s/index.aspx' % (self.PROTOCOL, self.BASEURL), no_login=True) if not self.page.login(self.username, self.password) or \ @@ -65,13 +65,13 @@ class AloesBrowser(BaseBrowser): def get_rented_books_list(self): if not self.is_on_page(RentedPage): - self.location('%s://%s/index.aspx?IdPage=45' \ + self.location('%s://%s/index.aspx?IdPage=45' % (self.PROTOCOL, self.BASEURL) ) return self.page.get_list() def get_booked_books_list(self): if not self.is_on_page(BookedPage): - self.location('%s://%s/index.aspx?IdPage=44' \ + self.location('%s://%s/index.aspx?IdPage=44' % (self.PROTOCOL, self.BASEURL)) return self.page.get_list() diff --git a/modules/opacwebaloes/pages.py b/modules/opacwebaloes/pages.py index 640d1b9d..c801782d 100644 --- a/modules/opacwebaloes/pages.py +++ b/modules/opacwebaloes/pages.py @@ -22,12 +22,15 @@ from weboob.capabilities.library import Book from weboob.tools.browser import BasePage, BrowserUnavailable from weboob.tools.mech import ClientForm + class SkipPage(BasePage): pass + class HomePage(BasePage): pass + def txt2date(s): return date(*reversed([int(x) for x in s.split(' ')[-1].split('/')])) @@ -51,6 +54,7 @@ class RentedPage(BasePage): book.date = txt2date(tr[start+5].text) yield book + class HistoryPage(BasePage): pass @@ -75,6 +79,7 @@ class BookedPage(BasePage): book.late = False yield book + class LoginPage(BasePage): def login(self, login, passwd): self.browser.select_form(predicate=lambda x: x.attrs.get('id','')=='aspnetForm') diff --git a/modules/opacwebaloes/test.py b/modules/opacwebaloes/test.py index d105c76d..517fdf2f 100644 --- a/modules/opacwebaloes/test.py +++ b/modules/opacwebaloes/test.py @@ -20,6 +20,7 @@ from weboob.tools.test import BackendTest + class AloestTest(BackendTest): BACKEND = 'aloes' diff --git a/modules/opensubtitles/browser.py b/modules/opensubtitles/browser.py index fefed5af..19b523e5 100644 --- a/modules/opensubtitles/browser.py +++ b/modules/opensubtitles/browser.py @@ -26,6 +26,7 @@ from .pages import SubtitlesPage, SearchPage, SubtitlePage __all__ = ['OpensubtitlesBrowser'] + class OpensubtitlesBrowser(BaseBrowser): DOMAIN = 'www.opensubtitles.org' PROTOCOL = 'http' diff --git a/modules/opensubtitles/test.py b/modules/opensubtitles/test.py index be484df2..66e7e568 100644 --- a/modules/opensubtitles/test.py +++ b/modules/opensubtitles/test.py @@ -21,6 +21,7 @@ from weboob.tools.test import BackendTest from random import choice + class OpensubtitlesTest(BackendTest): BACKEND = 'opensubtitles' diff --git a/modules/orange/browser.py b/modules/orange/browser.py index 36816b6e..a9ea84bd 100644 --- a/modules/orange/browser.py +++ b/modules/orange/browser.py @@ -37,6 +37,7 @@ class OrangeBrowser(BaseBrowser): 'http://smsmms1.orange.fr/./Sms/sms_write.php.*' : ComposePage, 'http://smsmms1.orange.fr/./Sms/sms_write.php?command=send' : ConfirmPage, } + def get_nb_remaining_free_sms(self): self.location("http://smsmms1.orange.fr/M/Sms/sms_write.php") return self.page.get_nb_remaining_free_sms() diff --git a/modules/orange/pages/login.py b/modules/orange/pages/login.py index 8fa71730..72afcf42 100644 --- a/modules/orange/pages/login.py +++ b/modules/orange/pages/login.py @@ -22,6 +22,7 @@ import urllib __all__ = ['LoginPage'] + class LoginPage(BasePage): def on_loaded(self): pass diff --git a/modules/pap/browser.py b/modules/pap/browser.py index 57c45a35..c2ba06cc 100644 --- a/modules/pap/browser.py +++ b/modules/pap/browser.py @@ -47,6 +47,7 @@ class PapBrowser(BaseBrowser): TYPES = {Query.TYPE_RENT: 'location', Query.TYPE_SALE: 'vente', } + def search_housings(self, type, cities, nb_rooms, area_min, area_max, cost_min, cost_max): data = {'geo_objets_ids': ','.join(cities), 'surface[min]': area_min or '', diff --git a/modules/pap/pages.py b/modules/pap/pages.py index 7eed3659..742260fa 100644 --- a/modules/pap/pages.py +++ b/modules/pap/pages.py @@ -88,6 +88,7 @@ class SearchResultsPage(BasePage): yield housing + class HousingPage(BasePage): def get_housing(self): div = self.parser.select(self.document.getroot(), 'div#annonce_detail', 1) diff --git a/modules/parolesmania/test.py b/modules/parolesmania/test.py index 19a70d6f..d397eae2 100644 --- a/modules/parolesmania/test.py +++ b/modules/parolesmania/test.py @@ -20,6 +20,7 @@ from weboob.tools.test import BackendTest from weboob.capabilities.base import NotLoaded + class ParolesmaniaTest(BackendTest): BACKEND = 'parolesmania' diff --git a/modules/parolesmusique/backend.py b/modules/parolesmusique/backend.py index 8f328c17..be427e65 100644 --- a/modules/parolesmusique/backend.py +++ b/modules/parolesmusique/backend.py @@ -48,7 +48,7 @@ class ParolesmusiqueBackend(BaseBackend, ICapLyrics): sl = self.get_lyrics(songlyrics.id) songlyrics.content = sl.content return songlyrics - + OBJECTS = { SongLyrics:fill_songlyrics } diff --git a/modules/parolesmusique/pages.py b/modules/parolesmusique/pages.py index 9f3354ac..7aad55e7 100644 --- a/modules/parolesmusique/pages.py +++ b/modules/parolesmusique/pages.py @@ -38,6 +38,7 @@ class HomePage(BasePage): for lyr in self.browser.page.iter_lyrics(): yield lyr + class ArtistResultsPage(BasePage): def iter_lyrics(self): for link in self.parser.select(self.document.getroot(),'div.cont_cat table a.std'): diff --git a/modules/parolesmusique/test.py b/modules/parolesmusique/test.py index a9b2a9f3..1008b769 100644 --- a/modules/parolesmusique/test.py +++ b/modules/parolesmusique/test.py @@ -20,6 +20,7 @@ from weboob.tools.test import BackendTest from weboob.capabilities.base import NotLoaded + class ParolesmusiqueTest(BackendTest): BACKEND = 'parolesmusique' diff --git a/modules/pastealacon/browser.py b/modules/pastealacon/browser.py index c5291a1b..b6acfde9 100644 --- a/modules/pastealacon/browser.py +++ b/modules/pastealacon/browser.py @@ -30,6 +30,7 @@ from .paste import PastealaconPaste __all__ = ['PastealaconBrowser'] + class PastealaconBrowser(BaseBrowser): DOMAIN = 'pastealacon.com' ENCODING = 'ISO-8859-1' diff --git a/modules/pastealacon/pages.py b/modules/pastealacon/pages.py index 2d54a074..7a395f84 100644 --- a/modules/pastealacon/pages.py +++ b/modules/pastealacon/pages.py @@ -26,6 +26,7 @@ from weboob.capabilities.paste import PasteNotFound __all__ = ['PastePage', 'PostPage', 'CaptchaPage'] + class PastePage(BasePage): def fill_paste(self, paste): root = self.document.getroot() @@ -46,6 +47,7 @@ class PastePage(BasePage): """ return self.group_dict['id'] + class PostPage(BasePage): def post(self, paste, expiration=None): self.browser.select_form(name='editor') @@ -55,5 +57,6 @@ class PostPage(BasePage): self.browser['expiry'] = [expiration] self.browser.submit() + class CaptchaPage(BasePage): pass diff --git a/modules/pastealacon/test.py b/modules/pastealacon/test.py index 0624b299..7e87faed 100644 --- a/modules/pastealacon/test.py +++ b/modules/pastealacon/test.py @@ -24,6 +24,7 @@ from weboob.tools.browser import BrowserUnavailable from weboob.capabilities.paste import PasteNotFound + class PastealaconTest(BackendTest): BACKEND = 'pastealacon' diff --git a/modules/pastebin/test.py b/modules/pastebin/test.py index 040dc77d..d6d96048 100644 --- a/modules/pastebin/test.py +++ b/modules/pastebin/test.py @@ -21,6 +21,7 @@ from weboob.tools.test import BackendTest from weboob.capabilities.base import NotLoaded from weboob.capabilities.paste import PasteNotFound + class PastebinTest(BackendTest): BACKEND = 'pastebin' diff --git a/modules/phpbb/pages/forum.py b/modules/phpbb/pages/forum.py index c9bb2fa0..2d8b03c1 100644 --- a/modules/phpbb/pages/forum.py +++ b/modules/phpbb/pages/forum.py @@ -40,6 +40,7 @@ class Link(object): self.title = u'' self.date = None + class ForumPage(PhpBBPage): def iter_links(self): for li in self.parser.select(self.document.getroot(), 'ul.forums li.row'): @@ -72,6 +73,7 @@ class ForumPage(PhpBBPage): yield value, option.text.strip(u'» \xa0\n\r') + class Post(object): def __init__(self, forum_id, topic_id, id): self.id = int(id) @@ -84,6 +86,7 @@ class Post(object): self.signature = u'' self.parent = 0 + class TopicPage(PhpBBPage): def on_loaded(self): div = self.document.getroot().cssselect('div.pagination')[0] diff --git a/modules/phpbb/pages/index.py b/modules/phpbb/pages/index.py index 46ad3b7a..b41edbef 100644 --- a/modules/phpbb/pages/index.py +++ b/modules/phpbb/pages/index.py @@ -20,6 +20,7 @@ from weboob.tools.browser import BasePage + class PhpBBPage(BasePage): def is_logged(self): return len(self.document.getroot().cssselect('li.icon-register')) == 0 @@ -35,5 +36,6 @@ class PhpBBPage(BasePage): errors.append(div.text.strip()) return ', '.join(errors) + class LoginPage(PhpBBPage): pass diff --git a/modules/phpbb/tools.py b/modules/phpbb/tools.py index 292bf18b..f384dbf4 100644 --- a/modules/phpbb/tools.py +++ b/modules/phpbb/tools.py @@ -42,6 +42,7 @@ def url2id(url, nopost=False): return None + def id2url(id): v = id.split('.') if len(v) == 1: @@ -54,15 +55,18 @@ def id2url(id): int(v[2]), int(v[2])) + def id2topic(id): try: return int(id.split('.')[1]) except IndexError: return None + def rssid(id): return id + def parse_date(s): s = s.replace(u'Fév', 'Feb') \ .replace(u'Avr', 'Apr') \ diff --git a/modules/piratebay/backend.py b/modules/piratebay/backend.py index 40941a11..b3347a90 100644 --- a/modules/piratebay/backend.py +++ b/modules/piratebay/backend.py @@ -26,6 +26,7 @@ from .browser import PiratebayBrowser __all__ = ['PiratebayBackend'] + class PiratebayBackend(BaseBackend, ICapTorrent): NAME = 'piratebay' MAINTAINER = u'Julien Veyssier' diff --git a/modules/piratebay/test.py b/modules/piratebay/test.py index ca01336c..65b7fa83 100644 --- a/modules/piratebay/test.py +++ b/modules/piratebay/test.py @@ -22,6 +22,7 @@ from weboob.capabilities.torrent import MagnetOnly from random import choice + class PiratebayTest(BackendTest): BACKEND = 'piratebay' diff --git a/modules/prixcarburants/pages.py b/modules/prixcarburants/pages.py index 55775ff6..336c3dff 100644 --- a/modules/prixcarburants/pages.py +++ b/modules/prixcarburants/pages.py @@ -44,6 +44,7 @@ class IndexPage(BasePage): yield product + class ComparisonResultsPage(BasePage): def get_product_name(self): try: @@ -75,6 +76,7 @@ class ComparisonResultsPage(BasePage): price.set_empty_fields(NotAvailable) yield price + class ShopInfoPage(BasePage): def get_info(self): return self.parser.tostring(self.parser.select(self.document.getroot(), 'div.colg', 1)) diff --git a/modules/redmine/pages/index.py b/modules/redmine/pages/index.py index 532c0c0e..a384b709 100644 --- a/modules/redmine/pages/index.py +++ b/modules/redmine/pages/index.py @@ -20,6 +20,7 @@ from weboob.tools.browser import BasePage + class LoginPage(BasePage): def login(self, username, password): self.browser.select_form(nr=1) @@ -27,12 +28,15 @@ class LoginPage(BasePage): self.browser['password'] = password self.browser.submit() + class IndexPage(BasePage): pass + class MyPage(BasePage): pass + class ProjectsPage(BasePage): def iter_projects(self): for ul in self.parser.select(self.document.getroot(), 'ul.projects'): diff --git a/modules/redmine/pages/issues.py b/modules/redmine/pages/issues.py index dc737979..b996d017 100644 --- a/modules/redmine/pages/issues.py +++ b/modules/redmine/pages/issues.py @@ -26,6 +26,7 @@ from weboob.tools.browser import BasePage, BrokenPageError from weboob.tools.misc import to_unicode from weboob.tools.mech import ClientForm + class BaseIssuePage(BasePage): def parse_datetime(self, text): m = re.match('(\d+)/(\d+)/(\d+) (\d+):(\d+) (\w+)', text) @@ -80,6 +81,7 @@ class BaseIssuePage(BasePage): token = tokens[0].attrib['value'] return token + class IssuesPage(BaseIssuePage): PROJECT_FIELDS = {'members': 'values_assigned_to_id', 'categories': 'values_category_id', @@ -129,6 +131,7 @@ class IssuesPage(BaseIssuePage): if len(issue) != 0: yield issue + class NewIssuePage(BaseIssuePage): PROJECT_FIELDS = {'members': 'issue_assigned_to_id', 'categories': 'issue_category_id', @@ -182,6 +185,7 @@ class NewIssuePage(BaseIssuePage): getattr(self, 'set_%s' % key)(value) self.browser.submit() + class IssuePage(NewIssuePage): def _parse_selection(self, id): try: @@ -291,6 +295,7 @@ class IssuePage(NewIssuePage): return params + class IssueLogTimePage(BasePage): def logtime(self, hours, message): self.browser.select_form(predicate=lambda form: form.attrs.get('action', '').endswith('/edit')) @@ -299,5 +304,6 @@ class IssueLogTimePage(BasePage): self.browser['time_entry[activity_id]'] = ['8'] self.browser.submit() + class IssueTimeEntriesPage(BasePage): pass diff --git a/modules/seeklyrics/test.py b/modules/seeklyrics/test.py index 64a3a4ab..d0d4056e 100644 --- a/modules/seeklyrics/test.py +++ b/modules/seeklyrics/test.py @@ -20,6 +20,7 @@ from weboob.tools.test import BackendTest from weboob.capabilities.base import NotLoaded + class SeeklyricsTest(BackendTest): BACKEND = 'seeklyrics' diff --git a/modules/seloger/pages.py b/modules/seloger/pages.py index e005a387..d6c805f7 100644 --- a/modules/seloger/pages.py +++ b/modules/seloger/pages.py @@ -59,6 +59,7 @@ class SearchResultsPage(BasePage): yield housing + class HousingPage(BasePage): def get_housing(self, housing=None): if housing is None: diff --git a/modules/sfr/test.py b/modules/sfr/test.py index 7c525d8f..c17b980a 100644 --- a/modules/sfr/test.py +++ b/modules/sfr/test.py @@ -20,6 +20,7 @@ from weboob.tools.test import BackendTest + class SFRTest(BackendTest): BACKEND = 'sfr' diff --git a/modules/societegenerale/pages/accounts_list.py b/modules/societegenerale/pages/accounts_list.py index 52cfaedf..1f7bc310 100644 --- a/modules/societegenerale/pages/accounts_list.py +++ b/modules/societegenerale/pages/accounts_list.py @@ -87,6 +87,7 @@ class AccountsList(BasePage): accounts.append(account) return iter(accounts) + class CardsList(BasePage): def iter_cards(self): for tr in self.document.getiterator('tr'): @@ -96,6 +97,7 @@ class CardsList(BasePage): yield tr.xpath('.//a')[0].attrib['href'] + class Transaction(FrenchTransaction): PATTERNS = [(re.compile(r'^CARTE \w+ RETRAIT DAB.* (?P
\d{2})/(?P\d{2})( (?P\d+)H(?P\d+))? (?P.*)'), FrenchTransaction.TYPE_WITHDRAWAL), @@ -123,6 +125,7 @@ class Transaction(FrenchTransaction): FrenchTransaction.TYPE_WITHDRAWAL), ] + class AccountHistory(BasePage): def get_part_url(self): for script in self.document.getiterator('script'): diff --git a/modules/societegenerale/test.py b/modules/societegenerale/test.py index 45102f19..63973a39 100644 --- a/modules/societegenerale/test.py +++ b/modules/societegenerale/test.py @@ -20,6 +20,7 @@ from weboob.tools.test import BackendTest + class SocieteGeneraleTest(BackendTest): BACKEND = 'societegenerale' diff --git a/modules/transilien/backend.py b/modules/transilien/backend.py index 61310077..7ecf6661 100644 --- a/modules/transilien/backend.py +++ b/modules/transilien/backend.py @@ -26,6 +26,7 @@ from weboob.tools.backend import BaseBackend from .browser import Transilien from .stations import STATIONS + class TransilienBackend(BaseBackend, ICapTravel): NAME = 'transilien' MAINTAINER = u'Julien Hébert' diff --git a/modules/transilien/browser.py b/modules/transilien/browser.py index 8c82859c..a4ad867d 100644 --- a/modules/transilien/browser.py +++ b/modules/transilien/browser.py @@ -23,10 +23,12 @@ from weboob.tools.browser import BaseBrowser, BasePage, BrowserUnavailable from .pages.departures import DeparturesPage from .pages.roadmap import RoadmapSearchPage, RoadmapConfirmPage, RoadmapPage + class UnavailablePage(BasePage): def on_loaded(self): raise BrowserUnavailable('Website is currently unavailable') + class Transilien(BaseBrowser): DOMAIN = 'www.transilien.com' PROTOCOL = 'https' diff --git a/modules/transilien/pages/departures.py b/modules/transilien/pages/departures.py index a2c0cb31..5a24c18b 100644 --- a/modules/transilien/pages/departures.py +++ b/modules/transilien/pages/departures.py @@ -30,6 +30,7 @@ __all__ = ['StationNotFound', 'DeparturesPage'] class StationNotFound(UserError): pass + class DeparturesPage(BasePage): def iter_routes(self): try: diff --git a/modules/transilien/pages/roadmap.py b/modules/transilien/pages/roadmap.py index f51c7742..43088936 100644 --- a/modules/transilien/pages/roadmap.py +++ b/modules/transilien/pages/roadmap.py @@ -54,6 +54,7 @@ class RoadmapSearchPage(BasePage): raise RoadmapError('Unable to establish a roadmap with %s time at "%s"' % ('departure' if departure_time else 'arrival', time)) self.browser.submit() + class RoadmapPage(BasePage): def get_steps(self): errors = [] @@ -95,6 +96,7 @@ class RoadmapPage(BasePage): return datetime.timedelta(hours=int(m.group(1)), minutes=int(m.group(2))) + class RoadmapConfirmPage(RoadmapPage): def select(self, name, num): try: diff --git a/modules/transilien/test.py b/modules/transilien/test.py index 0eb39941..6d90efba 100644 --- a/modules/transilien/test.py +++ b/modules/transilien/test.py @@ -22,6 +22,7 @@ import datetime from weboob.capabilities.travel import RoadmapFilters from weboob.tools.test import BackendTest + class TransilienTest(BackendTest): BACKEND = 'transilien' diff --git a/modules/trictractv/test.py b/modules/trictractv/test.py index 1fa835fb..621287f5 100644 --- a/modules/trictractv/test.py +++ b/modules/trictractv/test.py @@ -20,6 +20,7 @@ from weboob.tools.test import BackendTest + class TricTracTVTest(BackendTest): BACKEND = 'trictractv' diff --git a/modules/tvsubtitles/browser.py b/modules/tvsubtitles/browser.py index 87033938..079e9e44 100644 --- a/modules/tvsubtitles/browser.py +++ b/modules/tvsubtitles/browser.py @@ -29,6 +29,7 @@ LANGUAGE_LIST = ['en','es','fr','de','br','ru','ua','it','gr', 'ar','hu','pl','tr','nl','pt','sv','da','fi', 'ko','cn','jp','bg','cz','ro'] + class TvsubtitlesBrowser(BaseBrowser): DOMAIN = 'www.tvsubtitles.net' PROTOCOL = 'http' diff --git a/modules/tvsubtitles/test.py b/modules/tvsubtitles/test.py index e53dfd09..2432ee00 100644 --- a/modules/tvsubtitles/test.py +++ b/modules/tvsubtitles/test.py @@ -21,6 +21,7 @@ from weboob.tools.test import BackendTest from random import choice + class TvsubtitlesTest(BackendTest): BACKEND = 'tvsubtitles' diff --git a/modules/vimeo/pages.py b/modules/vimeo/pages.py index 06becb89..44981b09 100644 --- a/modules/vimeo/pages.py +++ b/modules/vimeo/pages.py @@ -40,6 +40,7 @@ from .video import VimeoVideo __all__ = ['VideoPage'] + class VideoPage(BasePage): def get_video(self, video=None): if video is None: diff --git a/modules/vimeo/video.py b/modules/vimeo/video.py index a9e58200..f4e26b7d 100644 --- a/modules/vimeo/video.py +++ b/modules/vimeo/video.py @@ -32,4 +32,3 @@ class VimeoVideo(BaseVideo): @classmethod def id2url(cls, _id): return u'http://vimeo.com/%s' % _id - diff --git a/modules/weather/backend.py b/modules/weather/backend.py index 8800e881..25d5a94c 100644 --- a/modules/weather/backend.py +++ b/modules/weather/backend.py @@ -25,6 +25,7 @@ from .browser import WeatherBrowser __all__ = ['WeatherBackend'] + class WeatherBackend(BaseBackend, ICapWeather): NAME = 'weather' MAINTAINER = u'Arno Renevier' diff --git a/modules/weather/browser.py b/modules/weather/browser.py index 62941370..d70b465d 100644 --- a/modules/weather/browser.py +++ b/modules/weather/browser.py @@ -26,6 +26,7 @@ from .pages import ForecastPage, WeatherPage, CityPage __all__ = ['WeatherBrowser'] + class WeatherBrowser(BaseBrowser): DOMAIN = 'www.weather.com' PROTOCOL = 'http' diff --git a/modules/weather/pages.py b/modules/weather/pages.py index 0f15d0b0..58971922 100644 --- a/modules/weather/pages.py +++ b/modules/weather/pages.py @@ -36,6 +36,7 @@ class CityPage(BasePage): city_id = item.find('a').attrib.get("href", "").split("+")[-1] yield City(city_id, city_name) + class WeatherPage(BasePage): def get_city(self): parts = self.url.split('/')[-1].split('+') @@ -47,6 +48,7 @@ class WeatherPage(BasePage): temp = float(self.document.find('//p[@class="wx-temp"]').text_content().strip().split(u'°')[0]) return Current(date, temp, text, u'F') + class ForecastPage(BasePage): def iter_forecast(self): divs = self.document.findall('//div[@class="wx-daypart"]') diff --git a/modules/weather/test.py b/modules/weather/test.py index 49b826ba..56e8efd0 100644 --- a/modules/weather/test.py +++ b/modules/weather/test.py @@ -20,6 +20,7 @@ from weboob.tools.test import BackendTest + class WeatherTest(BackendTest): BACKEND = 'weather' diff --git a/modules/wordreference/browser.py b/modules/wordreference/browser.py index 41c5a7cd..7cefe5ff 100644 --- a/modules/wordreference/browser.py +++ b/modules/wordreference/browser.py @@ -35,7 +35,7 @@ class WordReferenceBrowser(BaseBrowser): PAGES = { 'https?://www\.wordreference\.com/.*/.*': TranslatePage } - + def __init__(self, *args, **kwargs): BaseBrowser.__init__(self, *args, **kwargs) diff --git a/modules/wordreference/pages.py b/modules/wordreference/pages.py index f4735a23..b09d054e 100644 --- a/modules/wordreference/pages.py +++ b/modules/wordreference/pages.py @@ -53,4 +53,3 @@ class TranslatePage(BasePage): return u''+td.text_content().split(';')[0].strip() if td.attrib.get('class','') == 'roman1': prev_was_roman1 = True - diff --git a/modules/yahoo/test.py b/modules/yahoo/test.py index 281bde33..42181710 100644 --- a/modules/yahoo/test.py +++ b/modules/yahoo/test.py @@ -20,6 +20,7 @@ from weboob.tools.test import BackendTest + class YahooTest(BackendTest): BACKEND = 'yahoo' diff --git a/modules/youtube/pages.py b/modules/youtube/pages.py index 782c464b..2ff6c5de 100644 --- a/modules/youtube/pages.py +++ b/modules/youtube/pages.py @@ -25,7 +25,7 @@ from weboob.tools.browser import BasePage, BrokenPageError, BrowserIncorrectPass from weboob.tools.json import json -__all__ = ['LoginPage', 'LoginRedirectPage', 'ForbiddenVideo', 'ForbiddenVideoPage', \ +__all__ = ['LoginPage', 'LoginRedirectPage', 'ForbiddenVideo', 'ForbiddenVideoPage', 'VerifyAgePage', 'VerifyControversyPage', 'VideoPage'] diff --git a/tools/boilerplate_data/base_test.py b/tools/boilerplate_data/base_test.py index ed8c1735..e6a95003 100644 --- a/tools/boilerplate_data/base_test.py +++ b/tools/boilerplate_data/base_test.py @@ -1,6 +1,7 @@ <%inherit file="layout.py"/> from weboob.tools.test import BackendTest + class ${r.classname}Test(BackendTest): BACKEND = '${r.name}' diff --git a/weboob/applications/boobathon/boobathon.py b/weboob/applications/boobathon/boobathon.py index adb8db63..8be18c22 100644 --- a/weboob/applications/boobathon/boobathon.py +++ b/weboob/applications/boobathon/boobathon.py @@ -47,6 +47,7 @@ class Task(object): def __repr__(self): return '' % (self.backend, self.capability) + class Member(object): def __init__(self, id, name): self.name = name @@ -63,6 +64,7 @@ class Member(object): name = '%s..' % name[:18] return name + class Event(object): def __init__(self, name, backend): self.my_id = backend.browser.get_userid() @@ -272,6 +274,7 @@ h2. Attendees self.content.content = s self.backend.push_content(self.content, message) + class Boobathon(ReplApplication): APPNAME = 'boobathon' VERSION = '0.f' diff --git a/weboob/applications/boobill/boobill.py b/weboob/applications/boobill/boobill.py index b40d6d5b..f94ee27e 100644 --- a/weboob/applications/boobill/boobill.py +++ b/weboob/applications/boobill/boobill.py @@ -145,7 +145,7 @@ class Boobill(ReplApplication): Get the list of bills documents for subscriptions. If no ID given, display bills of all backends """ - self.exec_method(id, 'iter_bills') + self.exec_method(id, 'iter_bills') def do_download(self, line): """ diff --git a/weboob/applications/cineoob/cineoob.py b/weboob/applications/cineoob/cineoob.py index 93f1a731..a3007740 100644 --- a/weboob/applications/cineoob/cineoob.py +++ b/weboob/applications/cineoob/cineoob.py @@ -38,6 +38,7 @@ __all__ = ['Cineoob'] ROLE_LIST = ['actor','director','writer','composer','producer'] COUNTRY_LIST = ['us','fr','de','jp'] + class MovieInfoFormatter(IFormatter): MANDATORY_FIELDS = ('id', 'original_title', 'release_date', 'other_titles', 'duration', 'pitch', 'note', 'roles', 'country') @@ -100,6 +101,7 @@ def yearsago(years, from_date=None): return from_date.replace(month=2, day=28, year=from_date.year-years) + def num_years(begin, end=None): if end is None: end = datetime.now() @@ -109,6 +111,7 @@ def num_years(begin, end=None): else: return num_years + class PersonInfoFormatter(IFormatter): MANDATORY_FIELDS = ('id', 'name', 'birth_date', 'birth_place', 'short_biography') diff --git a/weboob/applications/masstransit/masstransit.py b/weboob/applications/masstransit/masstransit.py index f00fbfd6..5f75687a 100644 --- a/weboob/applications/masstransit/masstransit.py +++ b/weboob/applications/masstransit/masstransit.py @@ -29,6 +29,7 @@ class FakeConic(object): STATUS_CONNECTED = None STATUS_DISCONNECTED = None CONNECT_FLAG_NONE = None + def Connection(self): raise NotImplementedError() try: @@ -50,6 +51,7 @@ from logging import debug __all__ = ['Masstransit'] + class MasstransitHildon(): "hildon interface" diff --git a/weboob/applications/qboobmsg/main_window.py b/weboob/applications/qboobmsg/main_window.py index f5b76d49..6cd5ddc4 100644 --- a/weboob/applications/qboobmsg/main_window.py +++ b/weboob/applications/qboobmsg/main_window.py @@ -26,6 +26,7 @@ from weboob.capabilities.messages import ICapMessages from .ui.main_window_ui import Ui_MainWindow from .messages_manager import MessagesManager + class MainWindow(QtMainWindow): def __init__(self, config, weboob, parent=None): QtMainWindow.__init__(self, parent) diff --git a/weboob/applications/qboobmsg/messages_manager.py b/weboob/applications/qboobmsg/messages_manager.py index dc73098f..3aa4d8ae 100644 --- a/weboob/applications/qboobmsg/messages_manager.py +++ b/weboob/applications/qboobmsg/messages_manager.py @@ -29,6 +29,7 @@ from weboob.tools.misc import to_unicode from .ui.messages_manager_ui import Ui_MessagesManager + class MessagesManager(QWidget): def __init__(self, weboob, parent=None): QWidget.__init__(self, parent) diff --git a/weboob/applications/qcineoob/main_window.py b/weboob/applications/qcineoob/main_window.py index 2e1a1f07..44095f56 100644 --- a/weboob/applications/qcineoob/main_window.py +++ b/weboob/applications/qcineoob/main_window.py @@ -40,6 +40,7 @@ from .person import Person from .torrent import Torrent from .subtitle import Subtitle + class MainWindow(QtMainWindow): def __init__(self, config, weboob, parent=None): QtMainWindow.__init__(self, parent) diff --git a/weboob/applications/qcineoob/minimovie.py b/weboob/applications/qcineoob/minimovie.py index d4ec0d7a..49836570 100644 --- a/weboob/applications/qcineoob/minimovie.py +++ b/weboob/applications/qcineoob/minimovie.py @@ -25,6 +25,7 @@ from PyQt4.QtCore import Qt from weboob.applications.qcineoob.ui.minimovie_ui import Ui_MiniMovie from weboob.capabilities.base import empty + class MiniMovie(QFrame): def __init__(self, weboob, backend, movie, parent=None): QFrame.__init__(self, parent) diff --git a/weboob/applications/qcineoob/miniperson.py b/weboob/applications/qcineoob/miniperson.py index 828357c7..e2af29ac 100644 --- a/weboob/applications/qcineoob/miniperson.py +++ b/weboob/applications/qcineoob/miniperson.py @@ -25,6 +25,7 @@ from PyQt4.QtCore import Qt from weboob.applications.qcineoob.ui.miniperson_ui import Ui_MiniPerson from weboob.capabilities.base import empty + class MiniPerson(QFrame): def __init__(self, weboob, backend, person, parent=None): QFrame.__init__(self, parent) diff --git a/weboob/applications/qcineoob/minisubtitle.py b/weboob/applications/qcineoob/minisubtitle.py index 4f3f5fc9..95313a16 100644 --- a/weboob/applications/qcineoob/minisubtitle.py +++ b/weboob/applications/qcineoob/minisubtitle.py @@ -22,6 +22,7 @@ from PyQt4.QtGui import QFrame from weboob.applications.qcineoob.ui.minisubtitle_ui import Ui_MiniSubtitle from weboob.capabilities.base import empty + class MiniSubtitle(QFrame): def __init__(self, weboob, backend, subtitle, parent=None): QFrame.__init__(self, parent) diff --git a/weboob/applications/qcineoob/minitorrent.py b/weboob/applications/qcineoob/minitorrent.py index 32d0fdc7..8eb90638 100644 --- a/weboob/applications/qcineoob/minitorrent.py +++ b/weboob/applications/qcineoob/minitorrent.py @@ -23,6 +23,7 @@ from weboob.applications.qcineoob.ui.minitorrent_ui import Ui_MiniTorrent from weboob.applications.weboorrents.weboorrents import sizeof_fmt from weboob.capabilities.base import empty + class MiniTorrent(QFrame): def __init__(self, weboob, backend, torrent, parent=None): QFrame.__init__(self, parent) diff --git a/weboob/applications/qcineoob/movie.py b/weboob/applications/qcineoob/movie.py index f895cbcb..f1889c6c 100644 --- a/weboob/applications/qcineoob/movie.py +++ b/weboob/applications/qcineoob/movie.py @@ -27,6 +27,7 @@ from weboob.capabilities.base import empty from weboob.applications.suboob.suboob import LANGUAGE_CONV from weboob.applications.cineoob.cineoob import ROLE_LIST + class Movie(QFrame): def __init__(self, movie, backend, parent=None): QFrame.__init__(self, parent) diff --git a/weboob/applications/qcineoob/person.py b/weboob/applications/qcineoob/person.py index 6c5f01ea..7836e546 100644 --- a/weboob/applications/qcineoob/person.py +++ b/weboob/applications/qcineoob/person.py @@ -26,6 +26,7 @@ from weboob.applications.qcineoob.ui.person_ui import Ui_Person from weboob.capabilities.base import empty from weboob.applications.cineoob.cineoob import ROLE_LIST + class Person(QFrame): def __init__(self, person, backend, parent=None): QFrame.__init__(self, parent) diff --git a/weboob/applications/qcineoob/qcineoob.py b/weboob/applications/qcineoob/qcineoob.py index b072413e..1a546674 100644 --- a/weboob/applications/qcineoob/qcineoob.py +++ b/weboob/applications/qcineoob/qcineoob.py @@ -36,6 +36,7 @@ class QCineoob(QtApplication): CONFIG = {'settings': {'backend': '', } } + def main(self, argv): self.load_backends([ICapCinema,ICapTorrent,ICapSubtitle]) self.load_config() diff --git a/weboob/applications/qcineoob/subtitle.py b/weboob/applications/qcineoob/subtitle.py index b25cf4d7..fdf1cb2a 100644 --- a/weboob/applications/qcineoob/subtitle.py +++ b/weboob/applications/qcineoob/subtitle.py @@ -25,6 +25,7 @@ from PyQt4.QtGui import QFrame, QFileDialog from weboob.applications.qcineoob.ui.subtitle_ui import Ui_Subtitle from weboob.capabilities.base import empty + class Subtitle(QFrame): def __init__(self, subtitle, backend, parent=None): QFrame.__init__(self, parent) @@ -77,4 +78,3 @@ class Subtitle(QFrame): print >>sys.stderr, 'Unable to write subtitle file in "%s": %s' % (dest, e) return 1 return - diff --git a/weboob/applications/qcineoob/torrent.py b/weboob/applications/qcineoob/torrent.py index cfbbfdb2..2b26c661 100644 --- a/weboob/applications/qcineoob/torrent.py +++ b/weboob/applications/qcineoob/torrent.py @@ -26,6 +26,7 @@ from weboob.applications.qcineoob.ui.torrent_ui import Ui_Torrent from weboob.applications.weboorrents.weboorrents import sizeof_fmt from weboob.capabilities.base import empty + class Torrent(QFrame): def __init__(self, torrent, backend, parent=None): QFrame.__init__(self, parent) @@ -77,4 +78,3 @@ class Torrent(QFrame): print >>sys.stderr, 'Unable to write .torrent in "%s": %s' % (dest, e) return 1 return - diff --git a/weboob/applications/qflatboob/main_window.py b/weboob/applications/qflatboob/main_window.py index 8f17165a..5f1ca454 100644 --- a/weboob/applications/qflatboob/main_window.py +++ b/weboob/applications/qflatboob/main_window.py @@ -30,6 +30,7 @@ from weboob.capabilities.base import NotLoaded, NotAvailable from .ui.main_window_ui import Ui_MainWindow from .query import QueryDialog + class HousingListWidgetItem(QListWidgetItem): def __init__(self, housing, *args, **kwargs): QListWidgetItem.__init__(self, *args, **kwargs) @@ -56,6 +57,7 @@ class HousingListWidgetItem(QListWidgetItem): elif self.background().color() != QColor(0,0,0): self.setBackground(QBrush()) + class MainWindow(QtMainWindow): def __init__(self, config, storage, weboob, parent=None): QtMainWindow.__init__(self, parent) diff --git a/weboob/applications/qflatboob/query.py b/weboob/applications/qflatboob/query.py index 6b06c6ec..b9100488 100644 --- a/weboob/applications/qflatboob/query.py +++ b/weboob/applications/qflatboob/query.py @@ -24,6 +24,7 @@ from weboob.tools.application.qt import QtDo, HTMLDelegate from .ui.query_ui import Ui_QueryDialog + class QueryDialog(QDialog): def __init__(self, weboob, parent=None): QDialog.__init__(self, parent) @@ -43,7 +44,7 @@ class QueryDialog(QDialog): if hasattr(self.ui.cityEdit, "setPlaceholderText"): self.ui.cityEdit.setPlaceholderText("Press enter to search city") - + def keyPressEvent(self, event): """ Disable handler and to prevent closing the window. diff --git a/weboob/applications/qhavedate/contacts.py b/weboob/applications/qhavedate/contacts.py index 377eef7b..36431191 100644 --- a/weboob/applications/qhavedate/contacts.py +++ b/weboob/applications/qhavedate/contacts.py @@ -37,6 +37,7 @@ from .ui.thread_message_ui import Ui_ThreadMessage from .ui.profile_ui import Ui_Profile from .ui.notes_ui import Ui_Notes + class ThreadMessage(QFrame): """ This class represents a message in the thread tab. @@ -70,6 +71,7 @@ class ThreadMessage(QFrame): return False return self.message == m.message + class ContactThread(QWidget): """ The thread of the selected contact. @@ -341,6 +343,7 @@ class ContactProfile(QWidget): text += '
(Hidden photo)' self.ui.photoUrlLabel.setText(text) + class ContactNotes(QWidget): """ Widget for storing notes about a contact """ @@ -399,6 +402,7 @@ class ContactNotes(QWidget): QMessageBox.critical(self, self.tr('Error while saving notes'), content, QMessageBox.Ok) + class IGroup(object): def __init__(self, weboob, id, name): self.id = id @@ -408,6 +412,7 @@ class IGroup(object): def iter_contacts(self, cb): raise NotImplementedError() + class MetaGroup(IGroup): def iter_contacts(self, cb): if self.id == 'online': @@ -427,6 +432,7 @@ class MetaGroup(IGroup): self.process = None cb(None) + class ContactsWidget(QWidget): def __init__(self, weboob, parent=None): QWidget.__init__(self, parent) @@ -587,5 +593,3 @@ class ContactsWidget(QWidget): content += u'\n%s\n' % to_unicode(backtrace) QMessageBox.critical(self, self.tr('Error while getting contact'), content, QMessageBox.Ok) - - diff --git a/weboob/applications/qhavedate/events.py b/weboob/applications/qhavedate/events.py index 7260d9f7..d67743c3 100644 --- a/weboob/applications/qhavedate/events.py +++ b/weboob/applications/qhavedate/events.py @@ -25,6 +25,7 @@ from weboob.tools.application.qt import QtDo, HTMLDelegate from .ui.events_ui import Ui_Events + class EventsWidget(QWidget): def __init__(self, weboob, parent=None): QWidget.__init__(self, parent) diff --git a/weboob/applications/qhavedate/main_window.py b/weboob/applications/qhavedate/main_window.py index 4bfec3ff..378ab75a 100644 --- a/weboob/applications/qhavedate/main_window.py +++ b/weboob/applications/qhavedate/main_window.py @@ -35,6 +35,7 @@ from .status import AccountsStatus from .contacts import ContactsWidget from .events import EventsWidget + class MainWindow(QtMainWindow): def __init__(self, config, weboob, parent=None): QtMainWindow.__init__(self, parent) diff --git a/weboob/applications/qhavedate/qhavedate.py b/weboob/applications/qhavedate/qhavedate.py index 231cf19c..c025e706 100644 --- a/weboob/applications/qhavedate/qhavedate.py +++ b/weboob/applications/qhavedate/qhavedate.py @@ -23,6 +23,7 @@ from weboob.tools.application.qt import QtApplication from .main_window import MainWindow + class QHaveDate(QtApplication): APPNAME = 'qhavedate' VERSION = '0.f' diff --git a/weboob/applications/qhavedate/status.py b/weboob/applications/qhavedate/status.py index ae7591cb..dbef05e4 100644 --- a/weboob/applications/qhavedate/status.py +++ b/weboob/applications/qhavedate/status.py @@ -24,6 +24,7 @@ from weboob.capabilities.account import ICapAccount, StatusField from weboob.tools.application.qt import QtDo from weboob.tools.misc import to_unicode + class Account(QFrame): def __init__(self, weboob, backend, parent=None): QFrame.__init__(self, parent) @@ -103,6 +104,7 @@ class Account(QFrame): self.body.setText(u'Unable to connect: %s' % to_unicode(err)) self.title.setText(u'%s' % unicode(self.title.text())) + class AccountsStatus(QScrollArea): def __init__(self, weboob, parent=None): QScrollArea.__init__(self, parent) diff --git a/weboob/applications/qvideoob/main_window.py b/weboob/applications/qvideoob/main_window.py index def9ded9..704df568 100644 --- a/weboob/applications/qvideoob/main_window.py +++ b/weboob/applications/qvideoob/main_window.py @@ -29,6 +29,7 @@ from weboob.applications.qvideoob.ui.main_window_ui import Ui_MainWindow from .video import Video from .minivideo import MiniVideo + class MainWindow(QtMainWindow): def __init__(self, config, weboob, parent=None): QtMainWindow.__init__(self, parent) diff --git a/weboob/applications/qvideoob/minivideo.py b/weboob/applications/qvideoob/minivideo.py index 1aa7171f..066581a9 100644 --- a/weboob/applications/qvideoob/minivideo.py +++ b/weboob/applications/qvideoob/minivideo.py @@ -24,6 +24,7 @@ from weboob.tools.application.qt import QtDo from weboob.applications.qvideoob.ui.minivideo_ui import Ui_MiniVideo from .video import Video + class MiniVideo(QFrame): def __init__(self, weboob, backend, video, parent=None): QFrame.__init__(self, parent) diff --git a/weboob/applications/qvideoob/qvideoob.py b/weboob/applications/qvideoob/qvideoob.py index 6001a979..e92a6640 100644 --- a/weboob/applications/qvideoob/qvideoob.py +++ b/weboob/applications/qvideoob/qvideoob.py @@ -37,6 +37,7 @@ class QVideoob(QtApplication): 'backend': '' } } + def main(self, argv): self.load_backends(ICapVideo) self.load_config() diff --git a/weboob/applications/qvideoob/video.py b/weboob/applications/qvideoob/video.py index 337b5120..4e5d0397 100644 --- a/weboob/applications/qvideoob/video.py +++ b/weboob/applications/qvideoob/video.py @@ -24,6 +24,7 @@ from PyQt4.phonon import Phonon from weboob.applications.qvideoob.ui.video_ui import Ui_Video + class Video(QDialog): def __init__(self, video, parent=None): QDialog.__init__(self, parent) diff --git a/weboob/applications/qwebcontentedit/main_window.py b/weboob/applications/qwebcontentedit/main_window.py index 907c8ee1..637b3f89 100644 --- a/weboob/applications/qwebcontentedit/main_window.py +++ b/weboob/applications/qwebcontentedit/main_window.py @@ -30,6 +30,7 @@ from weboob.tools.misc import to_unicode from .ui.main_window_ui import Ui_MainWindow + class MainWindow(QtMainWindow): def __init__(self, config, weboob, parent=None): QtMainWindow.__init__(self, parent) @@ -102,11 +103,11 @@ class MainWindow(QtMainWindow): _id = unicode(self.ui.idEdit.text()) if not _id: return - + self.ui.loadButton.setEnabled(False) self.ui.loadButton.setText('Loading...') self.ui.contentEdit.setReadOnly(True) - + backend = str(self.ui.backendBox.currentText()) self.process = QtDo(self.weboob, self._loadedPage, @@ -137,7 +138,7 @@ class MainWindow(QtMainWindow): self.ui.contentEdit.setPlainText(self.content.content) self.setWindowTitle("QWebcontentedit - %s@%s" %(self.content.id, backend.name)) - self.backend = backend + self.backend = backend def _errorLoadPage(self, backend, error, backtrace): """ Error callback for loadPage """ @@ -203,7 +204,7 @@ class MainWindow(QtMainWindow): self.ui.loadHistoryButton.setEnabled(False) self.ui.loadHistoryButton.setText("Loading...") - + self.ui.historyTable.clear() self.ui.historyTable.setRowCount(0) @@ -212,7 +213,7 @@ class MainWindow(QtMainWindow): "Author", "Summary"]) self.ui.historyTable.setColumnWidth(3, 1000) - + self.process = QtDo(self.weboob, self._gotRevision, self._errorHistory) @@ -234,13 +235,13 @@ class MainWindow(QtMainWindow): # are not modifiable (they are modifiable by default) item_revision = QTableWidgetItem(revision.id) item_revision.setFlags(Qt.ItemIsEnabled) - + item_time = QTableWidgetItem(revision.timestamp.strftime('%Y-%m-%d %H:%M:%S')) item_time.setFlags(Qt.ItemIsEnabled) - + item_author = QTableWidgetItem(revision.author) item_author.setFlags(Qt.ItemIsEnabled) - + item_summary = QTableWidgetItem(revision.comment) item_summary.setFlags(Qt.ItemIsEnabled) @@ -260,6 +261,6 @@ class MainWindow(QtMainWindow): content += '\n%s\n' % to_unicode(backtrace) QMessageBox.critical(self, self.tr('Error while loading history'), content, QMessageBox.Ok) - + self.ui.loadHistoryButton.setEnabled(True) self.ui.loadHistoryButton.setText("Reload") diff --git a/weboob/applications/videoob/videoob.py b/weboob/applications/videoob/videoob.py index 353b2222..ae6460a0 100644 --- a/weboob/applications/videoob/videoob.py +++ b/weboob/applications/videoob/videoob.py @@ -49,6 +49,7 @@ class VideoListFormatter(PrettyFormatter): result += u' (%s/%s)' % (obj.rating, obj.rating_max) return result + class Videoob(ReplApplication): APPNAME = 'videoob' VERSION = '0.f' diff --git a/weboob/capabilities/account.py b/weboob/capabilities/account.py index 0c492d80..abd0600b 100644 --- a/weboob/capabilities/account.py +++ b/weboob/capabilities/account.py @@ -29,6 +29,7 @@ class AccountRegisterError(UserError): Raised when there is an error during registration. """ + class Account(CapBaseObject): """ Describe an account and its properties. @@ -40,6 +41,7 @@ class Account(CapBaseObject): def __init__(self, id=None): CapBaseObject.__init__(self, id) + class StatusField(object): """ Field of an account status. diff --git a/weboob/capabilities/bank.py b/weboob/capabilities/bank.py index 1dce091b..d9cc3772 100644 --- a/weboob/capabilities/bank.py +++ b/weboob/capabilities/bank.py @@ -36,11 +36,13 @@ class AccountNotFound(UserError): def __init__(self, msg='Account not found'): UserError.__init__(self, msg) + class TransferError(UserError): """ A transfer has failed. """ + class Currency(object): CUR_UNKNOWN = 0 CUR_EUR = 1 @@ -92,6 +94,7 @@ class Recipient(CapBaseObject): def __init__(self): CapBaseObject.__init__(self, 0) + class Account(Recipient, Currency): """ Bank account. @@ -144,6 +147,7 @@ class Transaction(CapBaseObject): return "" % (self.date, label, self.amount) + class Transfer(CapBaseObject): """ Transfer from an account to a recipient. @@ -155,6 +159,7 @@ class Transfer(CapBaseObject): recipient = Field('Recipient', int, long, basestring) reason = StringField('Reason') + class ICapBank(ICapCollection): """ Capability of bank websites to see accounts and transactions. diff --git a/weboob/capabilities/bill.py b/weboob/capabilities/bill.py index f1f21c36..25018a88 100644 --- a/weboob/capabilities/bill.py +++ b/weboob/capabilities/bill.py @@ -53,6 +53,7 @@ class Detail(CapBaseObject): def __init__(self): CapBaseObject.__init__(self, 0) + class Bill(CapBaseObject): """ Bill. @@ -65,6 +66,7 @@ class Bill(CapBaseObject): def __init__(self): CapBaseObject.__init__(self, 0) + class Subscription(CapBaseObject): """ Subscription to a service. @@ -74,6 +76,7 @@ class Subscription(CapBaseObject): validity = DateField('End validity date of the subscription') renewdate = DateField('Reset date of consumption') + class ICapBill(ICapCollection): def iter_resources(self, objs, split_path): """ diff --git a/weboob/capabilities/bugtracker.py b/weboob/capabilities/bugtracker.py index 71a44e1d..f93468f2 100644 --- a/weboob/capabilities/bugtracker.py +++ b/weboob/capabilities/bugtracker.py @@ -31,6 +31,7 @@ class IssueError(UserError): Raised when there is an error with an issue. """ + class Project(CapBaseObject): """ Represents a project. @@ -101,6 +102,7 @@ class Project(CapBaseObject): return None return None + class User(CapBaseObject): """ User. @@ -114,6 +116,7 @@ class User(CapBaseObject): def __repr__(self): return '' % self.name + class Version(CapBaseObject): """ Version of a project. @@ -127,6 +130,7 @@ class Version(CapBaseObject): def __repr__(self): return '' % self.name + class Status(CapBaseObject): """ Status of an issue. @@ -150,6 +154,7 @@ class Status(CapBaseObject): def __repr__(self): return '' % self.name + class Attachment(CapBaseObject): """ Attachment of an issue. @@ -160,6 +165,7 @@ class Attachment(CapBaseObject): def __repr__(self): return '' % self.filename + class Change(CapBaseObject): """ A change of an update. @@ -168,6 +174,7 @@ class Change(CapBaseObject): last = StringField('Last value of field') new = StringField('New value of field') + class Update(CapBaseObject): """ Represents an update of an issue. @@ -182,6 +189,7 @@ class Update(CapBaseObject): def __repr__(self): return '' % self.id + class Issue(CapBaseObject): """ Represents an issue. @@ -199,6 +207,7 @@ class Issue(CapBaseObject): version = Field('Target version of this issue', Version) status = Field('Status of this issue', Status) + class Query(CapBaseObject): """ Query to find an issue. @@ -214,6 +223,7 @@ class Query(CapBaseObject): def __init__(self): CapBaseObject.__init__(self, '') + class ICapBugTracker(IBaseCap): """ Bug trackers websites. diff --git a/weboob/capabilities/chat.py b/weboob/capabilities/chat.py index dd585be4..aacae24f 100644 --- a/weboob/capabilities/chat.py +++ b/weboob/capabilities/chat.py @@ -51,6 +51,7 @@ class ChatMessage(CapBaseObject): if self.date is None: self.date = datetime.datetime.utcnow() + class ICapChat(IBaseCap): """ Websites with a chat system. diff --git a/weboob/capabilities/content.py b/weboob/capabilities/content.py index 8d528e0f..06a315b3 100644 --- a/weboob/capabilities/content.py +++ b/weboob/capabilities/content.py @@ -33,6 +33,7 @@ class Content(CapBaseObject): content = StringField('Body') revision = StringField('ID of revision') + class Revision(CapBaseObject): """ Revision of a change on a content. @@ -42,6 +43,7 @@ class Revision(CapBaseObject): timestamp = DateField('Date of revision') minor = Field('Is this change minor?', bool) + class ICapContent(IBaseCap): def get_content(self, id, revision=None): """ diff --git a/weboob/capabilities/dating.py b/weboob/capabilities/dating.py index ff934cac..eaa01287 100644 --- a/weboob/capabilities/dating.py +++ b/weboob/capabilities/dating.py @@ -88,6 +88,7 @@ class Event(CapBaseObject): type = StringField('Type of event') message = StringField('Message of the event') + class ICapDating(IBaseCap): """ Capability for dating websites. diff --git a/weboob/capabilities/geolocip.py b/weboob/capabilities/geolocip.py index 6a071a9c..a7a384b2 100644 --- a/weboob/capabilities/geolocip.py +++ b/weboob/capabilities/geolocip.py @@ -42,6 +42,7 @@ class IpLocation(CapBaseObject): CapBaseObject.__init__(self, ipaddr) self.ipaddr = ipaddr + class ICapGeolocIp(IBaseCap): """ Access information about IP addresses database. diff --git a/weboob/capabilities/housing.py b/weboob/capabilities/housing.py index 11c1fd11..7d8b2d53 100644 --- a/weboob/capabilities/housing.py +++ b/weboob/capabilities/housing.py @@ -45,6 +45,7 @@ class HousingPhoto(CapBaseObject): def __repr__(self): return u'' % (self.id, len(self.data) if self.data else 0) + class Housing(CapBaseObject): """ Content of a housing. @@ -61,6 +62,7 @@ class Housing(CapBaseObject): photos = Field('List of photos', list) details = Field('Key/values of details', dict) + class Query(CapBaseObject): """ Query to find housings. @@ -79,12 +81,14 @@ class Query(CapBaseObject): def __init__(self): CapBaseObject.__init__(self, '') + class City(CapBaseObject): """ City. """ name = StringField('Name of city') + class ICapHousing(IBaseCap): """ Capability of websites to search housings. diff --git a/weboob/capabilities/library.py b/weboob/capabilities/library.py index ebe0169f..68caff7d 100644 --- a/weboob/capabilities/library.py +++ b/weboob/capabilities/library.py @@ -34,12 +34,14 @@ class Book(CapBaseObject): date = DateField('The due date') late = Field('Are you late?', bool) + class Renew(CapBaseObject): """ A renew message. """ message = StringField('Message') + class ICapBook(ICapCollection): """ Library websites. diff --git a/weboob/capabilities/messages.py b/weboob/capabilities/messages.py index 711875df..ada4f95f 100644 --- a/weboob/capabilities/messages.py +++ b/weboob/capabilities/messages.py @@ -34,10 +34,12 @@ class _Message(CapBaseObject): """ Base message. """ pass + class _Thread(CapBaseObject): """ Base Thread. """ pass + class Message(_Message): """ Represents a message read or to send. @@ -131,6 +133,7 @@ class Message(_Message): return '' % ( self.full_id, self.title, self.date, self.sender) + class Thread(_Thread): """ Thread containing messages. @@ -199,11 +202,13 @@ class ICapMessages(IBaseCap): """ raise NotImplementedError() + class CantSendMessage(UserError): """ Raised when a message can't be send. """ + class ICapMessagesPost(IBaseCap): """ This capability allow user to send a message. diff --git a/weboob/capabilities/paste.py b/weboob/capabilities/paste.py index f8b9ef6d..ce9833df 100644 --- a/weboob/capabilities/paste.py +++ b/weboob/capabilities/paste.py @@ -29,6 +29,7 @@ class PasteNotFound(UserError): Raised when a paste is not found. """ + class BasePaste(CapBaseObject): """ Represents a pasted text. diff --git a/weboob/capabilities/pricecomparison.py b/weboob/capabilities/pricecomparison.py index aa1625a9..a6ae0f2d 100644 --- a/weboob/capabilities/pricecomparison.py +++ b/weboob/capabilities/pricecomparison.py @@ -31,6 +31,7 @@ class Product(CapBaseObject): """ name = StringField('Name of product') + class Shop(CapBaseObject): """ A shop where the price is. @@ -39,6 +40,7 @@ class Shop(CapBaseObject): location = StringField('Location of the shop') info = StringField('Information about the shop') + class Price(CapBaseObject): """ Price. @@ -50,6 +52,7 @@ class Price(CapBaseObject): shop = Field('Shop information', Shop) product = Field('Product', Product) + class ICapPriceComparison(IBaseCap): """ Capability for price comparison websites. diff --git a/weboob/capabilities/radio.py b/weboob/capabilities/radio.py index daaa41fc..67be4f4f 100644 --- a/weboob/capabilities/radio.py +++ b/weboob/capabilities/radio.py @@ -41,6 +41,7 @@ class Emission(CapBaseObject): else: return self.title + class Stream(CapBaseObject): """ Stream of a radio. @@ -54,6 +55,7 @@ class Stream(CapBaseObject): def __repr__(self): return self.__unicode__() + class Radio(CapBaseObject): """ Radio object. @@ -63,6 +65,7 @@ class Radio(CapBaseObject): current = Field('Current emission', Emission) streams = Field('List of streams', list) + class ICapRadio(IBaseCap): """ Capability of radio websites. diff --git a/weboob/capabilities/travel.py b/weboob/capabilities/travel.py index 73fde9c1..8f8cd756 100644 --- a/weboob/capabilities/travel.py +++ b/weboob/capabilities/travel.py @@ -40,6 +40,7 @@ class Station(CapBaseObject): def __repr__(self): return "" % (self.id, self.name) + class Departure(CapBaseObject): """ Describes a departure. @@ -62,6 +63,7 @@ class Departure(CapBaseObject): return u"" % ( self.id, self.type, self.time.strftime('%H:%M'), self.departure_station, self.arrival_station) + class RoadStep(CapBaseObject): """ A step on a roadmap. @@ -73,11 +75,13 @@ class RoadStep(CapBaseObject): arrival = StringField('Arrival station') duration = DeltaField('Duration of this step') + class RoadmapError(UserError): """ Raised when the roadmap is unable to be calculated. """ + class RoadmapFilters(CapBaseObject): """ Filters to get a roadmap. @@ -88,6 +92,7 @@ class RoadmapFilters(CapBaseObject): def __init__(self): CapBaseObject.__init__(self, '') + class ICapTravel(IBaseCap): """ Travel websites. diff --git a/weboob/capabilities/weather.py b/weboob/capabilities/weather.py index 074df49a..1252705b 100644 --- a/weboob/capabilities/weather.py +++ b/weboob/capabilities/weather.py @@ -71,6 +71,7 @@ class Forecast(CapBaseObject): self.high = Temperature(high, unit) self.text = text + class Current(CapBaseObject): """ Current weather. @@ -85,6 +86,7 @@ class Current(CapBaseObject): self.text = text self.temp = Temperature(temp, unit) + class City(CapBaseObject): """ City where to find weather. @@ -95,11 +97,13 @@ class City(CapBaseObject): CapBaseObject.__init__(self, id) self.name = name + class CityNotFound(UserError): """ Raised when a city is not found. """ + class ICapWeather(IBaseCap): """ Capability for weather websites. diff --git a/weboob/core/bcall.py b/weboob/core/bcall.py index 7a20ad9d..1a0492d6 100644 --- a/weboob/core/bcall.py +++ b/weboob/core/bcall.py @@ -43,13 +43,16 @@ class CallErrors(Exception): def __iter__(self): return self.errors.__iter__() + class IResultsCondition(object): def is_valid(self, obj): raise NotImplementedError() + class ResultsConditionError(Exception): pass + class BackendsCall(object): def __init__(self, backends, condition, function, *args, **kwargs): """ diff --git a/weboob/core/modules.py b/weboob/core/modules.py index 25024233..1d67f3a5 100644 --- a/weboob/core/modules.py +++ b/weboob/core/modules.py @@ -32,6 +32,7 @@ class ModuleLoadError(Exception): Exception.__init__(self, msg) self.module = module_name + class Module(object): def __init__(self, package): self.logger = getLogger('backend') diff --git a/weboob/core/scheduler.py b/weboob/core/scheduler.py index 3c19a50e..bf2b555e 100644 --- a/weboob/core/scheduler.py +++ b/weboob/core/scheduler.py @@ -44,6 +44,7 @@ class IScheduler(object): def want_stop(self): raise NotImplementedError() + class RepeatedTimer(_Timer): def run(self): while not self.finished.isSet(): @@ -55,6 +56,7 @@ class RepeatedTimer(_Timer): self.finished.wait(self.interval) self.finished.set() + class Scheduler(IScheduler): def __init__(self): self.logger = getLogger('scheduler') diff --git a/weboob/tools/application/base.py b/weboob/tools/application/base.py index 3768876c..bb0accf6 100644 --- a/weboob/tools/application/base.py +++ b/weboob/tools/application/base.py @@ -64,6 +64,7 @@ class ApplicationStorage(object): if self.storage: return self.storage.save('applications', self.name) + class BaseApplication(object): """ Base application. diff --git a/weboob/tools/application/console.py b/weboob/tools/application/console.py index a22aa4d7..000ad903 100644 --- a/weboob/tools/application/console.py +++ b/weboob/tools/application/console.py @@ -50,9 +50,11 @@ class BackendNotGiven(Exception): Exception.__init__(self, 'Please specify a backend to use for this argument (%s@backend_name). ' 'Availables: %s.' % (id, ', '.join(name for name, backend in backends))) + class BackendNotFound(Exception): pass + class ConsoleApplication(BaseApplication): """ Base application class for CLI applications. diff --git a/weboob/tools/application/formatters/load.py b/weboob/tools/application/formatters/load.py index 3bc544ab..810de04b 100644 --- a/weboob/tools/application/formatters/load.py +++ b/weboob/tools/application/formatters/load.py @@ -24,6 +24,7 @@ __all__ = ['FormattersLoader', 'FormatterLoadError'] class FormatterLoadError(Exception): pass + class FormattersLoader(object): BUILTINS = ['htmltable', 'multiline', 'simple', 'table', 'csv', 'webkit', 'json'] diff --git a/weboob/tools/application/formatters/table.py b/weboob/tools/application/formatters/table.py index 55e74688..7ac6a7ab 100644 --- a/weboob/tools/application/formatters/table.py +++ b/weboob/tools/application/formatters/table.py @@ -70,7 +70,7 @@ class TableFormatter(IFormatter): table = PrettyTable(list(column_headers)) for column_header in column_headers: # API changed in python-prettytable. The try/except is a bad hack to support both versions - # Note: two versions are not exactly the same... + # Note: two versions are not exactly the same... # (first one: header in center. Second one: left align for header too) try: table.set_field_align(column_header, 'l') diff --git a/weboob/tools/application/media_player.py b/weboob/tools/application/media_player.py index 0c83df3c..4e068c35 100644 --- a/weboob/tools/application/media_player.py +++ b/weboob/tools/application/media_player.py @@ -39,7 +39,7 @@ PLAYERS = ( class MediaPlayerNotFound(Exception): def __init__(self): - Exception.__init__(self, u'No media player found on this system. Please install one of them: %s.' % \ + Exception.__init__(self, u'No media player found on this system. Please install one of them: %s.' % ', '.join(player[0] for player in PLAYERS)) @@ -75,7 +75,7 @@ class MediaPlayer(object): """ player_names = [player[0] for player in PLAYERS] if not player_name: - self.logger.debug(u'No media player given. Using the first available from: %s.' % \ + self.logger.debug(u'No media player given. Using the first available from: %s.' % ', '.join(player_names)) player_name = self.guess_player_name() if player_name is None: diff --git a/weboob/tools/application/qt/backendcfg.py b/weboob/tools/application/qt/backendcfg.py index ff1873e7..fc0d7ccb 100644 --- a/weboob/tools/application/qt/backendcfg.py +++ b/weboob/tools/application/qt/backendcfg.py @@ -221,7 +221,7 @@ class BackendCfg(QDialog): continue item = QTreeWidgetItem(None, [instance_name, name]) - item.setCheckState(0, Qt.Checked if params.get('_enabled', '1').lower() in ('1', 'y', 'true') \ + item.setCheckState(0, Qt.Checked if params.get('_enabled', '1').lower() in ('1', 'y', 'true') else Qt.Unchecked) self.set_icon(item, info) diff --git a/weboob/tools/application/qt/qt.py b/weboob/tools/application/qt/qt.py index 05bf79fe..81000c6d 100644 --- a/weboob/tools/application/qt/qt.py +++ b/weboob/tools/application/qt/qt.py @@ -39,6 +39,7 @@ from ..base import BaseApplication __all__ = ['QtApplication', 'QtMainWindow', 'QtDo', 'HTMLDelegate'] + class QtScheduler(IScheduler): def __init__(self, app): self.app = app @@ -81,6 +82,7 @@ class QtScheduler(IScheduler): def run(self): self.app.exec_() + class QCallbacksManager(QObject): class Request(object): def __init__(self): @@ -132,6 +134,7 @@ class QCallbacksManager(QObject): request.event.wait() return request.answer + class QtApplication(QApplication, BaseApplication): def __init__(self): QApplication.__init__(self, sys.argv) @@ -143,10 +146,12 @@ class QtApplication(QApplication, BaseApplication): def create_weboob(self): return Weboob(scheduler=QtScheduler(self)) + class QtMainWindow(QMainWindow): def __init__(self, parent=None): QMainWindow.__init__(self, parent) + class QtDo(QObject): def __init__(self, weboob, cb, eb=None): QObject.__init__(self) @@ -223,6 +228,7 @@ class QtDo(QObject): def thread_eb(self, backend, error, backtrace): self.emit(SIGNAL('eb'), backend, error, backtrace) + class HTMLDelegate(QStyledItemDelegate): def paint(self, painter, option, index): optionV4 = QStyleOptionViewItemV4(option) @@ -260,6 +266,7 @@ class HTMLDelegate(QStyledItemDelegate): return QSize(doc.idealWidth(), max(doc.size().height(), optionV4.decorationSize.height())) + class _QtValueStr(QLineEdit): def __init__(self, value): QLineEdit.__init__(self) @@ -277,11 +284,13 @@ class _QtValueStr(QLineEdit): self._value.set(unicode(self.text())) return self._value + class _QtValueBackendPassword(_QtValueStr): def get_value(self): self._value._domain = None return _QtValueStr.get_value(self) + class _QtValueBool(QCheckBox): def __init__(self, value): QCheckBox.__init__(self) @@ -297,6 +306,7 @@ class _QtValueBool(QCheckBox): self._value.set(self.isChecked()) return self._value + class _QtValueInt(QSpinBox): def __init__(self, value): QSpinBox.__init__(self) @@ -312,6 +322,7 @@ class _QtValueInt(QSpinBox): self._value.set(self.getValue()) return self._value + class _QtValueChoices(QComboBox): def __init__(self, value): QComboBox.__init__(self) @@ -332,6 +343,7 @@ class _QtValueChoices(QComboBox): self._value.set(unicode(self.itemData(self.currentIndex()).toString())) return self._value + def QtValue(value): if isinstance(value, ValueBool): klass = _QtValueBool diff --git a/weboob/tools/browser/browser.py b/weboob/tools/browser/browser.py index 9caacd6c..7a0c5fa0 100644 --- a/weboob/tools/browser/browser.py +++ b/weboob/tools/browser/browser.py @@ -70,12 +70,15 @@ __all__ = ['BrowserIncorrectPassword', 'BrowserForbidden', 'BrowserBanned', 'Bro class BrowserIncorrectPassword(Exception): pass + class BrowserForbidden(Exception): pass + class BrowserBanned(BrowserIncorrectPassword): pass + class BrowserPasswordExpired(BrowserIncorrectPassword): pass @@ -83,9 +86,11 @@ class BrowserPasswordExpired(BrowserIncorrectPassword): class BrowserUnavailable(Exception): pass + class BrowserHTTPNotFound(BrowserUnavailable): pass + class BrowserHTTPError(BrowserUnavailable): pass @@ -113,9 +118,11 @@ class NoHistory(object): def close(self): pass + class BrokenPageError(Exception): pass + class BasePage(object): """ Base page @@ -138,6 +145,7 @@ class BasePage(object): """ pass + def check_location(func): def inner(self, *args, **kwargs): if args and isinstance(args[0], basestring): @@ -152,6 +160,7 @@ def check_location(func): return func(self, *args, **kwargs) return inner + class StandardBrowser(mechanize.Browser): """ Standard Browser. diff --git a/weboob/tools/browser/decorators.py b/weboob/tools/browser/decorators.py index 436f38f3..a15a74a0 100644 --- a/weboob/tools/browser/decorators.py +++ b/weboob/tools/browser/decorators.py @@ -23,6 +23,7 @@ __all__ = ['check_url', 'id2url'] from urlparse import urlsplit import re + class check_url(object): """ Checks if the first argument matches the given regular expression (given as str, diff --git a/weboob/tools/capabilities/messages/genericArticle.py b/weboob/tools/capabilities/messages/genericArticle.py index 76f50c05..14731d19 100644 --- a/weboob/tools/capabilities/messages/genericArticle.py +++ b/weboob/tools/capabilities/messages/genericArticle.py @@ -50,6 +50,8 @@ def drop_comments(base_element): # Replace relative url in link and image with a complete url # Arguments: the html element to clean, and the domain name (with http:// prefix) + + def clean_relativ_urls(base_element, domain): for a in base_element.findall('.//a'): if "href" in a.attrib: diff --git a/weboob/tools/capabilities/paste.py b/weboob/tools/capabilities/paste.py index 09135a55..305582f9 100644 --- a/weboob/tools/capabilities/paste.py +++ b/weboob/tools/capabilities/paste.py @@ -48,6 +48,7 @@ class BasePasteBackend(ICapPaste): if max_age is False or max_age >= e: return e + def test(): class MockPasteBackend(BasePasteBackend): def __init__(self, expirations): diff --git a/weboob/tools/captcha/virtkeyboard.py b/weboob/tools/captcha/virtkeyboard.py index 8840dac5..8f0a36fb 100644 --- a/weboob/tools/captcha/virtkeyboard.py +++ b/weboob/tools/captcha/virtkeyboard.py @@ -46,10 +46,10 @@ class VirtKeyboard(object): self.bands = img.getbands() if isinstance(color, int) and not isinstance(self.bands, str) and len(self.bands) != 1: - raise VirtKeyboardError("Color requires %i component but only 1 is provided" \ + raise VirtKeyboardError("Color requires %i component but only 1 is provided" % len(self.bands)) if not isinstance(color, int) and len(color) != len(self.bands): - raise VirtKeyboardError("Color requires %i components but %i are provided" \ + raise VirtKeyboardError("Color requires %i components but %i are provided" % (len(self.bands), len(color))) self.color = color @@ -123,7 +123,7 @@ class VirtKeyboard(object): if dirname is None: dirname = tempfile.mkdtemp(prefix='weboob_session_') self.generate_MD5(dirname) - raise VirtKeyboardError("Symbol '%s' not found; all symbol hashes are available in %s"\ + raise VirtKeyboardError("Symbol '%s' not found; all symbol hashes are available in %s" % (s, dirname)) def generate_MD5(self, dir): diff --git a/weboob/tools/parsers/iparser.py b/weboob/tools/parsers/iparser.py index 161e009a..072ba8ce 100644 --- a/weboob/tools/parsers/iparser.py +++ b/weboob/tools/parsers/iparser.py @@ -54,6 +54,7 @@ class IParser(object): p = re.compile(r'<.*?>') return p.sub(' ', data).strip() + class RawParser(IParser): def parse(self, data, encoding=None): return data.read() diff --git a/weboob/tools/test.py b/weboob/tools/test.py index e6ce1d99..65b175a2 100644 --- a/weboob/tools/test.py +++ b/weboob/tools/test.py @@ -26,6 +26,7 @@ from weboob.core import Weboob __all__ = ['TestCase', 'BackendTest'] + class BackendTest(TestCase): BACKEND = None diff --git a/weboob/tools/value.py b/weboob/tools/value.py index 60245515..217b1a49 100644 --- a/weboob/tools/value.py +++ b/weboob/tools/value.py @@ -37,6 +37,7 @@ class ValuesDict(OrderedDict): for v in values: self[v.id] = v + class Value(object): """ Value. @@ -116,6 +117,7 @@ class Value(object): """ return self._value + class ValueBackendPassword(Value): _domain = None _callbacks = {} @@ -190,6 +192,7 @@ class ValueBackendPassword(Value): self._stored = False return self._value + class ValueInt(Value): def __init__(self, *args, **kwargs): kwargs['regexp'] = '^\d+$' @@ -198,6 +201,7 @@ class ValueInt(Value): def get(self): return int(self._value) + class ValueFloat(Value): def __init__(self, *args, **kwargs): kwargs['regexp'] = '^[\d\.]+$' @@ -212,6 +216,7 @@ class ValueFloat(Value): def get(self): return float(self._value) + class ValueBool(Value): def __init__(self, *args, **kwargs): kwargs['choices'] = {'y': 'True', 'n': 'False'}