Merge remote-tracking branch 'origin/pr/3182'

This commit is contained in:
Florian Bruhin 2017-10-24 09:31:25 +02:00
commit 1d18e808b1
17 changed files with 27 additions and 4 deletions

View File

@ -1490,8 +1490,6 @@ class CommandDispatcher:
@cmdutils.register(instance='command-dispatcher', scope='window')
def view_source(self):
"""Show the source of the current page in a new tab."""
# pylint: disable=no-member
# WORKAROUND for https://bitbucket.org/logilab/pylint/issue/491/
tab = self._current_widget()
if tab.data.viewing_source:
raise cmdexc.CommandError("Already viewing source!")
@ -1504,10 +1502,13 @@ class CommandDispatcher:
def show_source_cb(source):
"""Show source as soon as it's ready."""
# WORKAROUND for https://github.com/PyCQA/pylint/issues/491
# pylint: disable=no-member
lexer = pygments.lexers.HtmlLexer()
formatter = pygments.formatters.HtmlFormatter(
full=True, linenos='table',
title='Source for {}'.format(current_url.toDisplayString()))
# pylint: enable=no-member
highlighted = pygments.highlight(source, lexer, formatter)
new_tab = self._tabbed_browser.tabopen()

View File

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

View File

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

View File

@ -56,6 +56,7 @@ class _QtFIFOReader(QObject):
# can add O_NONBLOCK.
# pylint: disable=no-member,useless-suppression
fd = os.open(filepath, os.O_RDWR | os.O_NONBLOCK)
# pylint: enable=no-member,useless-suppression
self._fifo = os.fdopen(fd, 'r')
self._notifier = QSocketNotifier(fd, QSocketNotifier.Read, self)
self._notifier.activated.connect(self.read_line)
@ -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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -160,6 +160,7 @@ def _get_configtypes():
configtypes.MappingType,
# pylint: disable=protected-access
configtypes._Numeric] and
# pylint: enable=protected-access
issubclass(e, configtypes.BaseType))
yield from inspect.getmembers(configtypes, predicate)
@ -498,11 +499,12 @@ def _format_block(filename, what, data):
def regenerate_manpage(filename):
"""Update manpage OPTIONS using an argparse parser."""
# pylint: disable=protected-access
parser = qutebrowser.get_argparser()
groups = []
# positionals, optionals and user-defined groups
# pylint: disable=protected-access
for group in parser._action_groups:
# pylint: enable=protected-access
groupdata = []
groupdata.append('=== {}'.format(group.title))
if group.description is not None:

View File

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

View File

@ -87,6 +87,7 @@ class Request(testprocess.Line):
path_to_statuses[key] = [http.client.UNAUTHORIZED, http.client.OK]
default_statuses = [http.client.OK, http.client.NOT_MODIFIED]
# pylint: enable=no-member
sanitized = QUrl('http://localhost' + self.path).path() # Remove ?foo
expected_statuses = path_to_statuses.get(sanitized, default_statuses)

View File

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

View File

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

View File

@ -109,6 +109,7 @@ class TestYaml:
# WORKAROUND for https://github.com/PyCQA/pylint/issues/574
# pylint: disable=superfluous-parens
if 'magenta' in (old_config or ''):
# pylint: enable=superfluous-parens
assert ' colors.hints.fg: magenta' in lines
if insert:
assert ' tabs.show: never' in lines
@ -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))

View File

@ -294,7 +294,6 @@ class TestListen:
@pytest.mark.posix
def test_permissions_posix(self, ipc_server):
# pylint: disable=no-member,useless-suppression
ipc_server.listen()
sockfile = ipc_server._server.fullServerName()
sockdir = os.path.dirname(sockfile)
@ -302,8 +301,10 @@ class TestListen:
file_stat = os.stat(sockfile)
dir_stat = os.stat(sockdir)
# pylint: disable=no-member,useless-suppression
file_owner_ok = file_stat.st_uid == os.getuid()
dir_owner_ok = dir_stat.st_uid == os.getuid()
# pylint: enable=no-member,useless-suppression
file_mode_ok = file_stat.st_mode & 0o777 == 0o700
dir_mode_ok = dir_stat.st_mode & 0o777 == 0o700

View File

@ -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
@ -701,6 +702,7 @@ class TestPyQIODevice:
whence = os.SEEK_HOLE
elif hasattr(os, 'SEEK_DATA'):
whence = os.SEEK_DATA
# pylint: enable=no-member,useless-suppression
else:
pytest.skip("Needs os.SEEK_HOLE or os.SEEK_DATA available.")
pyqiodev.open(QIODevice.ReadOnly)