From b5253ec47381ef5c86e964375d4b26e0ffd46729 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Wed, 28 Nov 2018 13:01:43 +0100 Subject: [PATCH] Fix lint --- qutebrowser/app.py | 2 +- qutebrowser/misc/backendproblem.py | 1 + qutebrowser/misc/earlyinit.py | 4 ++-- scripts/dev/build_release.py | 2 +- scripts/dev/src2asciidoc.py | 2 +- tests/end2end/fixtures/webserver.py | 3 ++- tests/unit/browser/test_pdfjs.py | 4 ++-- tests/unit/browser/webkit/http/test_http_hypothesis.py | 2 +- tests/unit/misc/test_checkpyver.py | 2 +- 9 files changed, 12 insertions(+), 10 deletions(-) diff --git a/qutebrowser/app.py b/qutebrowser/app.py index 7d1b61131..161bc5297 100644 --- a/qutebrowser/app.py +++ b/qutebrowser/app.py @@ -193,7 +193,7 @@ def _init_icon(): icon = QIcon() fallback_icon = QIcon() for size in [16, 24, 32, 48, 64, 96, 128, 256, 512]: - filename = ':/icons/qutebrowser-{}x{}.png'.format(size, size) + filename = ':/icons/qutebrowser-{size}x{size}.png'.format(size=size) pixmap = QPixmap(filename) if pixmap.isNull(): log.init.warning("Failed to load {}".format(filename)) diff --git a/qutebrowser/misc/backendproblem.py b/qutebrowser/misc/backendproblem.py index 53094a257..2099afa88 100644 --- a/qutebrowser/misc/backendproblem.py +++ b/qutebrowser/misc/backendproblem.py @@ -280,6 +280,7 @@ class BackendImports: def _try_import_backends(): """Check whether backends can be imported and return BackendImports.""" + # pylint: disable=unused-import results = BackendImports() try: diff --git a/qutebrowser/misc/earlyinit.py b/qutebrowser/misc/earlyinit.py index 5e650510c..a7571fdaa 100644 --- a/qutebrowser/misc/earlyinit.py +++ b/qutebrowser/misc/earlyinit.py @@ -133,7 +133,7 @@ def init_faulthandler(fileobj=sys.__stderr__): def check_pyqt_core(): """Check if PyQt core is installed.""" try: - import PyQt5.QtCore + import PyQt5.QtCore # pylint: disable=unused-import except ImportError as e: text = _missing_str('PyQt5') text = text.replace('', '') @@ -188,7 +188,7 @@ def check_qt_version(): def check_ssl_support(): """Check if SSL support is available.""" try: - from PyQt5.QtNetwork import QSslSocket + from PyQt5.QtNetwork import QSslSocket # pylint: disable=unused-import except ImportError: _die("Fatal error: Your Qt is built without SSL support.") diff --git a/scripts/dev/build_release.py b/scripts/dev/build_release.py index 6749be676..8591f1c31 100755 --- a/scripts/dev/build_release.py +++ b/scripts/dev/build_release.py @@ -370,7 +370,7 @@ def main(): if args.upload is not None: # Fail early when trying to upload without github3 installed # or without API token - import github3 + import github3 # pylint: disable=unused-import read_github_token() if args.no_asciidoc: diff --git a/scripts/dev/src2asciidoc.py b/scripts/dev/src2asciidoc.py index cc00c3757..8c6f2e44d 100755 --- a/scripts/dev/src2asciidoc.py +++ b/scripts/dev/src2asciidoc.py @@ -135,7 +135,7 @@ def _get_command_quickref(cmds): out.append('|Command|Description') for name, cmd in cmds: desc = inspect.getdoc(cmd.handler).splitlines()[0] - out.append('|<<{},{}>>|{}'.format(name, name, desc)) + out.append('|<<{name},{name}>>|{desc}'.format(name=name, desc=desc)) out.append('|==============') return '\n'.join(out) diff --git a/tests/end2end/fixtures/webserver.py b/tests/end2end/fixtures/webserver.py index 254b5ffaf..d1e45409e 100644 --- a/tests/end2end/fixtures/webserver.py +++ b/tests/end2end/fixtures/webserver.py @@ -82,7 +82,8 @@ class Request(testprocess.Line): for i in range(15): path_to_statuses['/redirect/{}'.format(i)] = [HTTPStatus.FOUND] for suffix in ['', '1', '2', '3', '4', '5', '6']: - key = '/basic-auth/user{}/password{}'.format(suffix, suffix) + key = ('/basic-auth/user{suffix}/password{suffix}' + .format(suffix=suffix)) path_to_statuses[key] = [HTTPStatus.UNAUTHORIZED, HTTPStatus.OK] default_statuses = [HTTPStatus.OK, HTTPStatus.NOT_MODIFIED] diff --git a/tests/unit/browser/test_pdfjs.py b/tests/unit/browser/test_pdfjs.py index 7fa1a8f6c..dcee2b82b 100644 --- a/tests/unit/browser/test_pdfjs.py +++ b/tests/unit/browser/test_pdfjs.py @@ -82,14 +82,14 @@ def test_generate_pdfjs_script_disable_object_url(monkeypatch, if qt == 'new': monkeypatch.setattr(pdfjs.qtutils, 'version_check', lambda version, exact=False, compiled=True: - False if version == '5.7.1' else True) + version != '5.7.1') elif qt == 'old': monkeypatch.setattr(pdfjs.qtutils, 'version_check', lambda version, exact=False, compiled=True: False) elif qt == '5.7': monkeypatch.setattr(pdfjs.qtutils, 'version_check', lambda version, exact=False, compiled=True: - True if version == '5.7.1' else False) + version == '5.7.1') else: raise utils.Unreachable diff --git a/tests/unit/browser/webkit/http/test_http_hypothesis.py b/tests/unit/browser/webkit/http/test_http_hypothesis.py index ec8ee4aff..5727bf1bc 100644 --- a/tests/unit/browser/webkit/http/test_http_hypothesis.py +++ b/tests/unit/browser/webkit/http/test_http_hypothesis.py @@ -31,7 +31,7 @@ from qutebrowser.browser.webkit import http, rfc6266 'attachment; filename="{}"', 'inline; {}', 'attachment; {}="foo"', - 'attachment; filename*=iso-8859-1''{}', + "attachment; filename*=iso-8859-1''{}", 'attachment; filename*={}', ]) @hypothesis.given(strategies.text(alphabet=[chr(x) for x in range(255)])) diff --git a/tests/unit/misc/test_checkpyver.py b/tests/unit/misc/test_checkpyver.py index 15fc31d18..a02e2f8e0 100644 --- a/tests/unit/misc/test_checkpyver.py +++ b/tests/unit/misc/test_checkpyver.py @@ -73,7 +73,7 @@ def test_patched_errwindow(capfd, mocker, monkeypatch): monkeypatch.setattr(checkpyver.sys, 'exit', lambda status: None) try: - import tkinter + import tkinter # pylint: disable=unused-import except ImportError: tk_mock = mocker.patch('qutebrowser.misc.checkpyver.Tk', spec=['withdraw'], new_callable=mocker.Mock)