Code clarity fixes

autopep8 -ir -j2 --select=E303,E125
Diff checked manually.
This commit is contained in:
Laurent Bachelier 2013-03-15 19:54:17 +01:00
commit c21d1f7925
37 changed files with 6 additions and 59 deletions

View file

@ -61,7 +61,6 @@ class BNPVirtKeyboard(MappedVirtKeyboard):
return code
class LoginPage(BasePage):
def on_loaded(self):
for td in self.document.getroot().cssselect('td.LibelleErreur'):
@ -128,7 +127,6 @@ class ChangePasswordPage(BasePage):
cookiejar.set_cookie(c)
code_current=vk.get_string_code(current)
code_new=vk.get_string_code(new)

View file

@ -27,7 +27,6 @@ from weboob.tools.browser import BasePage
from weboob.tools.capabilities.bank.transactions import FrenchTransaction
__all__ = ['AccountHistory']
class Transaction(FrenchTransaction):

View file

@ -45,7 +45,6 @@ from hellhttp import HellHTTPS
__all__ = ['CmbBackend']
class CmbBackend(BaseBackend, ICapBank):
NAME = 'cmb'
MAINTAINER = u'Johann Broudin'
@ -98,8 +97,6 @@ class CmbBackend(BaseBackend, ICapBank):
)
]
cookie = None
headers = {
'User-Agent':
@ -197,7 +194,6 @@ class CmbBackend(BaseBackend, ICapBank):
account._cmbvaleur2 = m.group(2)
account._cmbtype = m.group(3)
balance = u''.join([txt.strip() for txt in td[2].itertext()])
balance = balance.replace(',', '.').replace(u"\xa0", '')
account.balance = Decimal(balance)
@ -252,7 +248,6 @@ class CmbBackend(BaseBackend, ICapBank):
parser = etree.HTMLParser()
tree = etree.parse(StringIO(data), parser)
tables = tree.xpath('/html/body/table')
if len(tables) == 0:
title = tree.xpath('/html/head/title')[0].text
@ -275,7 +270,7 @@ class CmbBackend(BaseBackend, ICapBank):
continue
for tr in table.getiterator('tr'):
if (tr.get('class') != 'LnTit' and
tr.get('class') != 'LnTot'):
tr.get('class') != 'LnTot'):
operation = Transaction(i)
td = tr.xpath('td')

View file

