modified pylint pragmas
This commit is contained in:
parent
af98f9a77d
commit
4862b2faf9
@ -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:
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
@ -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.
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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."""
|
||||
|
@ -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):
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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):
|
||||
|
@ -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:
|
||||
|
@ -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:
|
||||
|
@ -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
|
||||
|
@ -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."""
|
||||
|
@ -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:
|
||||
|
@ -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):
|
||||
|
@ -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)
|
||||
|
@ -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'))
|
||||
|
@ -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']:
|
||||
|
@ -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
|
||||
|
@ -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()
|
||||
|
@ -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):
|
||||
|
@ -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()
|
||||
|
@ -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:
|
||||
|
@ -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))
|
||||
|
@ -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')
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user