pep8 blank lines fixes
flake8 --select W391,E302,E301,E304 autopep8 can't fix W391 even though it claims it can. Fixed using a simple custom script.
This commit is contained in:
parent
be2c8bd789
commit
448c06d125
142 changed files with 249 additions and 25 deletions
|
|
@ -28,6 +28,7 @@ from weboob.core import Weboob, CallErrors
|
|||
from weboob.capabilities.bank import CapBank
|
||||
from weboob.exceptions import BrowserIncorrectPassword
|
||||
|
||||
|
||||
class BoobankMuninPlugin(object):
|
||||
def __init__(self):
|
||||
if 'weboob_path' in os.environ:
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ import os
|
|||
# bpp: bits per pixel, could *only* be 24 or 32!
|
||||
# return: an "array" of BYTES which, if write to file, is a size*size ico file
|
||||
|
||||
|
||||
def genico(data, size=16, bpp=24):
|
||||
from array import array
|
||||
a = array('B')
|
||||
|
|
@ -80,7 +81,6 @@ def genico(data, size=16, bpp=24):
|
|||
return a
|
||||
|
||||
|
||||
|
||||
# x,y indicate the hotspot position
|
||||
# simply set the type/hotspot(x&y) after generates the icon
|
||||
def gencur(data, size=16, bpp=24, x=0, y=0):
|
||||
|
|
@ -89,7 +89,6 @@ def gencur(data, size=16, bpp=24, x=0, y=0):
|
|||
return a
|
||||
|
||||
|
||||
|
||||
#C:\Python27\Lib\site-packages\weboob-0.g-py2.7.egg\share\icons\hicolor\64x64\apps
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
|
|||
|
|
@ -32,12 +32,15 @@ except ImportError:
|
|||
DEFAULT_VERSION = "1.1.6"
|
||||
DEFAULT_URL = "https://pypi.python.org/packages/source/s/setuptools/"
|
||||
|
||||
|
||||
def _python_cmd(*args):
|
||||
args = (sys.executable,) + args
|
||||
return subprocess.call(args) == 0
|
||||
|
||||
|
||||
def _check_call_py24(cmd, *args, **kwargs):
|
||||
res = subprocess.call(cmd, *args, **kwargs)
|
||||
|
||||
class CalledProcessError(Exception):
|
||||
pass
|
||||
if not res == 0:
|
||||
|
|
@ -45,6 +48,7 @@ def _check_call_py24(cmd, *args, **kwargs):
|
|||
raise CalledProcessError(msg)
|
||||
vars(subprocess).setdefault('check_call', _check_call_py24)
|
||||
|
||||
|
||||
def _install(tarball, install_args=()):
|
||||
# extracting the tarball
|
||||
tmpdir = tempfile.mkdtemp()
|
||||
|
|
@ -151,6 +155,7 @@ def use_setuptools(version=DEFAULT_VERSION, download_base=DEFAULT_URL,
|
|||
return _do_download(version, download_base, to_dir,
|
||||
download_delay)
|
||||
|
||||
|
||||
def download_file_powershell(url, target):
|
||||
"""
|
||||
Download the file at url to target using Powershell (which will validate
|
||||
|
|
@ -164,6 +169,7 @@ def download_file_powershell(url, target):
|
|||
]
|
||||
subprocess.check_call(cmd)
|
||||
|
||||
|
||||
def has_powershell():
|
||||
if platform.system() != 'Windows':
|
||||
return False
|
||||
|
|
@ -180,10 +186,12 @@ def has_powershell():
|
|||
|
||||
download_file_powershell.viable = has_powershell
|
||||
|
||||
|
||||
def download_file_curl(url, target):
|
||||
cmd = ['curl', url, '--silent', '--output', target]
|
||||
subprocess.check_call(cmd)
|
||||
|
||||
|
||||
def has_curl():
|
||||
cmd = ['curl', '--version']
|
||||
devnull = open(os.path.devnull, 'wb')
|
||||
|
|
@ -198,10 +206,12 @@ def has_curl():
|
|||
|
||||
download_file_curl.viable = has_curl
|
||||
|
||||
|
||||
def download_file_wget(url, target):
|
||||
cmd = ['wget', url, '--quiet', '--output-document', target]
|
||||
subprocess.check_call(cmd)
|
||||
|
||||
|
||||
def has_wget():
|
||||
cmd = ['wget', '--version']
|
||||
devnull = open(os.path.devnull, 'wb')
|
||||
|
|
@ -216,6 +226,7 @@ def has_wget():
|
|||
|
||||
download_file_wget.viable = has_wget
|
||||
|
||||
|
||||
def download_file_insecure(url, target):
|
||||
"""
|
||||
Use Python to download the file, even though it cannot authenticate the
|
||||
|
|
@ -241,6 +252,7 @@ def download_file_insecure(url, target):
|
|||
|
||||
download_file_insecure.viable = lambda: True
|
||||
|
||||
|
||||
def get_best_downloader():
|
||||
downloaders = [
|
||||
download_file_powershell,
|
||||
|
|
@ -253,6 +265,7 @@ def get_best_downloader():
|
|||
if dl.viable():
|
||||
return dl
|
||||
|
||||
|
||||
def download_setuptools(version=DEFAULT_VERSION, download_base=DEFAULT_URL,
|
||||
to_dir=os.curdir, delay=15,
|
||||
downloader_factory=get_best_downloader):
|
||||
|
|
@ -338,6 +351,7 @@ def _build_install_args(options):
|
|||
install_args.append('--user')
|
||||
return install_args
|
||||
|
||||
|
||||
def _parse_args():
|
||||
"""
|
||||
Parse the command line for options
|
||||
|
|
@ -359,6 +373,7 @@ def _parse_args():
|
|||
# positional arguments are ignored
|
||||
return options
|
||||
|
||||
|
||||
def main(version=DEFAULT_VERSION):
|
||||
"""Install or upgrade setuptools and EasyInstall"""
|
||||
options = _parse_args()
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ from .browser import SevenFiftyGramsBrowser
|
|||
|
||||
import unicodedata
|
||||
|
||||
|
||||
def strip_accents(s):
|
||||
return ''.join(c for c in unicodedata.normalize('NFD', s) if unicodedata.category(c) != 'Mn')
|
||||
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ from weboob.deprecated.browser import Page
|
|||
class ResultsPage(Page):
|
||||
""" Page which contains results as a list of recipies
|
||||
"""
|
||||
|
||||
def iter_recipes(self):
|
||||
for div in self.parser.select(self.document.getroot(), 'div.recette_description > div.data'):
|
||||
links = self.parser.select(div, 'div.info > p.title > a.fn')
|
||||
|
|
@ -65,6 +66,7 @@ class ResultsPage(Page):
|
|||
class RecipePage(Page):
|
||||
""" Page which contains a recipe
|
||||
"""
|
||||
|
||||
def get_recipe(self, id):
|
||||
title = NotAvailable
|
||||
preparation_time = NotAvailable
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
from weboob.tools.test import BackendTest
|
||||
import re
|
||||
|
||||
|
||||
class AllocineTest(BackendTest):
|
||||
MODULE = 'allocine'
|
||||
|
||||
|
|
|
|||
|
|
@ -60,4 +60,3 @@ class AlloRestoModule(Module, CapBank):
|
|||
|
||||
def iter_coming(self, account):
|
||||
return self.browser.get_coming(account)
|
||||
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@ class AccountsPage(LoggedPage, HTMLPage):
|
|||
|
||||
class MyDate(Filter):
|
||||
MONTHS = ['janv', u'févr', u'mars', u'avr', u'mai', u'juin', u'juil', u'août', u'sept', u'oct', u'nov', u'déc']
|
||||
|
||||
def filter(self, txt):
|
||||
day, month, year = txt.split(' ')
|
||||
day = int(day)
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ class FourOFourPage(Page):
|
|||
class ResultsPage(Page):
|
||||
""" Page which contains results as a list of recipies
|
||||
"""
|
||||
|
||||
def iter_recipes(self):
|
||||
for div in self.parser.select(self.document.getroot(), 'div.recipe-info'):
|
||||
thumbnail_url = NotAvailable
|
||||
|
|
@ -59,6 +60,7 @@ class ResultsPage(Page):
|
|||
class RecipePage(Page):
|
||||
""" Page which contains a recipe
|
||||
"""
|
||||
|
||||
def get_recipe(self, id):
|
||||
title = NotAvailable
|
||||
preparation_time = NotAvailable
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ from weboob.capabilities.bill import Subscription, Detail, Bill
|
|||
# Ugly array to avoid the use of french locale
|
||||
FRENCH_MONTHS = [u'janvier', u'février', u'mars', u'avril', u'mai', u'juin', u'juillet', u'août', u'septembre', u'octobre', u'novembre', u'décembre']
|
||||
|
||||
|
||||
class AmeliBasePage(Page):
|
||||
def is_logged(self):
|
||||
try:
|
||||
|
|
@ -40,6 +41,7 @@ class AmeliBasePage(Page):
|
|||
self.logger.debug('logged: %s' % (logged))
|
||||
return logged
|
||||
|
||||
|
||||
class LoginPage(AmeliBasePage):
|
||||
def login(self, login, password):
|
||||
self.browser.select_form('connexionCompteForm')
|
||||
|
|
@ -47,9 +49,11 @@ class LoginPage(AmeliBasePage):
|
|||
self.browser["connexioncompte_2codeConfidentiel"] = password.encode('utf8')
|
||||
self.browser.submit()
|
||||
|
||||
|
||||
class HomePage(AmeliBasePage):
|
||||
pass
|
||||
|
||||
|
||||
class AccountPage(AmeliBasePage):
|
||||
def iter_subscription_list(self):
|
||||
idents = self.document.xpath('//div[contains(@class, "blocfond")]')
|
||||
|
|
|
|||
|
|
@ -63,4 +63,3 @@ class AmericanExpressModule(Module, CapBank):
|
|||
transactions = list(self.browser.get_history(account))
|
||||
transactions.sort(key=lambda tr: tr.rdate, reverse=True)
|
||||
return transactions
|
||||
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@ class AccountsPage(Page):
|
|||
|
||||
yield a
|
||||
|
||||
|
||||
class TransactionsPage(Page):
|
||||
COL_ID = 0
|
||||
COL_DATE = 1
|
||||
|
|
@ -81,6 +82,7 @@ class TransactionsPage(Page):
|
|||
return datetime.date(int(m.group(3)),
|
||||
self.MONTHS.index(m.group(2).rstrip('.')) + 1,
|
||||
int(m.group(1)))
|
||||
|
||||
def get_beginning_debit_date(self):
|
||||
for option in self.document.xpath('//select[@id="viewPeriod"]/option'):
|
||||
if 'selected' in option.attrib:
|
||||
|
|
|
|||
|
|
@ -39,4 +39,3 @@ class AudioAddictTest(BackendTest):
|
|||
self.assertTrue(radio.current.what)
|
||||
self.assertTrue(radio.streams[0].url)
|
||||
self.assertTrue(radio.streams[0].title)
|
||||
|
||||
|
|
|
|||
|
|
@ -127,6 +127,7 @@ class WebsiteBrowser(LoginBrowser):
|
|||
|
||||
return profile
|
||||
|
||||
|
||||
class AuMBrowser(Browser):
|
||||
DOMAIN = 'www.adopteunmec.com'
|
||||
APIKEY = 'fb0123456789abcd'
|
||||
|
|
|
|||
|
|
@ -256,6 +256,7 @@ class TransactionsPage(BasePage):
|
|||
|
||||
yield t
|
||||
|
||||
|
||||
class CBTransactionsPage(TransactionsPage):
|
||||
COL_CB_CREDIT = 2
|
||||
|
||||
|
|
|
|||
|
|
@ -87,6 +87,7 @@ class VirtKeyboard(MappedVirtKeyboard):
|
|||
code += self.get_symbol_code(self.symbols[c])
|
||||
return code
|
||||
|
||||
|
||||
class LoginPage(HTMLPage):
|
||||
def login(self, login, password):
|
||||
vk = VirtKeyboard(self)
|
||||
|
|
@ -98,6 +99,7 @@ class LoginPage(HTMLPage):
|
|||
form['code'] = code
|
||||
form.submit()
|
||||
|
||||
|
||||
class IndexPage(LoggedPage, HTMLPage):
|
||||
@method
|
||||
class get_list(ListElement):
|
||||
|
|
@ -152,6 +154,7 @@ class IndexPage(LoggedPage, HTMLPage):
|
|||
def get_card_name(self):
|
||||
return CleanText('//h1[1]')(self.doc)
|
||||
|
||||
|
||||
class AccountsPage(LoggedPage, HTMLPage):
|
||||
def get_balance(self):
|
||||
balance = Decimal('0.0')
|
||||
|
|
|
|||
|
|
@ -82,6 +82,7 @@ class BanquePopulaire(Browser):
|
|||
self.token = self.page.get_token()
|
||||
|
||||
ACCOUNT_URLS = ['mesComptes', 'mesComptesPRO', 'maSyntheseGratuite', 'accueilSynthese']
|
||||
|
||||
def go_on_accounts_list(self):
|
||||
for taskInfoOID in self.ACCOUNT_URLS:
|
||||
self.location(self.buildurl('/cyber/internet/StartTask.do', taskInfoOID=taskInfoOID, token=self.token))
|
||||
|
|
|
|||
|
|
@ -267,5 +267,6 @@ class HistoryPage(BEPage):
|
|||
# Last page
|
||||
return None
|
||||
|
||||
|
||||
class UnknownPage(BEPage):
|
||||
pass
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ from .login import LoginPage, UpdateInfoPage
|
|||
|
||||
from .two_authentication import AuthenticationPage
|
||||
|
||||
|
||||
class AccountPrelevement(AccountsList):
|
||||
pass
|
||||
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ class UnavailablePage(Page):
|
|||
def on_loaded(self):
|
||||
raise BrowserUnavailable()
|
||||
|
||||
|
||||
class Keyboard(VirtKeyboard):
|
||||
symbols={'0':'daa52d75287bea58f505823ef6c8b96c',
|
||||
'1':'f5da96c2592803a8cdc5a928a2e4a3b0',
|
||||
|
|
@ -86,6 +87,7 @@ class Keyboard(VirtKeyboard):
|
|||
x1, y1, x2, y2 = coords
|
||||
return VirtKeyboard.get_symbol_coords(self, (x1+3, y1+3, x2-3, y2-3))
|
||||
|
||||
|
||||
class LoginPage(Page):
|
||||
def login(self, login, pwd):
|
||||
vk = Keyboard(self)
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue