Easy spacing fixes, trailing stuff

Remove useless trailing \
Remove trailing spaces
Add missing empty lines

autopep8 -ir -j2 --select=E301,E302,E502,W291,W293,W391 .

Diff quickly checked.
This commit is contained in:
Laurent Bachelier 2013-03-15 20:01:49 +01:00
commit 7094931c92
231 changed files with 474 additions and 67 deletions

View file

@ -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)

View file

@ -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):

View file

@ -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:

View file

@ -4,6 +4,7 @@ from __future__ import with_statement
import os
def genapi():
os.system('rm -rf api')
os.system('mkdir api')

View file

@ -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:

View file

@ -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\

View file

@ -22,6 +22,7 @@ from weboob.tools.test import BackendTest
import urllib
from random import choice
class AttilasubTest(BackendTest):
BACKEND = 'attilasub'

View file

@ -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)

View file

@ -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'

View file

@ -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 = {}

View file

@ -140,6 +140,7 @@ class FieldConst(FieldBase):
labels.append(consts[self.key][i])
return labels
class Contact(_Contact):
TABLE = OrderedDict((
('_info', OrderedDict((

View file

@ -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<dd>\d{2})/(?P<mm>\d{2}) (?P<text>.*)'),
FrenchTransaction.TYPE_WITHDRAWAL),

View file

@ -20,6 +20,7 @@
from weboob.tools.test import BackendTest
class AXABanqueTest(BackendTest):
BACKEND = 'axabanque'

View file

@ -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<text>.*?) RETRAIT (DU|LE) (?P<dd>\d{2})(?P<mm>\d{2})(?P<yy>\d+).*'),
FrenchTransaction.TYPE_WITHDRAWAL),

View file

@ -20,6 +20,7 @@
from weboob.tools.test import BackendTest
class BanquePopulaireTest(BackendTest):
BACKEND = 'banquepopulaire'

View file

@ -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

View file

@ -20,6 +20,7 @@
from weboob.tools.test import BackendTest
class BarclaysTest(BackendTest):
BACKEND = 'barclays'

View file

@ -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:

View file

@ -44,6 +44,7 @@ class Transaction(FrenchTransaction):
(re.compile('^(?P<category>REMISE CHEQUES)(?P<text>.*)'), FrenchTransaction.TYPE_DEPOSIT),
]
class AccountHistory(BasePage):
def iter_operations(self):
for tr in self.document.xpath('//table[@id="tableCompte"]//tr'):

View file

@ -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"]'):

Some files were not shown because too many files have changed in this diff Show more