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:
parent
c21d1f7925
commit
7094931c92
231 changed files with 474 additions and 67 deletions
|
|
@ -33,6 +33,7 @@ IRC_NICKNAME = 'boobot'
|
||||||
IRC_SERVER = 'irc.freenode.org'
|
IRC_SERVER = 'irc.freenode.org'
|
||||||
STORAGE_FILE = 'boobot.storage'
|
STORAGE_FILE = 'boobot.storage'
|
||||||
|
|
||||||
|
|
||||||
class MyThread(Thread):
|
class MyThread(Thread):
|
||||||
def __init__(self, bot):
|
def __init__(self, bot):
|
||||||
Thread.__init__(self)
|
Thread.__init__(self)
|
||||||
|
|
@ -50,9 +51,9 @@ class MyThread(Thread):
|
||||||
self.weboob.loop()
|
self.weboob.loop()
|
||||||
|
|
||||||
def find_keywords(self, text):
|
def find_keywords(self, text):
|
||||||
for word in ['weboob', 'videoob', 'havesex', 'havedate', 'monboob', 'boobmsg', \
|
for word in ['weboob', 'videoob', 'havesex', 'havedate', 'monboob', 'boobmsg',
|
||||||
'flatboob', 'boobill', 'pastoob', 'radioob', 'translaboob', 'traveloob', \
|
'flatboob', 'boobill', 'pastoob', 'radioob', 'translaboob', 'traveloob',
|
||||||
'boobathon', 'boobank', 'boobtracker', 'comparoob', 'wetboobs', \
|
'boobathon', 'boobank', 'boobtracker', 'comparoob', 'wetboobs',
|
||||||
'webcontentedit', 'weboorrents', 'capabilit', u'sàt', u'salut à toi']:
|
'webcontentedit', 'weboorrents', 'capabilit', u'sàt', u'salut à toi']:
|
||||||
if word in text.lower():
|
if word in text.lower():
|
||||||
return word
|
return word
|
||||||
|
|
@ -80,6 +81,7 @@ class MyThread(Thread):
|
||||||
def stop(self):
|
def stop(self):
|
||||||
self.weboob.want_stop()
|
self.weboob.want_stop()
|
||||||
|
|
||||||
|
|
||||||
class TestBot(SingleServerIRCBot):
|
class TestBot(SingleServerIRCBot):
|
||||||
def __init__(self, channel, nickname, server, port=6667):
|
def __init__(self, channel, nickname, server, port=6667):
|
||||||
SingleServerIRCBot.__init__(self, [(server, port)], nickname, nickname + "`")
|
SingleServerIRCBot.__init__(self, [(server, port)], nickname, nickname + "`")
|
||||||
|
|
@ -121,6 +123,7 @@ class TestBot(SingleServerIRCBot):
|
||||||
if h:
|
if h:
|
||||||
self.send_message(u'Housing: %s (%sm² / %s%s)' % (h.title, h.area, h.cost, h.currency))
|
self.send_message(u'Housing: %s (%sm² / %s%s)' % (h.title, h.area, h.cost, h.currency))
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
logging.basicConfig(level=logging.DEBUG)
|
logging.basicConfig(level=logging.DEBUG)
|
||||||
bot = TestBot(IRC_CHANNEL, IRC_NICKNAME, IRC_SERVER)
|
bot = TestBot(IRC_CHANNEL, IRC_NICKNAME, IRC_SERVER)
|
||||||
|
|
|
||||||
|
|
@ -39,14 +39,18 @@ if sys.stdout.encoding is None:
|
||||||
|
|
||||||
# end of hack
|
# end of hack
|
||||||
|
|
||||||
|
|
||||||
def removeNonAscii(s): return "".join(i for i in s if ord(i)<128)
|
def removeNonAscii(s): return "".join(i for i in s if ord(i)<128)
|
||||||
|
|
||||||
rx = re.compile(u'[ \\/\\?\\:\\>\\<\\!\\\\\\*]+', re.UNICODE)
|
rx = re.compile(u'[ \\/\\?\\:\\>\\<\\!\\\\\\*]+', re.UNICODE)
|
||||||
|
|
||||||
|
|
||||||
def removeSpecial(s):
|
def removeSpecial(s):
|
||||||
return rx.sub(u' ', u'%s' % s)
|
return rx.sub(u' ', u'%s' % s)
|
||||||
|
|
||||||
DOWNLOAD_DIRECTORY=".files"
|
DOWNLOAD_DIRECTORY=".files"
|
||||||
|
|
||||||
|
|
||||||
class Downloadboob:
|
class Downloadboob:
|
||||||
|
|
||||||
def __init__(self, backend_name, download_directory, links_directory):
|
def __init__(self, backend_name, download_directory, links_directory):
|
||||||
|
|
|
||||||
|
|
@ -100,7 +100,7 @@ class VideoobWeb(BaseApplication):
|
||||||
page_url=video.page_url,
|
page_url=video.page_url,
|
||||||
url=video.url if video.url else '/download?id=%s' % video.id,
|
url=video.url if video.url else '/download?id=%s' % video.id,
|
||||||
thumbnail_url=video.thumbnail.url,
|
thumbnail_url=video.thumbnail.url,
|
||||||
) \
|
)
|
||||||
for video in backend.search_videos(pattern=q, nsfw=nsfw)]
|
for video in backend.search_videos(pattern=q, nsfw=nsfw)]
|
||||||
if videos:
|
if videos:
|
||||||
if merge:
|
if merge:
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ from __future__ import with_statement
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
|
||||||
def genapi():
|
def genapi():
|
||||||
os.system('rm -rf api')
|
os.system('rm -rf api')
|
||||||
os.system('mkdir api')
|
os.system('mkdir api')
|
||||||
|
|
|
||||||
|
|
@ -75,6 +75,7 @@ class IndexPage(BasePage):
|
||||||
|
|
||||||
yield video
|
yield video
|
||||||
|
|
||||||
|
|
||||||
class VideoPage(BasePage):
|
class VideoPage(BasePage):
|
||||||
def get_video(self, video=None, lang='fr', quality='hd'):
|
def get_video(self, video=None, lang='fr', quality='hd'):
|
||||||
if not video:
|
if not video:
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,7 @@ class SubtitlesPage(BasePage):
|
||||||
traduced_title_words = traduced_title.split()
|
traduced_title_words = traduced_title.split()
|
||||||
original_title_words = original_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
|
# intersection between pattern and the title is at least 2 words
|
||||||
if (len(pattern_words) == 1 and pattern in traduced_title_words) or\
|
if (len(pattern_words) == 1 and pattern in traduced_title_words) or\
|
||||||
(len(pattern_words) == 1 and pattern in original_title_words) or\
|
(len(pattern_words) == 1 and pattern in original_title_words) or\
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ from weboob.tools.test import BackendTest
|
||||||
import urllib
|
import urllib
|
||||||
from random import choice
|
from random import choice
|
||||||
|
|
||||||
|
|
||||||
class AttilasubTest(BackendTest):
|
class AttilasubTest(BackendTest):
|
||||||
BACKEND = 'attilasub'
|
BACKEND = 'attilasub'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,7 @@ def parse_dt(s):
|
||||||
d = _parse_dt(s)
|
d = _parse_dt(s)
|
||||||
return local2utc(d)
|
return local2utc(d)
|
||||||
|
|
||||||
|
|
||||||
class AuMBackend(BaseBackend, ICapMessages, ICapMessagesPost, ICapDating, ICapChat, ICapContact, ICapAccount):
|
class AuMBackend(BaseBackend, ICapMessages, ICapMessagesPost, ICapDating, ICapChat, ICapContact, ICapAccount):
|
||||||
NAME = 'aum'
|
NAME = 'aum'
|
||||||
MAINTAINER = u'Romain Bignon'
|
MAINTAINER = u'Romain Bignon'
|
||||||
|
|
@ -503,6 +504,7 @@ class AuMBackend(BaseBackend, ICapMessages, ICapMessagesPost, ICapDating, ICapCh
|
||||||
browser = None
|
browser = None
|
||||||
|
|
||||||
REGISTER_REGEXP = re.compile('.*http://www.adopteunmec.com/register4.php\?([^\' ]*)\'')
|
REGISTER_REGEXP = re.compile('.*http://www.adopteunmec.com/register4.php\?([^\' ]*)\'')
|
||||||
|
|
||||||
def confirm_account(self, mail):
|
def confirm_account(self, mail):
|
||||||
msg = email.message_from_string(mail)
|
msg = email.message_from_string(mail)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -64,6 +64,7 @@ class AuMException(UserError):
|
||||||
Exception.__init__(self, self.ERRORS.get(code, code))
|
Exception.__init__(self, self.ERRORS.get(code, code))
|
||||||
self.code = code
|
self.code = code
|
||||||
|
|
||||||
|
|
||||||
class AuMBrowser(BaseBrowser):
|
class AuMBrowser(BaseBrowser):
|
||||||
DOMAIN = 'www.adopteunmec.com'
|
DOMAIN = 'www.adopteunmec.com'
|
||||||
APIKEY = 'fb0123456789abcd'
|
APIKEY = 'fb0123456789abcd'
|
||||||
|
|
|
||||||
|
|
@ -26,8 +26,10 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
raise ImportError('Please install python-imaging')
|
raise ImportError('Please install python-imaging')
|
||||||
|
|
||||||
|
|
||||||
class CaptchaError(Exception): pass
|
class CaptchaError(Exception): pass
|
||||||
|
|
||||||
|
|
||||||
class Tile(object):
|
class Tile(object):
|
||||||
hash = {
|
hash = {
|
||||||
'bc8d52d96058478a6def26226145d53b': 'A',
|
'bc8d52d96058478a6def26226145d53b': 'A',
|
||||||
|
|
@ -115,6 +117,7 @@ class Tile(object):
|
||||||
print 'hash: %s' % checksum
|
print 'hash: %s' % checksum
|
||||||
raise CaptchaError()
|
raise CaptchaError()
|
||||||
|
|
||||||
|
|
||||||
class Captcha(object):
|
class Captcha(object):
|
||||||
def __init__(self, f):
|
def __init__(self, f):
|
||||||
self.img = Image.open(f)
|
self.img = Image.open(f)
|
||||||
|
|
@ -156,6 +159,7 @@ class Captcha(object):
|
||||||
s += tile.letter
|
s += tile.letter
|
||||||
return s
|
return s
|
||||||
|
|
||||||
|
|
||||||
class Decoder(object):
|
class Decoder(object):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.hash = {}
|
self.hash = {}
|
||||||
|
|
|
||||||
|
|
@ -140,6 +140,7 @@ class FieldConst(FieldBase):
|
||||||
labels.append(consts[self.key][i])
|
labels.append(consts[self.key][i])
|
||||||
return labels
|
return labels
|
||||||
|
|
||||||
|
|
||||||
class Contact(_Contact):
|
class Contact(_Contact):
|
||||||
TABLE = OrderedDict((
|
TABLE = OrderedDict((
|
||||||
('_info', OrderedDict((
|
('_info', OrderedDict((
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,7 @@ class UnavailablePage(BasePage):
|
||||||
def on_loaded(self):
|
def on_loaded(self):
|
||||||
raise BrowserUnavailable()
|
raise BrowserUnavailable()
|
||||||
|
|
||||||
|
|
||||||
class VirtKeyboard(MappedVirtKeyboard):
|
class VirtKeyboard(MappedVirtKeyboard):
|
||||||
symbols={'0':'f47e48cfdf3abc6716a6b0aadf8eebe3',
|
symbols={'0':'f47e48cfdf3abc6716a6b0aadf8eebe3',
|
||||||
'1':'3495abaf658dc550e51c5c92ea56b60b',
|
'1':'3495abaf658dc550e51c5c92ea56b60b',
|
||||||
|
|
@ -148,6 +149,7 @@ class AccountsPage(BasePage):
|
||||||
account._args = args
|
account._args = args
|
||||||
yield account
|
yield account
|
||||||
|
|
||||||
|
|
||||||
class Transaction(FrenchTransaction):
|
class Transaction(FrenchTransaction):
|
||||||
PATTERNS = [(re.compile('^RET(RAIT) DAB (?P<dd>\d{2})/(?P<mm>\d{2}) (?P<text>.*)'),
|
PATTERNS = [(re.compile('^RET(RAIT) DAB (?P<dd>\d{2})/(?P<mm>\d{2}) (?P<text>.*)'),
|
||||||
FrenchTransaction.TYPE_WITHDRAWAL),
|
FrenchTransaction.TYPE_WITHDRAWAL),
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
from weboob.tools.test import BackendTest
|
from weboob.tools.test import BackendTest
|
||||||
|
|
||||||
|
|
||||||
class AXABanqueTest(BackendTest):
|
class AXABanqueTest(BackendTest):
|
||||||
BACKEND = 'axabanque'
|
BACKEND = 'axabanque'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -39,6 +39,7 @@ class UnavailablePage(BasePage):
|
||||||
else:
|
else:
|
||||||
self.browser.location(a.attrib['href'])
|
self.browser.location(a.attrib['href'])
|
||||||
|
|
||||||
|
|
||||||
class LoginPage(BasePage):
|
class LoginPage(BasePage):
|
||||||
def login(self, login, passwd):
|
def login(self, login, passwd):
|
||||||
self.browser.select_form(name='Login')
|
self.browser.select_form(name='Login')
|
||||||
|
|
@ -46,6 +47,7 @@ class LoginPage(BasePage):
|
||||||
self.browser['IDToken2'] = passwd.encode(self.browser.ENCODING)
|
self.browser['IDToken2'] = passwd.encode(self.browser.ENCODING)
|
||||||
self.browser.submit(nologin=True)
|
self.browser.submit(nologin=True)
|
||||||
|
|
||||||
|
|
||||||
class IndexPage(BasePage):
|
class IndexPage(BasePage):
|
||||||
def get_token(self):
|
def get_token(self):
|
||||||
url = self.document.getroot().xpath('//frame[@name="portalHeader"]')[0].attrib['src']
|
url = self.document.getroot().xpath('//frame[@name="portalHeader"]')[0].attrib['src']
|
||||||
|
|
@ -53,6 +55,7 @@ class IndexPage(BasePage):
|
||||||
args = dict(parse_qsl(v.query))
|
args = dict(parse_qsl(v.query))
|
||||||
return args['token']
|
return args['token']
|
||||||
|
|
||||||
|
|
||||||
class AccountsPage(BasePage):
|
class AccountsPage(BasePage):
|
||||||
ACCOUNT_TYPES = {u'Mes comptes d\'épargne': Account.TYPE_SAVINGS,
|
ACCOUNT_TYPES = {u'Mes comptes d\'épargne': Account.TYPE_SAVINGS,
|
||||||
u'Mes comptes': Account.TYPE_CHECKING,
|
u'Mes comptes': Account.TYPE_CHECKING,
|
||||||
|
|
@ -101,6 +104,7 @@ class AccountsPage(BasePage):
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
class Transaction(FrenchTransaction):
|
class Transaction(FrenchTransaction):
|
||||||
PATTERNS = [(re.compile('^RET DAB (?P<text>.*?) RETRAIT (DU|LE) (?P<dd>\d{2})(?P<mm>\d{2})(?P<yy>\d+).*'),
|
PATTERNS = [(re.compile('^RET DAB (?P<text>.*?) RETRAIT (DU|LE) (?P<dd>\d{2})(?P<mm>\d{2})(?P<yy>\d+).*'),
|
||||||
FrenchTransaction.TYPE_WITHDRAWAL),
|
FrenchTransaction.TYPE_WITHDRAWAL),
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
from weboob.tools.test import BackendTest
|
from weboob.tools.test import BackendTest
|
||||||
|
|
||||||
|
|
||||||
class BanquePopulaireTest(BackendTest):
|
class BanquePopulaireTest(BackendTest):
|
||||||
BACKEND = 'banquepopulaire'
|
BACKEND = 'banquepopulaire'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,7 @@ class LoginPage(BasePage):
|
||||||
else:
|
else:
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
class Login2Page(BasePage):
|
class Login2Page(BasePage):
|
||||||
def login(self, secret):
|
def login(self, secret):
|
||||||
label = self.document.xpath('//span[@class="PF_LABEL"]')[0].text.strip()
|
label = self.document.xpath('//span[@class="PF_LABEL"]')[0].text.strip()
|
||||||
|
|
@ -55,9 +56,11 @@ class Login2Page(BasePage):
|
||||||
self.browser['word'] = letters
|
self.browser['word'] = letters
|
||||||
self.browser.submit(name='valider', nologin=True)
|
self.browser.submit(name='valider', nologin=True)
|
||||||
|
|
||||||
|
|
||||||
class IndexPage(BasePage):
|
class IndexPage(BasePage):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class AccountsPage(BasePage):
|
class AccountsPage(BasePage):
|
||||||
ACCOUNT_TYPES = {u'Epargne': Account.TYPE_SAVINGS,
|
ACCOUNT_TYPES = {u'Epargne': Account.TYPE_SAVINGS,
|
||||||
u'Liquidités': Account.TYPE_CHECKING,
|
u'Liquidités': Account.TYPE_CHECKING,
|
||||||
|
|
@ -170,11 +173,13 @@ class Transaction(FrenchTransaction):
|
||||||
FrenchTransaction.TYPE_UNKNOWN),
|
FrenchTransaction.TYPE_UNKNOWN),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
class HistoryBasePage(BasePage):
|
class HistoryBasePage(BasePage):
|
||||||
def get_history(self):
|
def get_history(self):
|
||||||
self.logger.warning('Do not support account of type %s' % type(self).__name__)
|
self.logger.warning('Do not support account of type %s' % type(self).__name__)
|
||||||
return iter([])
|
return iter([])
|
||||||
|
|
||||||
|
|
||||||
class TransactionsPage(HistoryBasePage):
|
class TransactionsPage(HistoryBasePage):
|
||||||
def get_history(self):
|
def get_history(self):
|
||||||
for tr in self.document.xpath('//table[@id="operation"]/tbody/tr'):
|
for tr in self.document.xpath('//table[@id="operation"]/tbody/tr'):
|
||||||
|
|
@ -229,11 +234,14 @@ class CardPage(HistoryBasePage):
|
||||||
t.set_amount(amount)
|
t.set_amount(amount)
|
||||||
yield t
|
yield t
|
||||||
|
|
||||||
|
|
||||||
class ValuationPage(HistoryBasePage):
|
class ValuationPage(HistoryBasePage):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class LoanPage(HistoryBasePage):
|
class LoanPage(HistoryBasePage):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class MarketPage(HistoryBasePage):
|
class MarketPage(HistoryBasePage):
|
||||||
pass
|
pass
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
from weboob.tools.test import BackendTest
|
from weboob.tools.test import BackendTest
|
||||||
|
|
||||||
|
|
||||||
class BarclaysTest(BackendTest):
|
class BarclaysTest(BackendTest):
|
||||||
BACKEND = 'barclays'
|
BACKEND = 'barclays'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@ from weboob.tools.captcha.virtkeyboard import MappedVirtKeyboard,VirtKeyboardErr
|
||||||
|
|
||||||
__all__ = ['LoginPage', 'ConfirmPage', 'ChangePasswordPage']
|
__all__ = ['LoginPage', 'ConfirmPage', 'ChangePasswordPage']
|
||||||
|
|
||||||
|
|
||||||
class BNPVirtKeyboard(MappedVirtKeyboard):
|
class BNPVirtKeyboard(MappedVirtKeyboard):
|
||||||
symbols={'0':'9cc4789a2cb223e8f2d5e676e90264b5',
|
symbols={'0':'9cc4789a2cb223e8f2d5e676e90264b5',
|
||||||
'1':'e10b58fc085f9683052d5a63c96fc912',
|
'1':'e10b58fc085f9683052d5a63c96fc912',
|
||||||
|
|
@ -100,10 +101,12 @@ class ConfirmPage(BasePage):
|
||||||
if m:
|
if m:
|
||||||
return m.group(1)
|
return m.group(1)
|
||||||
|
|
||||||
|
|
||||||
class InfoMessagePage(BasePage):
|
class InfoMessagePage(BasePage):
|
||||||
def on_loaded(self):
|
def on_loaded(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class ChangePasswordPage(BasePage):
|
class ChangePasswordPage(BasePage):
|
||||||
def change_password(self, current, new):
|
def change_password(self, current, new):
|
||||||
try:
|
try:
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,7 @@ class Transaction(FrenchTransaction):
|
||||||
(re.compile('^(?P<category>REMISE CHEQUES)(?P<text>.*)'), FrenchTransaction.TYPE_DEPOSIT),
|
(re.compile('^(?P<category>REMISE CHEQUES)(?P<text>.*)'), FrenchTransaction.TYPE_DEPOSIT),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
class AccountHistory(BasePage):
|
class AccountHistory(BasePage):
|
||||||
def iter_operations(self):
|
def iter_operations(self):
|
||||||
for tr in self.document.xpath('//table[@id="tableCompte"]//tr'):
|
for tr in self.document.xpath('//table[@id="tableCompte"]//tr'):
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@ class Account(object):
|
||||||
self.send_checkbox = send_checkbox
|
self.send_checkbox = send_checkbox
|
||||||
self.receive_checkbox = receive_checkbox
|
self.receive_checkbox = receive_checkbox
|
||||||
|
|
||||||
|
|
||||||
class TransferPage(BasePage):
|
class TransferPage(BasePage):
|
||||||
def on_loaded(self):
|
def on_loaded(self):
|
||||||
for td in self.document.xpath('//td[@class="hdvon1"]'):
|
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
Loading…
Reference in a new issue