Code style fixes, mostly whitespace

This commit is contained in:
Laurent Bachelier 2013-08-04 20:00:19 +02:00
commit 23a71d847b
12 changed files with 84 additions and 73 deletions

View file

@ -32,6 +32,7 @@ from .collection import ArteLiveCollection
__all__ = ['IndexPage', 'VideoPage', 'ArteLivePage', 'ArteLiveCategorieVideoPage', 'ArteLiveVideoPage']
class ArteLiveVideoPage(BasePage):
def get_video(self, video=None, lang='fr', quality='hd'):
if not video:
@ -48,6 +49,7 @@ class ArteLiveVideoPage(BasePage):
video.url = urls.popitem()[1]
return video
class ArteLiveCategorieVideoPage(BasePage):
def iter_videos(self, lang='fr'):
videos = list()
@ -98,8 +100,8 @@ class ArteLiveCategorieVideoPage(BasePage):
ele['date'] = "No date"
try:
s = (pt.search(chain).group(0))
s = HTMLParser.HTMLParser().unescape(s);
ele['pitch'] = HTMLParser.HTMLParser().unescape(s);
s = HTMLParser.HTMLParser().unescape(s)
ele['pitch'] = HTMLParser.HTMLParser().unescape(s)
except:
ele['pitch'] = "No description"
try:
@ -113,6 +115,7 @@ class ArteLiveCategorieVideoPage(BasePage):
ele['pict'] = None
return ele
class ArteLivePage(BasePage):
def iter_resources(self):
items = list()
@ -125,6 +128,7 @@ class ArteLivePage(BasePage):
items.append(item)
return items
class IndexPage(BasePage):
def iter_videos(self):
videos = self.document.getroot().cssselect("div[class=video]")

View file

