diff --git a/qutebrowser/app.py b/qutebrowser/app.py index a64d2236e..fdf174288 100644 --- a/qutebrowser/app.py +++ b/qutebrowser/app.py @@ -496,6 +496,7 @@ def _init_modules(args, crash_handler): macros.init() # Init backend-specific stuff browsertab.init() + # pylint: enable=too-many-statements class Quitter: diff --git a/qutebrowser/browser/browsertab.py b/qutebrowser/browser/browsertab.py index 141555290..f14506e3c 100644 --- a/qutebrowser/browser/browsertab.py +++ b/qutebrowser/browser/browsertab.py @@ -677,6 +677,7 @@ class AbstractTab(QWidget): self._install_event_filter() self.zoom.set_default() + # pylint: enable=protected-access def _install_event_filter(self): raise NotImplementedError diff --git a/qutebrowser/browser/commands.py b/qutebrowser/browser/commands.py index fbe41d6a8..4c5087575 100644 --- a/qutebrowser/browser/commands.py +++ b/qutebrowser/browser/commands.py @@ -1515,6 +1515,7 @@ class CommandDispatcher: new_tab.data.viewing_source = True tab.dump_async(show_source_cb) + # pylint: enable=no-member @cmdutils.register(instance='command-dispatcher', scope='window', debug=True) diff --git a/qutebrowser/browser/downloads.py b/qutebrowser/browser/downloads.py index 07e5c7c30..e8c4e75c1 100644 --- a/qutebrowser/browser/downloads.py +++ b/qutebrowser/browser/downloads.py @@ -239,6 +239,7 @@ class FileDownloadTarget(_DownloadTarget): def __init__(self, filename): # pylint: disable=super-init-not-called self.filename = filename + # pylint: enable=super-init-not-called def suggested_filename(self): return os.path.basename(self.filename) @@ -258,6 +259,7 @@ class FileObjDownloadTarget(_DownloadTarget): def __init__(self, fileobj): # pylint: disable=super-init-not-called self.fileobj = fileobj + # pylint: enable=super-init-not-called def suggested_filename(self): try: @@ -285,6 +287,7 @@ class OpenFileDownloadTarget(_DownloadTarget): def __init__(self, cmdline=None): # pylint: disable=super-init-not-called self.cmdline = cmdline + # pylint: enable=super-init-not-called def suggested_filename(self): raise NoFilenameError diff --git a/qutebrowser/browser/hints.py b/qutebrowser/browser/hints.py index 8694a6ad5..90ef9b7ec 100644 --- a/qutebrowser/browser/hints.py +++ b/qutebrowser/browser/hints.py @@ -393,6 +393,7 @@ class HintManager(QObject): # pylint: disable=not-an-iterable for label in self._context.all_labels: label.cleanup() + # pylint: enable=not-an-iterable text = self._get_text() message_bridge = objreg.get('message-bridge', scope='window', @@ -809,6 +810,7 @@ class HintManager(QObject): label.hide() except webelem.Error: pass + # pylint: enable=not-an-iterable if not visible: # Whoops, filtered all hints diff --git a/qutebrowser/browser/network/pac.py b/qutebrowser/browser/network/pac.py index 69158fe62..350365892 100644 --- a/qutebrowser/browser/network/pac.py +++ b/qutebrowser/browser/network/pac.py @@ -254,6 +254,7 @@ class PACFetcher(QObject): def __eq__(self, other): # pylint: disable=protected-access return self._pac_url == other._pac_url + # pylint: enable=protected-access def __repr__(self): return utils.get_repr(self, url=self._pac_url, constructor=True) diff --git a/qutebrowser/browser/webengine/webenginetab.py b/qutebrowser/browser/webengine/webenginetab.py index 2decf3599..15466ab0d 100644 --- a/qutebrowser/browser/webengine/webenginetab.py +++ b/qutebrowser/browser/webengine/webenginetab.py @@ -686,6 +686,7 @@ class WebEngineTab(browsertab.AbstractTab): try: # pylint: disable=no-member, useless-suppression sip.assign(authenticator, QAuthenticator()) + # pylint: enable=no-member, useless-suppression except AttributeError: url_string = url.toDisplayString() error_page = jinja.render( @@ -705,6 +706,7 @@ class WebEngineTab(browsertab.AbstractTab): try: # pylint: disable=no-member, useless-suppression sip.assign(authenticator, QAuthenticator()) + # pylint: enable=no-member, useless-suppression except AttributeError: # WORKAROUND for # https://www.riverbankcomputing.com/pipermail/pyqt/2016-December/038400.html diff --git a/qutebrowser/browser/webkit/webview.py b/qutebrowser/browser/webkit/webview.py index 4f1ff10c8..e0e853730 100644 --- a/qutebrowser/browser/webkit/webview.py +++ b/qutebrowser/browser/webkit/webview.py @@ -184,6 +184,7 @@ class WebView(QWebView): window=self.win_id) # pylint: disable=protected-access return tabbed_browser.tabopen(background=False)._widget + # pylint: enable=protected-access def paintEvent(self, e): """Extend paintEvent to emit a signal if the scroll position changed. diff --git a/qutebrowser/commands/command.py b/qutebrowser/commands/command.py index 9baa4efe7..543eac176 100644 --- a/qutebrowser/commands/command.py +++ b/qutebrowser/commands/command.py @@ -100,6 +100,7 @@ class Command: if scope != 'global' and instance is None: raise ValueError("Setting scope without setting instance makes " "no sense!") + # pylint: enable=too-many-locals self.name = name self.maxsplit = maxsplit diff --git a/qutebrowser/commands/userscripts.py b/qutebrowser/commands/userscripts.py index 10e509ce7..f57f46f4f 100644 --- a/qutebrowser/commands/userscripts.py +++ b/qutebrowser/commands/userscripts.py @@ -59,6 +59,7 @@ class _QtFIFOReader(QObject): self._fifo = os.fdopen(fd, 'r') self._notifier = QSocketNotifier(fd, QSocketNotifier.Read, self) self._notifier.activated.connect(self.read_line) + # pylint: enable=no-member,useless-suppression @pyqtSlot() def read_line(self): @@ -247,6 +248,7 @@ class _POSIXUserscriptRunner(_BaseUserscriptRunner): dir=standarddir.runtime()) # pylint: disable=no-member,useless-suppression os.mkfifo(self._filepath) + # pylint: enable=no-member,useless-suppression except OSError as e: message.error("Error while creating FIFO: {}".format(e)) return diff --git a/qutebrowser/completion/models/completionmodel.py b/qutebrowser/completion/models/completionmodel.py index 398673200..bf21f2cbc 100644 --- a/qutebrowser/completion/models/completionmodel.py +++ b/qutebrowser/completion/models/completionmodel.py @@ -154,6 +154,7 @@ class CompletionModel(QAbstractItemModel): """Override QAbstractItemModel::columnCount.""" # pylint: disable=unused-argument return 3 + # pylint: enable=unused-argument def canFetchMore(self, parent): """Override to forward the call to the categories.""" diff --git a/qutebrowser/misc/backendproblem.py b/qutebrowser/misc/backendproblem.py index f126ceda5..4c35e970d 100644 --- a/qutebrowser/misc/backendproblem.py +++ b/qutebrowser/misc/backendproblem.py @@ -287,6 +287,7 @@ def _try_import_backends(): assert results.webengine_error is not None return results + # pylint: enable=unused-variable def _handle_ssl_support(fatal=False): diff --git a/qutebrowser/misc/checkpyver.py b/qutebrowser/misc/checkpyver.py index d4ea13bcd..da71b278d 100644 --- a/qutebrowser/misc/checkpyver.py +++ b/qutebrowser/misc/checkpyver.py @@ -48,6 +48,7 @@ def check_python_version(): # still has < 2.6 installed. # pylint: disable=bad-builtin version_str = '.'.join(map(str, sys.version_info[:3])) + # pylint: enable=bad-builtin text = ("At least Python 3.5 is required to run qutebrowser, but " + "it's running with " + version_str + ".\n") if Tk and '--no-err-windows' not in sys.argv: # pragma: no cover diff --git a/qutebrowser/misc/crashsignal.py b/qutebrowser/misc/crashsignal.py index b90eae829..68c17d93f 100644 --- a/qutebrowser/misc/crashsignal.py +++ b/qutebrowser/misc/crashsignal.py @@ -323,6 +323,7 @@ class SignalHandler(QObject): self) self._notifier.activated.connect(self.handle_signal_wakeup) self._orig_wakeup_fd = signal.set_wakeup_fd(write_fd) + # pylint: enable=import-error,no-member,useless-suppression else: self._timer.start(1000) self._timer.timeout.connect(lambda: None) diff --git a/qutebrowser/misc/earlyinit.py b/qutebrowser/misc/earlyinit.py index bcaaf8051..2afd569b6 100644 --- a/qutebrowser/misc/earlyinit.py +++ b/qutebrowser/misc/earlyinit.py @@ -127,6 +127,7 @@ def init_faulthandler(fileobj=sys.__stderr__): # If available, we also want a traceback on SIGUSR1. # pylint: disable=no-member,useless-suppression faulthandler.register(signal.SIGUSR1) + # pylint: enable=no-member,useless-suppression def check_pyqt_core(): @@ -186,6 +187,7 @@ def check_ssl_support(): from PyQt5.QtNetwork import QSslSocket except ImportError: _die("Fatal error: Your Qt is built without SSL support.") + # pylint: enable=unused-variable def _check_modules(modules): diff --git a/qutebrowser/misc/split.py b/qutebrowser/misc/split.py index 3f3b2d362..070659ef9 100644 --- a/qutebrowser/misc/split.py +++ b/qutebrowser/misc/split.py @@ -119,6 +119,7 @@ class ShellLexer: self.token += nextchar else: raise AssertionError("Invalid state {!r}!".format(self.state)) + # pylint: enable=too-many-branches,too-many-statements if self.state in self.escape and not self.keep: self.token += self.state if self.token or self.quoted: diff --git a/qutebrowser/misc/utilcmds.py b/qutebrowser/misc/utilcmds.py index bf1e94586..a61b4c6ea 100644 --- a/qutebrowser/misc/utilcmds.py +++ b/qutebrowser/misc/utilcmds.py @@ -171,6 +171,7 @@ def debug_cache_stats(): prefix_info = configdata.is_valid_prefix.cache_info() # pylint: disable=protected-access render_stylesheet_info = config._render_stylesheet.cache_info() + # pylint: enable=protected-access history_info = None try: diff --git a/qutebrowser/utils/log.py b/qutebrowser/utils/log.py index 98f14a454..0d87a5f7c 100644 --- a/qutebrowser/utils/log.py +++ b/qutebrowser/utils/log.py @@ -109,6 +109,7 @@ def vdebug(self, msg, *args, **kwargs): if self.isEnabledFor(VDEBUG_LEVEL): # pylint: disable=protected-access self._log(VDEBUG_LEVEL, msg, args, **kwargs) + # pylint: enable=protected-access logging.Logger.vdebug = vdebug diff --git a/scripts/asciidoc2html.py b/scripts/asciidoc2html.py index aa6c82469..911983547 100755 --- a/scripts/asciidoc2html.py +++ b/scripts/asciidoc2html.py @@ -182,6 +182,7 @@ class AsciiDoc: asciidoc_args = ['--theme=qute', '-a toc', '-a toc-placement=manual'] self.call(modified_src, dst, *asciidoc_args) + # pylint: enable=too-many-locals,too-many-statements def _build_website(self): """Prepare and build the website.""" diff --git a/scripts/dev/src2asciidoc.py b/scripts/dev/src2asciidoc.py index 8ea6b7c30..8e06dcafb 100755 --- a/scripts/dev/src2asciidoc.py +++ b/scripts/dev/src2asciidoc.py @@ -162,6 +162,7 @@ def _get_configtypes(): configtypes._Numeric] and issubclass(e, configtypes.BaseType)) yield from inspect.getmembers(configtypes, predicate) + # pylint: enable=protected-access def _get_setting_types_quickref(): @@ -500,6 +501,7 @@ def regenerate_manpage(filename): """Update manpage OPTIONS using an argparse parser.""" # pylint: disable=protected-access parser = qutebrowser.get_argparser() + # pylint: enable=protected-access groups = [] # positionals, optionals and user-defined groups for group in parser._action_groups: diff --git a/scripts/dev/ua_fetch.py b/scripts/dev/ua_fetch.py index b276eff27..8b8f25799 100755 --- a/scripts/dev/ua_fetch.py +++ b/scripts/dev/ua_fetch.py @@ -73,6 +73,7 @@ def filter_list(complete_list, browsers): if found: break return table + # pylint: enable=too-many-nested-blocks def add_diversity(table): diff --git a/tests/conftest.py b/tests/conftest.py index 301658d56..14c793bbd 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -172,6 +172,7 @@ def pytest_configure(config): # pylint: disable=unused-variable if config.webengine: import PyQt5.QtWebEngineWidgets + # pylint: enable=unused-variable @pytest.fixture(scope='session', autouse=True) diff --git a/tests/end2end/features/test_search_bdd.py b/tests/end2end/features/test_search_bdd.py index 1b0c81488..73a4af131 100644 --- a/tests/end2end/features/test_search_bdd.py +++ b/tests/end2end/features/test_search_bdd.py @@ -23,6 +23,7 @@ import pytest_bdd as bdd # pylint: disable=unused-import from end2end.features.test_yankpaste_bdd import init_fake_clipboard +# pylint: enable=unused-import @bdd.then(bdd.parsers.parse('"{text}" should be found')) diff --git a/tests/end2end/fixtures/webserver.py b/tests/end2end/fixtures/webserver.py index d9d8f5eca..442b6afe3 100644 --- a/tests/end2end/fixtures/webserver.py +++ b/tests/end2end/fixtures/webserver.py @@ -80,6 +80,7 @@ class Request(testprocess.Line): '/500-inline': [http.client.INTERNAL_SERVER_ERROR], } + # pylint: enable=no-member for i in range(15): path_to_statuses['/redirect/{}'.format(i)] = [http.client.FOUND] for suffix in ['', '1', '2', '3', '4', '5', '6']: diff --git a/tests/end2end/test_dirbrowser.py b/tests/end2end/test_dirbrowser.py index 83fa1d4c0..16da8d0bc 100644 --- a/tests/end2end/test_dirbrowser.py +++ b/tests/end2end/test_dirbrowser.py @@ -208,3 +208,4 @@ def test_enter_folder(dir_layout, quteproc, folder): assert foldernames == folders filenames = [item.text for item in page.files] assert filenames == files + # pylint: enable=not-an-iterable diff --git a/tests/helpers/fixtures.py b/tests/helpers/fixtures.py index 3434760ec..a01c72788 100644 --- a/tests/helpers/fixtures.py +++ b/tests/helpers/fixtures.py @@ -137,6 +137,7 @@ def fake_statusbar(qtbot): # pylint: disable=attribute-defined-outside-init statusbar.container = container vbox.addWidget(statusbar) + # pylint: enable=attribute-defined-outside-init with qtbot.waitExposed(container): container.show() diff --git a/tests/unit/browser/test_tab.py b/tests/unit/browser/test_tab.py index a2a34d9ce..64ed533aa 100644 --- a/tests/unit/browser/test_tab.py +++ b/tests/unit/browser/test_tab.py @@ -91,6 +91,8 @@ class Tab(browsertab.AbstractTab): def _install_event_filter(self): pass + # pylint: enable=abstract-method + @pytest.mark.xfail(run=False, reason='Causes segfaults, see #1638') def test_tab(qtbot, view, config_stub, tab_registry, mode_manager): diff --git a/tests/unit/browser/webkit/network/test_pac.py b/tests/unit/browser/webkit/network/test_pac.py index ea8a7acaf..5e8beb0cf 100644 --- a/tests/unit/browser/webkit/network/test_pac.py +++ b/tests/unit/browser/webkit/network/test_pac.py @@ -94,6 +94,8 @@ def _pac_noexcept_test(call): ("known.domain", "'1.2.3.4'"), ("bogus.domain.foobar", "null") ]) +# pylint: enable=line-too-long, invalid-name + def test_dnsResolve(monkeypatch, domain, expected): def mock_fromName(host): info = QHostInfo() diff --git a/tests/unit/browser/webkit/test_webkitelem.py b/tests/unit/browser/webkit/test_webkitelem.py index 3174d7281..2efa848b8 100644 --- a/tests/unit/browser/webkit/test_webkitelem.py +++ b/tests/unit/browser/webkit/test_webkitelem.py @@ -130,6 +130,7 @@ def get_webelem(geometry=None, frame=None, *, null=False, style=None, elem.styleProperty.side_effect = _style_property wrapped = webkitelem.WebKitElement(elem, tab=None) return wrapped + # pylint: enable=too-many-locals,too-many-branches class SelectionAndFilterTests: diff --git a/tests/unit/config/test_configfiles.py b/tests/unit/config/test_configfiles.py index d1ddf9f2b..6c040eab8 100644 --- a/tests/unit/config/test_configfiles.py +++ b/tests/unit/config/test_configfiles.py @@ -112,6 +112,7 @@ class TestYaml: assert ' colors.hints.fg: magenta' in lines if insert: assert ' tabs.show: never' in lines + # pylint: enable=superfluous-parens def test_init_save_manager(self, yaml, fake_save_manager): yaml.init_save_manager(fake_save_manager) @@ -404,6 +405,7 @@ class TestConfigPy: """Test whether getting options works correctly.""" # pylint: disable=bad-config-option config.val.colors.hints.fg = 'green' + # pylint: enable=bad-config-option if set_first: confpy.write('c.colors.hints.fg = "red"', 'assert {} == "red"'.format(get_line)) diff --git a/tests/unit/config/test_configinit.py b/tests/unit/config/test_configinit.py index 1501b794d..925f123eb 100644 --- a/tests/unit/config/test_configinit.py +++ b/tests/unit/config/test_configinit.py @@ -177,6 +177,7 @@ class TestEarlyInit: assert config.instance._values == {} else: assert config.instance._values == {'colors.hints.fg': 'magenta'} + # pylint: enable=too-many-locals,too-many-branches def test_invalid_change_filter(self, init_patch, args): config.change_filter('foobar') diff --git a/tests/unit/misc/test_ipc.py b/tests/unit/misc/test_ipc.py index 022b76234..21d15a734 100644 --- a/tests/unit/misc/test_ipc.py +++ b/tests/unit/misc/test_ipc.py @@ -311,6 +311,7 @@ class TestListen: sockdir, dir_stat.st_uid, dir_stat.st_mode)) print('sockfile: {} / owner {} / mode {:o}'.format( sockfile, file_stat.st_uid, file_stat.st_mode)) + # pylint: enable=no-member,useless-suppression assert file_owner_ok or dir_owner_ok assert file_mode_ok or dir_mode_ok diff --git a/tests/unit/utils/test_debug.py b/tests/unit/utils/test_debug.py index 9b77b9628..6d9c8f7c4 100644 --- a/tests/unit/utils/test_debug.py +++ b/tests/unit/utils/test_debug.py @@ -267,6 +267,7 @@ class TestGetAllObjects: global object registry - 0 objects: """).rstrip('\n') + # pylint: enable=unused-variable assert debug.get_all_objects(start_obj=root) == expected diff --git a/tests/unit/utils/test_qtutils.py b/tests/unit/utils/test_qtutils.py index 18cf591c2..42f8030db 100644 --- a/tests/unit/utils/test_qtutils.py +++ b/tests/unit/utils/test_qtutils.py @@ -27,6 +27,7 @@ import unittest.mock try: # pylint: disable=no-name-in-module,useless-suppression from test import test_file + # pylint: enable=no-name-in-module,useless-suppression except ImportError: # Debian patches Python to remove the tests... test_file = None @@ -706,6 +707,7 @@ class TestPyQIODevice: pyqiodev.open(QIODevice.ReadOnly) with pytest.raises(io.UnsupportedOperation): pyqiodev.seek(0, whence) + # pylint: enable=no-member,useless-suppression @pytest.mark.flaky() def test_qprocess(self, py_proc): @@ -905,3 +907,4 @@ class TestEventLoop: QTimer.singleShot(400, self.loop.quit) self.loop.exec_() assert not self.loop._executing + # pylint: enable=attribute-defined-outside-init