From 979f1764d4fa5c10b9a3dcbdbddddb0f9348a36d Mon Sep 17 00:00:00 2001 From: Romain Bignon Date: Sun, 14 Jul 2013 19:06:48 +0200 Subject: [PATCH] pyflakes fixes (unused imports) --- modules/hellobank/browser.py | 23 ++++++++++---------- modules/hellobank/perso/accounts_list.py | 13 +++++------ modules/hellobank/perso/login.py | 9 ++++---- modules/ing/pages/__init__.py | 2 +- modules/ing/pages/titre.py | 3 +-- weboob/applications/qhandjoob/main_window.py | 13 +++++------ 6 files changed, 27 insertions(+), 36 deletions(-) diff --git a/modules/hellobank/browser.py b/modules/hellobank/browser.py index f13a2747..27fdf01e 100755 --- a/modules/hellobank/browser.py +++ b/modules/hellobank/browser.py @@ -22,7 +22,6 @@ import urllib import mechanize from datetime import datetime -from logging import warning from weboob.tools.browser import BaseBrowser, BrowserIncorrectPassword, BrowserPasswordExpired from weboob.capabilities.bank import TransferError, Transfer @@ -84,14 +83,14 @@ class HelloBank(BaseBrowser): now = datetime.now() self.location('/NS_VIRDF?Origine=DSP_VIR&stp=%s' % now.strftime("%Y%m%d%H%M%S")) - accounts = self.page.get_accounts() + accounts = self.page.get_accounts() if len(accounts) == 0: print 'no accounts' # oops, no accounts? check if we have not exhausted the allowed use # of this password for img in self.document.getroot().cssselect('img[align="middle"]'): if img.attrib.get('alt', '') == 'Changez votre code secret': - raise BrowserPasswordExpired('Your password has expired') + raise BrowserPasswordExpired('Your password has expired') self.location('/NSFR?Action=DSP_VGLOBALE') return self.page.get_list(accounts) @@ -108,7 +107,7 @@ class HelloBank(BaseBrowser): def get_IBAN_from_account(self, account): self.go_to_history_page(account) return self.page.get_IBAN() - + def go_to_history_page(self,account): if account._link_id is None: return iter([]) @@ -127,17 +126,17 @@ class HelloBank(BaseBrowser): 'pageId': 'releveoperations', 'sendEUD': 'true', } - self.location('/udc', urllib.urlencode(data)) - + self.location('/udc', urllib.urlencode(data)) + return None - + def go_to_coming_operations_page(self,account): if account._link_id is None: return iter([]) if not self.is_on_page(AccountsList): self.location('/NSFR?Action=DSP_VGLOBALE') - + data = {'gt': 'homepage:basic-theme', 'externalIAId': 'IAStatements', 'cboFlowName': 'flow/iastatement', @@ -149,10 +148,10 @@ class HelloBank(BaseBrowser): 'pageId': 'mouvementsavenir', 'sendEUD': 'true', } - self.location('/udc', urllib.urlencode(data)) - + self.location('/udc', urllib.urlencode(data)) + return None - + def iter_history(self, account): self.go_to_history_page(account) return self.page.iter_operations() @@ -178,7 +177,7 @@ class HelloBank(BaseBrowser): html, [("Content-Type", "text/html")], "https://client.hellobank.fr/NS_VIRDF", 200, "OK") self.set_response(response) - + accounts = self.page.get_accounts() self.page.transfer(from_id, to_id, amount, reason) diff --git a/modules/hellobank/perso/accounts_list.py b/modules/hellobank/perso/accounts_list.py index 78bf2bab..c2680bae 100755 --- a/modules/hellobank/perso/accounts_list.py +++ b/modules/hellobank/perso/accounts_list.py @@ -19,15 +19,12 @@ # along with weboob. If not, see . -import re from decimal import Decimal -from weboob.tools.capabilities.bank.transactions import FrenchTransaction from weboob.capabilities.bank import Account -from weboob.capabilities.base import NotAvailable -from weboob.tools.browser import BasePage, BrokenPageError, BrowserPasswordExpired +from weboob.tools.browser import BasePage, BrowserPasswordExpired from weboob.tools.json import json -import unicodedata as ud + __all__ = ['AccountsList', 'AccountPrelevement'] @@ -43,7 +40,7 @@ class AccountsList(BasePage): def on_loaded(self): pass - + def get_list(self, accounts_ids): l = [] # Read the json data @@ -60,13 +57,13 @@ class AccountsList(BasePage): account.type = self.ACCOUNT_TYPES.get(id_famille, Account.TYPE_UNKNOWN) account.id = 0 account._link_id = 'KEY'+compte['key'] - + # IBAN aren't in JSON # Fast method, get it from transfer page. for i,a in accounts_ids.items(): if a.label == account.label: account.id = i - # But it's doesn't work with LOAN and MARKET, so use slow method : Get it from transaction page. + # But it's doesn't work with LOAN and MARKET, so use slow method : Get it from transaction page. if account.id == 0: account.id = self.browser.get_IBAN_from_account(account) l.append(account) diff --git a/modules/hellobank/perso/login.py b/modules/hellobank/perso/login.py index 8d61db8e..348ffd10 100755 --- a/modules/hellobank/perso/login.py +++ b/modules/hellobank/perso/login.py @@ -21,13 +21,12 @@ import time import re -from weboob.tools.mech import ClientForm -import urllib from weboob.tools.browser import BasePage, BrowserUnavailable from weboob.tools.captcha.virtkeyboard import VirtKeyboard,VirtKeyboardError -__all__ = ['LoginPage', 'ConfirmPage', 'ChangePasswordPage'] + +__all__ = ['LoginPage', 'ConfirmPage', 'InfoMessagePage'] class HelloBankVirtKeyboard(VirtKeyboard): @@ -60,7 +59,7 @@ class HelloBankVirtKeyboard(VirtKeyboard): coords["08"] = (185,100,203,121) coords["09"] = (262,100,280,121) coords["10"] = (339,100,357,121) - + VirtKeyboard.__init__(self,basepage.browser.openurl(self.url % time.time()),coords,self.color) self.check_symbols(self.symbols,basepage.browser.responses_dirname) @@ -90,7 +89,7 @@ class LoginPage(BasePage): except VirtKeyboardError,err: self.logger.error("Error: %s"%err) return False - + self.browser.select_form('logincanalnet') self.browser.set_all_readonly(False) self.browser['ch1'] = login.encode('utf-8') diff --git a/modules/ing/pages/__init__.py b/modules/ing/pages/__init__.py index 25630f61..df54c4cd 100644 --- a/modules/ing/pages/__init__.py +++ b/modules/ing/pages/__init__.py @@ -30,4 +30,4 @@ class AccountPrelevement(AccountsList): __all__ = ['AccountsList', 'LoginPage', 'AccountPrelevement', 'TransferPage', 'TransferConfirmPage', - 'BillsPage', 'StopPage'] + 'BillsPage', 'StopPage', 'TitrePage'] diff --git a/modules/ing/pages/titre.py b/modules/ing/pages/titre.py index 46ef92a9..0c249def 100644 --- a/modules/ing/pages/titre.py +++ b/modules/ing/pages/titre.py @@ -20,8 +20,7 @@ from decimal import Decimal -from weboob.capabilities.bank import Account, Investment -from weboob.capabilities.base import NotAvailable +from weboob.capabilities.bank import Investment from weboob.tools.browser import BasePage from weboob.tools.capabilities.bank.transactions import FrenchTransaction diff --git a/weboob/applications/qhandjoob/main_window.py b/weboob/applications/qhandjoob/main_window.py index 2f03beed..2e71779a 100644 --- a/weboob/applications/qhandjoob/main_window.py +++ b/weboob/applications/qhandjoob/main_window.py @@ -17,15 +17,12 @@ # You should have received a copy of the GNU Affero General Public License # along with weboob. If not, see . -from PyQt4.QtGui import QListWidgetItem, QImage, QPixmap, QLabel, QIcon, QBrush, QColor -from PyQt4.QtCore import SIGNAL, Qt +from PyQt4.QtGui import QListWidgetItem +from PyQt4.QtCore import SIGNAL -from decimal import Decimal - -from weboob.tools.application.qt import QtMainWindow, QtDo, HTMLDelegate +from weboob.tools.application.qt import QtMainWindow, QtDo from weboob.tools.application.qt.backendcfg import BackendCfg -from weboob.capabilities.job import ICapJob, BaseJobAdvert -from weboob.capabilities.base import NotLoaded, NotAvailable +from weboob.capabilities.job import ICapJob from .ui.main_window_ui import Ui_MainWindow @@ -86,7 +83,7 @@ class MainWindow(QtMainWindow): QtMainWindow.closeEvent(self, event) def backendsConfig(self): - bckndcfg = BackendCfg(self.weboob, (ICapJob,), self) + bckndcfg = BackendCfg(self.weboob, (ICapJob,), self) if bckndcfg.run(): pass