@ -54,6 +54,7 @@ class WikipediaARC4(object):
output[i] = chr((ord(input[i]) ^ self.state[(self.state[self.x] + self.state[self.y]) & 0xFF]))
return ''.join(output)
class RedirectPage(BasePage):
"""
var i = 'lyhrnu551jo42yfzx0jm0sqk';
@ -129,6 +130,7 @@ class RedirectPage(BasePage):
if redirect_url is not None:
self.browser.location(self.browser.request_class(self.browser.absurl(redirect_url), None, {'Referer': self.url}))
class UnavailablePage(BasePage):
def on_loaded(self):
try:
@ -290,6 +292,7 @@ class TransactionsPage(BasePage):
COL_VALUE_DATE = 4
COL_DEBIT = -2
COL_CREDIT = -1
def get_history(self):
for tr in self.document.xpath('//table[@id="tbl1"]/tbody/tr'):
tds = tr.findall('td')

View file

@ -48,8 +48,8 @@ class Boursorama(BaseBrowser):
'.*/date_anniversaire.phtml.*': UpdateInfoPage,
}
def __init__(self, device="weboob", enable_twofactors=False
, *args, **kwargs):
def __init__(self, device="weboob", enable_twofactors=False,
*args, **kwargs):
self.device = device
self.enable_twofactors = enable_twofactors
BaseBrowser.__init__(self, *args, **kwargs)
@ -69,7 +69,7 @@ class Boursorama(BaseBrowser):
self.page.authenticate(self.device)
else:
raise BrowserIncorrectAuthenticationCode(
"""Boursorama - activate the two factor authentication in boursorama config."""\
"""Boursorama - activate the two factor authentication in boursorama config."""
""" You will receive SMS code but are limited in request per day (around 15)"""
)

View file

@ -125,6 +125,3 @@ class AuthenticationPage(BasePage):
def print_cookies(self):
for c in self.browser._ua_handlers["_cookies"].cookiejar:
print "%s : %s" % (c.name, c.value)

View file

@ -128,6 +128,7 @@ class ProAccountsPage(AccountsPage):
COL_BALANCE = 1
ARGS = ['Banque', 'Agence', 'classement', 'Serie', 'SSCompte', 'Devise', 'CodeDeviseCCB', 'LibelleCompte', 'IntituleCompte', 'Indiceclassement', 'IndiceCompte', 'NomClassement']
def params_from_js(self, text):
l = []
for sub in re.findall("'([^']*)'", text):
@ -141,7 +142,6 @@ class ProAccountsPage(AccountsPage):
return url, args
def get_list(self):
for tr in self.document.xpath('//table[@class="datas"]//tr'):
if tr.attrib.get('class', '') == 'entete':
@ -255,6 +255,7 @@ class TransactionsPage(CDNBasePage):
yield t
class ProTransactionsPage(TransactionsPage):
def get_next_args(self, args):
txt = self.get_from_js('myPage.setPiedPage(oNavSuivantPrec_1(', ')')

View file

@ -42,7 +42,6 @@ class HelloBankVirtKeyboard(VirtKeyboard):
'9': '040954a5e5e93ec2fb03ac0cfe592ac2'
}
url = "/NSImgBDGrille?timestamp=%d"
color = 17
@ -114,4 +113,3 @@ class ConfirmPage(BasePage):
class InfoMessagePage(BasePage):
def on_loaded(self):
pass

View file

@ -115,6 +115,7 @@ class TransferFormatter(IFormatter):
result += u'Reason: %s\n' % obj.reason
return result
class InvestmentFormatter(IFormatter):
MANDATORY_FIELDS = ('label', 'quantity', 'unitvalue')
@ -145,7 +146,7 @@ class InvestmentFormatter(IFormatter):
def flush(self):
self.output('-------------------------------+--------+----------+-----------+-----------+--------')
self.output(u' Total %s %s' %\
self.output(u' Total %s %s' %
(self.colored('%8.2f' % self.tot_valuation, 'yellow'),
self.colored('%8.2f' % self.tot_diff, 'green' if self.tot_diff >=0 else 'red')
))

View file

@ -17,7 +17,9 @@
# You should have received a copy of the GNU Affero General Public License
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
import urllib, sys, codecs
import urllib
import sys
import codecs
from PyQt4.QtCore import Qt, SIGNAL
from PyQt4.QtGui import QFrame, QImage, QPixmap, QFileDialog

View file

@ -26,6 +26,7 @@ from weboob.capabilities.job import ICapJob
from .ui.main_window_ui import Ui_MainWindow
class JobListWidgetItem(QListWidgetItem):
def __init__(self, job, *args, **kwargs):
QListWidgetItem.__init__(self, *args, **kwargs)
@ -38,6 +39,7 @@ class JobListWidgetItem(QListWidgetItem):
text = u'%s - %s' % (self.job.backend, self.job.title)
self.setText(text)
class MainWindow(QtMainWindow):
def __init__(self, config, storage, weboob, parent=None):
QtMainWindow.__init__(self, parent)
@ -129,4 +131,3 @@ class MainWindow(QtMainWindow):
self.ui.jobFrame.show()
else:
self.ui.jobFrame.hide()

View file

@ -18,7 +18,6 @@
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
import sys
from weboob.capabilities.torrent import ICapTorrent, MagnetOnly
@ -71,6 +70,7 @@ class TorrentListFormatter(PrettyFormatter):
(5, 'green', None),
(10, 'green', 'bold'),
)
def _get_color(self, nb):
if empty(nb):
return self.colored('N/A', 'red')

View file

@ -19,8 +19,12 @@
from .base import IBaseCap, CapBaseObject, StringField, IntField, Field, empty
import lxml.etree as ET
import base64, re, urllib
import base64
import re
import urllib
__all__ = ['Recipe', 'ICapRecipe']
@ -42,6 +46,7 @@ class Comment():
result += 'comment: %s' % self.text
return result
class Recipe(CapBaseObject):
"""
Recipe object.

View file

@ -18,8 +18,6 @@
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
import os
import shutil
@ -39,6 +37,7 @@ __all__ = ['Weboob']
class VersionsMismatchError(ConfigError):
pass
class Weboob(object):
"""
The main class of Weboob, used to manage backends and call methods.