Adjustments for new pylint version
This commit is contained in:
parent
90e9850ad9
commit
1d0f187fab
@ -634,7 +634,7 @@ class CommandDispatcher:
|
||||
scope='window')
|
||||
@cmdutils.argument('count', count=True)
|
||||
@cmdutils.argument('horizontal', flag='x')
|
||||
def scroll_perc(self, perc: float=None, horizontal=False, count=None):
|
||||
def scroll_perc(self, perc: float = None, horizontal=False, count=None):
|
||||
"""Scroll to a specific percentage of the page.
|
||||
|
||||
The percentage can be given either as argument or as count.
|
||||
@ -670,7 +670,7 @@ class CommandDispatcher:
|
||||
@cmdutils.argument('bottom_navigate', metavar='ACTION',
|
||||
choices=('next', 'increment'))
|
||||
def scroll_page(self, x: float, y: float, *,
|
||||
top_navigate: str=None, bottom_navigate: str=None,
|
||||
top_navigate: str = None, bottom_navigate: str = None,
|
||||
count=1):
|
||||
"""Scroll the frame page-wise.
|
||||
|
||||
@ -807,7 +807,7 @@ class CommandDispatcher:
|
||||
|
||||
@cmdutils.register(instance='command-dispatcher', scope='window')
|
||||
@cmdutils.argument('count', count=True)
|
||||
def zoom(self, zoom: int=None, count=None):
|
||||
def zoom(self, zoom: int = None, count=None):
|
||||
"""Set the zoom level for the current tab.
|
||||
|
||||
The zoom can be given as argument or as [count]. If neither is
|
||||
|
@ -952,7 +952,7 @@ class DownloadModel(QAbstractListModel):
|
||||
|
||||
@cmdutils.register(instance='download-model', scope='window', maxsplit=0)
|
||||
@cmdutils.argument('count', count=True)
|
||||
def download_open(self, cmdline: str=None, count=0):
|
||||
def download_open(self, cmdline: str = None, count=0):
|
||||
"""Open the last/[count]th download.
|
||||
|
||||
If no specific command is given, this will use the system's default
|
||||
|
@ -100,7 +100,8 @@ class DownloadItem(downloads.AbstractDownloadItem):
|
||||
def _get_open_filename(self):
|
||||
return self._filename
|
||||
|
||||
def _set_fileobj(self, fileobj):
|
||||
def _set_fileobj(self, fileobj, *,
|
||||
autoclose=True): # pylint: disable=unused-argument
|
||||
raise downloads.UnsupportedOperationError
|
||||
|
||||
def _set_tempfile(self, fileobj):
|
||||
|
@ -18,7 +18,7 @@
|
||||
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# 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."""
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# FIXME:qtwebengine remove this once the stubs are gone
|
||||
# pylint: disable=unused-variable
|
||||
# pylint: disable=unused-argument
|
||||
|
||||
"""Wrapper over a QWebEngineView."""
|
||||
|
||||
|
@ -286,9 +286,6 @@ def normalize_ws(text):
|
||||
|
||||
def parse_headers(content_disposition):
|
||||
"""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
|
||||
# rejected by the grammar if it appears in other places), although parsing
|
||||
# it can be ambiguous. Parsing it ensures that a non-ambiguous filename*
|
||||
|
@ -76,11 +76,11 @@ class ArgumentParser(argparse.ArgumentParser):
|
||||
self.name = name
|
||||
super().__init__(*args, add_help=False, prog=name, **kwargs)
|
||||
|
||||
def exit(self, status=0, msg=None):
|
||||
raise ArgumentParserExit(status, msg)
|
||||
def exit(self, status=0, message=None):
|
||||
raise ArgumentParserExit(status, message)
|
||||
|
||||
def error(self, msg):
|
||||
raise ArgumentParserError(msg.capitalize())
|
||||
def error(self, message):
|
||||
raise ArgumentParserError(message.capitalize())
|
||||
|
||||
|
||||
def arg_name(name):
|
||||
|
@ -103,7 +103,7 @@ class BaseCompletionModel(QStandardItemModel):
|
||||
nameitem.setData(userdata, Role.userdata)
|
||||
return nameitem, descitem, miscitem
|
||||
|
||||
def delete_cur_item(self, win_id):
|
||||
def delete_cur_item(self, completion):
|
||||
"""Delete the selected item."""
|
||||
raise NotImplementedError
|
||||
|
||||
|
@ -643,8 +643,7 @@ class ConfigManager(QObject):
|
||||
|
||||
def _after_set(self, changed_sect, changed_opt):
|
||||
"""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() # pylint: disable=no-member
|
||||
self.get.cache_clear()
|
||||
self._changed(changed_sect, changed_opt)
|
||||
# Options in the same section and ${optname} interpolation.
|
||||
for optname, option in self.sections[changed_sect].items():
|
||||
@ -715,8 +714,7 @@ class ConfigManager(QObject):
|
||||
existed = optname in sectdict
|
||||
if existed:
|
||||
sectdict.delete(optname)
|
||||
# WORKAROUND for https://bitbucket.org/logilab/pylint/issues/659/
|
||||
self.get.cache_clear() # pylint: disable=no-member
|
||||
self.get.cache_clear()
|
||||
return existed
|
||||
|
||||
@functools.lru_cache()
|
||||
|
@ -387,7 +387,7 @@ class PromptContainer(QWidget):
|
||||
|
||||
@cmdutils.register(instance='prompt-container', hide=True, scope='window',
|
||||
modes=[usertypes.KeyMode.prompt], maxsplit=0)
|
||||
def prompt_open_download(self, cmdline: str=None):
|
||||
def prompt_open_download(self, cmdline: str = None):
|
||||
"""Immediately open a download.
|
||||
|
||||
If no specific command is given, this will use the system's default
|
||||
|
@ -443,7 +443,7 @@ class SessionManager(QObject):
|
||||
@cmdutils.register(name=['session-save', 'w'], instance='session-manager')
|
||||
@cmdutils.argument('name', completion=usertypes.Completion.sessions)
|
||||
@cmdutils.argument('win_id', win_id=True)
|
||||
def session_save(self, name: str=default, current=False, quiet=False,
|
||||
def session_save(self, name: str = default, current=False, quiet=False,
|
||||
force=False, only_active_window=False, win_id=None):
|
||||
"""Save a session.
|
||||
|
||||
@ -455,9 +455,7 @@ class SessionManager(QObject):
|
||||
force: Force saving internal sessions (starting with an underline).
|
||||
only_active_window: Saves only tabs of the currently active window.
|
||||
"""
|
||||
if (name is not default and
|
||||
name.startswith('_') and # pylint: disable=no-member
|
||||
not force):
|
||||
if name is not default and name.startswith('_') and not force:
|
||||
raise cmdexc.CommandError("{} is an internal session, use --force "
|
||||
"to save anyways.".format(name))
|
||||
if current:
|
||||
|
@ -18,7 +18,7 @@
|
||||
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# 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."""
|
||||
|
||||
|
@ -54,7 +54,8 @@ def main():
|
||||
'missing-docstring',
|
||||
'protected-access',
|
||||
# https://bitbucket.org/logilab/pylint/issue/511/
|
||||
'undefined-variable',
|
||||
#'undefined-variable',
|
||||
'len-as-condition',
|
||||
# directories without __init__.py...
|
||||
'import-error',
|
||||
]
|
||||
@ -66,7 +67,8 @@ def main():
|
||||
|
||||
no_docstring_rgx = ['^__.*__$', '^setup$']
|
||||
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)
|
||||
env = os.environ.copy()
|
||||
env['PYTHONPATH'] = os.pathsep.join(pythonpath)
|
||||
|
@ -17,7 +17,7 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# 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."""
|
||||
|
||||
@ -34,7 +34,7 @@ pytest.register_assert_rewrite('helpers')
|
||||
from helpers import logfail
|
||||
from helpers.logfail import fail_on_logging
|
||||
from helpers.messagemock import message_mock
|
||||
from helpers.fixtures import * # pylint: disable=wildcard-import
|
||||
from helpers.fixtures import *
|
||||
from qutebrowser.utils import qtutils
|
||||
|
||||
|
||||
|
@ -356,7 +356,8 @@ class QuteProc(testprocess.Process):
|
||||
self.wait_for(category='webview',
|
||||
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."""
|
||||
__tracebackhide__ = (lambda e:
|
||||
e.errisinstance(testprocess.WaitForTimeout))
|
||||
|
@ -376,9 +376,6 @@ class InstaTimer(QObject):
|
||||
|
||||
timeout = pyqtSignal()
|
||||
|
||||
def __init__(self, parent=None):
|
||||
super().__init__(parent)
|
||||
|
||||
def start(self):
|
||||
self.timeout.emit()
|
||||
|
||||
@ -410,9 +407,6 @@ class StatusBarCommandStub(QLineEdit):
|
||||
show_cmd = pyqtSignal()
|
||||
hide_cmd = pyqtSignal()
|
||||
|
||||
def __init__(self, parent=None):
|
||||
super().__init__(parent)
|
||||
|
||||
def prefix(self):
|
||||
return self.text()[0]
|
||||
|
||||
@ -594,6 +588,3 @@ class ApplicationStub(QObject):
|
||||
"""Stub to insert as the app object in objreg."""
|
||||
|
||||
new_window = pyqtSignal(mainwindow.MainWindow)
|
||||
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
|
@ -17,8 +17,6 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# pylint: disable=unused-variable
|
||||
|
||||
"""Partial comparison of dicts/lists."""
|
||||
|
||||
|
||||
|
@ -113,7 +113,6 @@ def cmdutils_patch(monkeypatch, stubs):
|
||||
@cmdutils.argument('command', completion=usertypes.Completion.command)
|
||||
def bind(key, win_id, command=None, *, mode='normal', force=False):
|
||||
"""docstring."""
|
||||
# pylint: disable=unused-variable
|
||||
pass
|
||||
|
||||
def tab_detach():
|
||||
|
Loading…
Reference in New Issue
Block a user