@ -34,7 +34,6 @@ class HTTPSVerifiedConnection(httplib.HTTPSConnection):
This class allows communication via SSL, and will checks certificates
"""
def __init__(self, host, port=None, key_file=None, cert_file=None,
ca_file=None, strict=None, timeout=socket._GLOBAL_DEFAULT_TIMEOUT,
callBack=None):

View file

@ -159,7 +159,6 @@ class ComingTransactionsPage(BasePage):
else:
date += "/%d" % time.localtime().tm_year
t = Transaction(date+""+raw)
t.parse(date, re.sub(r'[ ]+', ' ', raw))
t.set_amount("", debit)

View file

@ -30,7 +30,6 @@ class StartPage(BasePage):
u"Niederschlag", u"Globalstrahlung", u"Schneehoehe"]
unit = [u"°C", u"km/h", u"hPa", u"%", u"mm", u"W/m²", u"cm"]
def get_sensors_list(self):
paraphs = self.document.xpath('//p[@align="center"]')
sensors = []

View file

@ -32,7 +32,6 @@ from weboob.tools.browser import BrokenPageError
from .video import EuroparlVideo
__all__ = ['VideoPage']
class VideoPage(BasePage):

View file

@ -35,8 +35,6 @@ from .video import GDCVaultVideo
#import lxml.etree
__all__ = ['VideoPage']
class VideoPage(BasePage):

View file

@ -48,7 +48,6 @@ class GoogleTranslateBackend(BaseBackend, ICapTranslate):
'Telugu':'te', 'Thai':'th', 'Turkish':'tr', 'Ukrainian':'uk', 'Urdu':'ur', 'Vietnamese':'vi', 'Welsh':'cy', 'Yiddish':'yi',
}
def translate(self, lan_from, lan_to, text):
if not lan_from in self.GOOGLELANGUAGE.keys():
raise LanguageNotSupported()

View file

@ -103,7 +103,6 @@ class LoginPage(BasePage):
err = self.document.find('//span[@class="error"]')
return err is not None
def login(self, password):
# 2) And now, the virtual Keyboard
try:

View file

@ -23,7 +23,6 @@ from .pages.inrockstv import InrocksTvPage
from weboob.tools.browser import BaseBrowser
class NewspaperInrocksBrowser(BaseBrowser):
"NewspaperInrocksBrowser class"
PAGES = {

View file

@ -55,7 +55,6 @@ class ResultsPage(BasePage):
yield recipe
class RecipePage(BasePage):
""" Page which contains a recipe
"""

View file

@ -37,7 +37,6 @@ class NewsfeedBackend(BaseBackend, ICapMessages):
CONFIG = BackendConfig(Value('url', label="Atom/RSS feed's url", regexp='https?://.*'))
STORAGE = {'seen': []}
def iter_threads(self):
for article in Newsfeed(self.config['url'].get()).iter_entries():
yield self.get_thread(article.id, article)
@ -75,15 +74,12 @@ class NewsfeedBackend(BaseBackend, ICapMessages):
flags=flags)
return thread
def iter_unread_messages(self):
for thread in self.iter_threads():
for m in thread.iter_all_messages():
if m.flags & m.IS_UNREAD:
yield m
def set_message_read(self, message):
self.storage.get('seen', default=[]).append(message.thread.id)
self.storage.save()

View file

@ -44,7 +44,6 @@ class OkCBrowser(BaseBrowser):
('http://%s/profile/[^/]*' % DOMAIN, ProfilePage),
))
logged_in = False
def home(self):

View file

@ -60,7 +60,7 @@ class AloesBrowser(BaseBrowser):
no_login=True)
if not self.page.login(self.username, self.password) or \
not self.is_logged() or \
(self.is_on_page(LoginPage) and self.page.is_error()):
(self.is_on_page(LoginPage) and self.page.is_error()):
raise BrowserIncorrectPassword()
def get_rented_books_list(self):

View file

@ -101,7 +101,6 @@ class SubtitlesPage(BasePage):
return subtitle
class SubtitlePage(BasePage):
""" Page which contains a single subtitle for a movie
"""

View file

@ -36,7 +36,6 @@ class ParolesmaniaTest(BackendTest):
assert full_lyr.artist
assert full_lyr.content is not NotLoaded
def test_search_artist(self):
l_lyrics = list(self.backend.iter_lyrics('artist','boris'))
for songlyrics in l_lyrics:

View file

@ -36,7 +36,6 @@ class ParolesmusiqueTest(BackendTest):
assert full_lyr.artist
assert full_lyr.content is not NotLoaded
def test_search_artist(self):
l_lyrics = list(self.backend.iter_lyrics('artist','boris'))
for songlyrics in l_lyrics:

View file

@ -37,6 +37,5 @@ class WikiEditPage(BasePage):
return wiki_form.xpath('div/input')[0].get('value')
class WikiPage(BasePage):
pass

View file

@ -46,7 +46,7 @@ class SachsenLevelBackend(BaseBackend, ICapGauge):
lowpattern = pattern.lower()
for gauge in self.browser.get_rivers_list():
if lowpattern in gauge.name.lower()\
or lowpattern in gauge.object.lower():
or lowpattern in gauge.object.lower():
yield gauge
def _get_gauge_by_id(self, id):

View file

@ -36,7 +36,6 @@ class SeeklyricsTest(BackendTest):
assert full_lyr.artist
assert full_lyr.content is not NotLoaded
def test_search_artist(self):
l_lyrics = list(self.backend.iter_lyrics('artist','boris vian'))
for songlyrics in l_lyrics:

View file

@ -24,7 +24,6 @@ from weboob.capabilities.messages import CantSendMessage
from weboob.tools.browser import BasePage
__all__ = ['ClosePage', 'ComposePage', 'ConfirmPage', 'SentPage']

View file

@ -171,7 +171,6 @@ class AccountHistory(BasePage):
sign=p['sign'][0],
src=p['src'][0])
def _iter_transactions(self, doc, coming):
t = None
for i, tr in enumerate(self.parser.select(doc.getroot(), 'tr')):

View file

@ -38,7 +38,6 @@ from weboob.tools.browser import BrokenPageError
from .video import VimeoVideo
__all__ = ['VideoPage']
class VideoPage(BasePage):

View file

@ -23,7 +23,6 @@ from weboob.tools.test import BackendTest
class WeatherTest(BackendTest):
BACKEND = 'weather'
def test_cities(self):
paris = self.backend.iter_city_search('crappything&param=;drop database')
self.assertTrue(len(list(paris)) == 0)