Fix checks

This commit is contained in:
Florian Bruhin 2014-03-03 21:19:29 +01:00
parent 508d9e347c
commit b75fc347dc
4 changed files with 9 additions and 8 deletions

View File

@ -48,14 +48,13 @@ from PyQt5.QtCore import pyqtSlot, QTimer, QEventLoop
import qutebrowser import qutebrowser
import qutebrowser.commands.utils as cmdutils import qutebrowser.commands.utils as cmdutils
import qutebrowser.config.config as config import qutebrowser.config.config as config
import qutebrowser.config.style as style
import qutebrowser.network.qutescheme as qutescheme import qutebrowser.network.qutescheme as qutescheme
from qutebrowser.widgets.mainwindow import MainWindow from qutebrowser.widgets.mainwindow import MainWindow
from qutebrowser.widgets.crash import CrashDialog from qutebrowser.widgets.crash import CrashDialog
from qutebrowser.commands.keys import KeyParser from qutebrowser.commands.keys import KeyParser
from qutebrowser.utils.appdirs import AppDirs from qutebrowser.utils.appdirs import AppDirs
from qutebrowser.utils.misc import dotted_getattr 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): class QuteBrowser(QApplication):

View File

@ -19,11 +19,8 @@
import shlex import shlex
import inspect import inspect
import logging
import functools
from PyQt5.QtCore import pyqtSlot, pyqtSignal, QObject from PyQt5.QtCore import pyqtSlot, pyqtSignal, QObject
from PyQt5.QtWidgets import QApplication
from PyQt5.QtWebKitWidgets import QWebPage from PyQt5.QtWebKitWidgets import QWebPage
import qutebrowser.config.config as config import qutebrowser.config.config as config
@ -36,6 +33,7 @@ cmd_dict = {}
class register: class register:
"""Decorator to register a new command handler. """Decorator to register a new command handler.
This could also be a function, but as a class (with a "wrong" name) it's 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, def __init__(self, instance=None, name=None, nargs=None, split_args=True,
hide=False): hide=False):
self.name = name self.name = name
@ -52,7 +52,6 @@ class register:
self.instance = instance self.instance = instance
def __call__(self, func): def __call__(self, func):
global cmd_dict
names = [] names = []
name = func.__name__.lower() if self.name is None else self.name name = func.__name__.lower() if self.name is None else self.name
if isinstance(name, str): if isinstance(name, str):
@ -70,7 +69,6 @@ class register:
cmd_dict[name] = cmd cmd_dict[name] = cmd
return func return func
def _get_nargs_count(self, func): def _get_nargs_count(self, func):
"""Get the number of command-arguments and count-support for a func. """Get the number of command-arguments and count-support for a func.
@ -89,6 +87,8 @@ class register:
* (0, None) * (0, None)
""" """
# pylint: disable=no-member
# pylint: disable=unpacking-non-sequence
# We could use inspect.signature maybe, but that's python >= 3.3 only. # We could use inspect.signature maybe, but that's python >= 3.3 only.
spec = inspect.getfullargspec(func) spec = inspect.getfullargspec(func)
count = 'count' in spec.args count = 'count' in spec.args
@ -103,7 +103,7 @@ class register:
minargs, maxargs = self.nargs minargs, maxargs = self.nargs
else: else:
defaultcount = (len(spec.defaults) if spec.defaults is not None defaultcount = (len(spec.defaults) if spec.defaults is not None
else 0) else 0)
argcount = len(spec.args) argcount = len(spec.args)
if 'self' in spec.args: if 'self' in spec.args:
argcount -= 1 argcount -= 1

View File

@ -22,6 +22,7 @@ from functools import reduce
import qutebrowser import qutebrowser
def read_file(filename): def read_file(filename):
"""Get the contents of a file contained with qutebrowser. """Get the contents of a file contained with qutebrowser.

View File

@ -58,6 +58,7 @@ options = {
'too-many-instance-attributes', 'too-many-instance-attributes',
'global-statement', 'global-statement',
'no-init', 'no-init',
'too-many-arguments',
# visual noise # visual noise
'locally-disabled', 'locally-disabled',
], ],