From b75fc347dc1dad66aefff3c55bded1fc6514dfa0 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Mon, 3 Mar 2014 21:19:29 +0100 Subject: [PATCH] Fix checks --- qutebrowser/app.py | 3 +-- qutebrowser/commands/utils.py | 12 ++++++------ qutebrowser/utils/misc.py | 1 + run_checks.py | 1 + 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/qutebrowser/app.py b/qutebrowser/app.py index 6e6a5f8cb..1cd3a5973 100644 --- a/qutebrowser/app.py +++ b/qutebrowser/app.py @@ -48,14 +48,13 @@ from PyQt5.QtCore import pyqtSlot, QTimer, QEventLoop import qutebrowser import qutebrowser.commands.utils as cmdutils import qutebrowser.config.config as config -import qutebrowser.config.style as style import qutebrowser.network.qutescheme as qutescheme from qutebrowser.widgets.mainwindow import MainWindow from qutebrowser.widgets.crash import CrashDialog from qutebrowser.commands.keys import KeyParser from qutebrowser.utils.appdirs import AppDirs from qutebrowser.utils.misc import dotted_getattr -from qutebrowser.utils.debug import set_trace +from qutebrowser.utils.debug import set_trace # noqa pylint: disable=unused-import class QuteBrowser(QApplication): diff --git a/qutebrowser/commands/utils.py b/qutebrowser/commands/utils.py index f75a60c81..22dc3016a 100644 --- a/qutebrowser/commands/utils.py +++ b/qutebrowser/commands/utils.py @@ -19,11 +19,8 @@ import shlex import inspect -import logging -import functools from PyQt5.QtCore import pyqtSlot, pyqtSignal, QObject -from PyQt5.QtWidgets import QApplication from PyQt5.QtWebKitWidgets import QWebPage import qutebrowser.config.config as config @@ -36,6 +33,7 @@ cmd_dict = {} class register: + """Decorator to register a new command handler. This could also be a function, but as a class (with a "wrong" name) it's @@ -43,6 +41,8 @@ class register: """ + # pylint: disable=too-few-public-methods + def __init__(self, instance=None, name=None, nargs=None, split_args=True, hide=False): self.name = name @@ -52,7 +52,6 @@ class register: self.instance = instance def __call__(self, func): - global cmd_dict names = [] name = func.__name__.lower() if self.name is None else self.name if isinstance(name, str): @@ -70,7 +69,6 @@ class register: cmd_dict[name] = cmd return func - def _get_nargs_count(self, func): """Get the number of command-arguments and count-support for a func. @@ -89,6 +87,8 @@ class register: * (0, None) """ + # pylint: disable=no-member + # pylint: disable=unpacking-non-sequence # We could use inspect.signature maybe, but that's python >= 3.3 only. spec = inspect.getfullargspec(func) count = 'count' in spec.args @@ -103,7 +103,7 @@ class register: minargs, maxargs = self.nargs else: defaultcount = (len(spec.defaults) if spec.defaults is not None - else 0) + else 0) argcount = len(spec.args) if 'self' in spec.args: argcount -= 1 diff --git a/qutebrowser/utils/misc.py b/qutebrowser/utils/misc.py index 177e7c383..f07e25a88 100644 --- a/qutebrowser/utils/misc.py +++ b/qutebrowser/utils/misc.py @@ -22,6 +22,7 @@ from functools import reduce import qutebrowser + def read_file(filename): """Get the contents of a file contained with qutebrowser. diff --git a/run_checks.py b/run_checks.py index f3280f545..340f423b5 100644 --- a/run_checks.py +++ b/run_checks.py @@ -58,6 +58,7 @@ options = { 'too-many-instance-attributes', 'global-statement', 'no-init', + 'too-many-arguments', # visual noise 'locally-disabled', ],