modified as requested

This commit is contained in:
siddhugolu 2017-10-23 01:46:02 +05:30
parent 4862b2faf9
commit bc9d305354
25 changed files with 12 additions and 32 deletions

View File

@ -496,7 +496,6 @@ def _init_modules(args, crash_handler):
macros.init()
# Init backend-specific stuff
browsertab.init()
# pylint: enable=too-many-statements
class Quitter:

View File

@ -677,7 +677,6 @@ class AbstractTab(QWidget):
self._install_event_filter()
self.zoom.set_default()
# pylint: enable=protected-access
def _install_event_filter(self):
raise NotImplementedError

View File

@ -1490,8 +1490,7 @@ 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 +1503,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()
@ -1515,7 +1517,6 @@ 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)

View File

@ -239,7 +239,6 @@ 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)
@ -259,7 +258,6 @@ 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:
@ -287,7 +285,6 @@ 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

View File

@ -254,7 +254,6 @@ 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)

View File

@ -184,7 +184,6 @@ 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.

View File

@ -100,7 +100,6 @@ 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

View File

@ -56,10 +56,10 @@ 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)
# pylint: enable=no-member,useless-suppression
@pyqtSlot()
def read_line(self):

View File

@ -154,7 +154,6 @@ 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."""

View File

@ -287,7 +287,6 @@ def _try_import_backends():
assert results.webengine_error is not None
return results
# pylint: enable=unused-variable
def _handle_ssl_support(fatal=False):

View File

@ -187,7 +187,6 @@ 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):

View File

@ -119,7 +119,6 @@ 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:

View File

@ -182,7 +182,6 @@ 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."""

View File

@ -160,9 +160,9 @@ 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)
# pylint: enable=protected-access
def _get_setting_types_quickref():
@ -501,7 +501,6 @@ 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:
@ -514,6 +513,7 @@ def regenerate_manpage(filename):
if action_data is not None:
groupdata.append(action_data)
groups.append('\n'.join(groupdata))
# pylint: enable=protected-access
options = '\n'.join(groups)
# epilog
if parser.epilog is not None:

View File

@ -73,7 +73,6 @@ def filter_list(complete_list, browsers):
if found:
break
return table
# pylint: enable=too-many-nested-blocks
def add_diversity(table):

View File

@ -172,7 +172,6 @@ def pytest_configure(config):
# pylint: disable=unused-variable
if config.webengine:
import PyQt5.QtWebEngineWidgets
# pylint: enable=unused-variable
@pytest.fixture(scope='session', autouse=True)

View File

@ -80,7 +80,6 @@ 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']:
@ -88,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

@ -91,7 +91,6 @@ class Tab(browsertab.AbstractTab):
def _install_event_filter(self):
pass
# pylint: enable=abstract-method
@pytest.mark.xfail(run=False, reason='Causes segfaults, see #1638')

View File

@ -94,7 +94,6 @@ 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):

View File

@ -130,7 +130,6 @@ 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:

View File

@ -109,10 +109,10 @@ 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
# pylint: enable=superfluous-parens
def test_init_save_manager(self, yaml, fake_save_manager):
yaml.init_save_manager(fake_save_manager)

View File

@ -177,7 +177,6 @@ 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')

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
@ -311,7 +312,6 @@ 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

View File

@ -267,7 +267,6 @@ class TestGetAllObjects:
global object registry - 0 objects:
""").rstrip('\n')
# pylint: enable=unused-variable
assert debug.get_all_objects(start_obj=root) == expected

View File

@ -702,12 +702,12 @@ 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)
with pytest.raises(io.UnsupportedOperation):
pyqiodev.seek(0, whence)
# pylint: enable=no-member,useless-suppression
@pytest.mark.flaky()
def test_qprocess(self, py_proc):
@ -907,4 +907,3 @@ class TestEventLoop:
QTimer.singleShot(400, self.loop.quit)
self.loop.exec_()
assert not self.loop._executing
# pylint: enable=attribute-defined-outside-init