Adjustments for new pylint version

This commit is contained in:
Florian Bruhin 2017-04-13 18:00:36 +02:00
parent 90e9850ad9
commit 1d0f187fab
18 changed files with 27 additions and 42 deletions

View File

@ -100,7 +100,8 @@ class DownloadItem(downloads.AbstractDownloadItem):
def _get_open_filename(self): def _get_open_filename(self):
return self._filename return self._filename
def _set_fileobj(self, fileobj): def _set_fileobj(self, fileobj, *,
autoclose=True): # pylint: disable=unused-argument
raise downloads.UnsupportedOperationError raise downloads.UnsupportedOperationError
def _set_tempfile(self, fileobj): def _set_tempfile(self, fileobj):

View File

@ -18,7 +18,7 @@
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>. # along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
# FIXME:qtwebengine remove this once the stubs are gone # FIXME:qtwebengine remove this once the stubs are gone
# pylint: disable=unused-variable # pylint: disable=unused-argument
"""QtWebEngine specific part of the web element API.""" """QtWebEngine specific part of the web element API."""

View File

@ -18,7 +18,7 @@
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>. # along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
# FIXME:qtwebengine remove this once the stubs are gone # FIXME:qtwebengine remove this once the stubs are gone
# pylint: disable=unused-variable # pylint: disable=unused-argument
"""Wrapper over a QWebEngineView.""" """Wrapper over a QWebEngineView."""

View File

@ -286,9 +286,6 @@ def normalize_ws(text):
def parse_headers(content_disposition): def parse_headers(content_disposition):
"""Build a _ContentDisposition from header values.""" """Build a _ContentDisposition from header values."""
# WORKAROUND for https://bitbucket.org/logilab/pylint/issue/492/
# pylint: disable=no-member
# We allow non-ascii here (it will only be parsed inside of qdtext, and # We allow non-ascii here (it will only be parsed inside of qdtext, and
# rejected by the grammar if it appears in other places), although parsing # rejected by the grammar if it appears in other places), although parsing
# it can be ambiguous. Parsing it ensures that a non-ambiguous filename* # it can be ambiguous. Parsing it ensures that a non-ambiguous filename*

View File

@ -76,11 +76,11 @@ class ArgumentParser(argparse.ArgumentParser):
self.name = name self.name = name
super().__init__(*args, add_help=False, prog=name, **kwargs) super().__init__(*args, add_help=False, prog=name, **kwargs)
def exit(self, status=0, msg=None): def exit(self, status=0, message=None):
raise ArgumentParserExit(status, msg) raise ArgumentParserExit(status, message)
def error(self, msg): def error(self, message):
raise ArgumentParserError(msg.capitalize()) raise ArgumentParserError(message.capitalize())
def arg_name(name): def arg_name(name):

View File

@ -103,7 +103,7 @@ class BaseCompletionModel(QStandardItemModel):
nameitem.setData(userdata, Role.userdata) nameitem.setData(userdata, Role.userdata)
return nameitem, descitem, miscitem return nameitem, descitem, miscitem
def delete_cur_item(self, win_id): def delete_cur_item(self, completion):
"""Delete the selected item.""" """Delete the selected item."""
raise NotImplementedError raise NotImplementedError

View File

@ -643,8 +643,7 @@ class ConfigManager(QObject):
def _after_set(self, changed_sect, changed_opt): def _after_set(self, changed_sect, changed_opt):
"""Clean up caches and emit signals after an option has been set.""" """Clean up caches and emit signals after an option has been set."""
# WORKAROUND for https://bitbucket.org/logilab/pylint/issues/659/ self.get.cache_clear()
self.get.cache_clear() # pylint: disable=no-member
self._changed(changed_sect, changed_opt) self._changed(changed_sect, changed_opt)
# Options in the same section and ${optname} interpolation. # Options in the same section and ${optname} interpolation.
for optname, option in self.sections[changed_sect].items(): for optname, option in self.sections[changed_sect].items():
@ -715,8 +714,7 @@ class ConfigManager(QObject):
existed = optname in sectdict existed = optname in sectdict
if existed: if existed:
sectdict.delete(optname) sectdict.delete(optname)
# WORKAROUND for https://bitbucket.org/logilab/pylint/issues/659/ self.get.cache_clear()
self.get.cache_clear() # pylint: disable=no-member
return existed return existed
@functools.lru_cache() @functools.lru_cache()

View File

@ -455,9 +455,7 @@ class SessionManager(QObject):
force: Force saving internal sessions (starting with an underline). force: Force saving internal sessions (starting with an underline).
only_active_window: Saves only tabs of the currently active window. only_active_window: Saves only tabs of the currently active window.
""" """
if (name is not default and if name is not default and name.startswith('_') and not force:
name.startswith('_') and # pylint: disable=no-member
not force):
raise cmdexc.CommandError("{} is an internal session, use --force " raise cmdexc.CommandError("{} is an internal session, use --force "
"to save anyways.".format(name)) "to save anyways.".format(name))
if current: if current:

