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:
Laurent Bachelier 2014-10-10 23:04:08 +02:00
commit 448c06d125
142 changed files with 249 additions and 25 deletions

View file

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

View file

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

View file

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