View File

@ -18,7 +18,7 @@
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>. # along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
# Because every method needs to have a log_stack argument # Because every method needs to have a log_stack argument
# pylint: disable=unused-variable # pylint: disable=unused-argument
"""Message singleton so we don't have to define unneeded signals.""" """Message singleton so we don't have to define unneeded signals."""

View File

@ -54,7 +54,8 @@ def main():
'missing-docstring', 'missing-docstring',
'protected-access', 'protected-access',
# https://bitbucket.org/logilab/pylint/issue/511/ # https://bitbucket.org/logilab/pylint/issue/511/
'undefined-variable', #'undefined-variable',
'len-as-condition',
# directories without __init__.py... # directories without __init__.py...
'import-error', 'import-error',
] ]
@ -66,7 +67,8 @@ def main():
no_docstring_rgx = ['^__.*__$', '^setup$'] no_docstring_rgx = ['^__.*__$', '^setup$']
args = (['--disable={}'.format(','.join(disabled)), args = (['--disable={}'.format(','.join(disabled)),
'--no-docstring-rgx=({})'.format('|'.join(no_docstring_rgx))] + '--no-docstring-rgx=({})'.format('|'.join(no_docstring_rgx)),
'--ignored-modules=helpers,pytest'] +
sys.argv[2:] + files) sys.argv[2:] + files)
env = os.environ.copy() env = os.environ.copy()
env['PYTHONPATH'] = os.pathsep.join(pythonpath) env['PYTHONPATH'] = os.pathsep.join(pythonpath)

View File

@ -17,7 +17,7 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>. # along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
# pylint: disable=unused-import # pylint: disable=unused-import,wildcard-import,unused-wildcard-import
"""The qutebrowser test suite conftest file.""" """The qutebrowser test suite conftest file."""
@ -34,7 +34,7 @@ pytest.register_assert_rewrite('helpers')
from helpers import logfail from helpers import logfail
from helpers.logfail import fail_on_logging from helpers.logfail import fail_on_logging
from helpers.messagemock import message_mock from helpers.messagemock import message_mock
from helpers.fixtures import * # pylint: disable=wildcard-import from helpers.fixtures import *
from qutebrowser.utils import qtutils from qutebrowser.utils import qtutils

View File

@ -356,7 +356,8 @@ class QuteProc(testprocess.Process):
self.wait_for(category='webview', self.wait_for(category='webview',
message='Scroll position changed to ' + point) message='Scroll position changed to ' + point)
def wait_for(self, timeout=None, **kwargs): def wait_for(self, timeout=None, # pylint: disable=arguments-differ
**kwargs):
"""Extend wait_for to add divisor if a test is xfailing.""" """Extend wait_for to add divisor if a test is xfailing."""
__tracebackhide__ = (lambda e: __tracebackhide__ = (lambda e:
e.errisinstance(testprocess.WaitForTimeout)) e.errisinstance(testprocess.WaitForTimeout))

View File

@ -376,9 +376,6 @@ class InstaTimer(QObject):
timeout = pyqtSignal() timeout = pyqtSignal()
def __init__(self, parent=None):
super().__init__(parent)
def start(self): def start(self):
self.timeout.emit() self.timeout.emit()
@ -410,9 +407,6 @@ class StatusBarCommandStub(QLineEdit):
show_cmd = pyqtSignal() show_cmd = pyqtSignal()
hide_cmd = pyqtSignal() hide_cmd = pyqtSignal()
def __init__(self, parent=None):
super().__init__(parent)
def prefix(self): def prefix(self):
return self.text()[0] return self.text()[0]
@ -594,6 +588,3 @@ class ApplicationStub(QObject):
"""Stub to insert as the app object in objreg.""" """Stub to insert as the app object in objreg."""
new_window = pyqtSignal(mainwindow.MainWindow) new_window = pyqtSignal(mainwindow.MainWindow)
def __init__(self):
super().__init__()

View File

@ -17,8 +17,6 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>. # along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
# pylint: disable=unused-variable
"""Partial comparison of dicts/lists.""" """Partial comparison of dicts/lists."""

View File

@ -113,7 +113,6 @@ def cmdutils_patch(monkeypatch, stubs):
@cmdutils.argument('command', completion=usertypes.Completion.command) @cmdutils.argument('command', completion=usertypes.Completion.command)
def bind(key, win_id, command=None, *, mode='normal', force=False): def bind(key, win_id, command=None, *, mode='normal', force=False):
"""docstring.""" """docstring."""
# pylint: disable=unused-variable
pass pass
def tab_detach(): def tab_detach():