diff options
author | Florian Bruhin <me@the-compiler.org> | 2019-10-15 18:12:26 +0200 |
---|---|---|
committer | Florian Bruhin <me@the-compiler.org> | 2019-10-15 18:12:26 +0200 |
commit | 528e481021c4bc551ad8c1deda75935904fdb09e (patch) | |
tree | 8c8f244e1e421b8131e97080adbf78a81b54aee0 /qutebrowser/commands | |
parent | a4201f55c5d22d41d5bdf2345ab9194971a36b90 (diff) | |
download | qutebrowser-528e481021c4bc551ad8c1deda75935904fdb09e.tar.gz qutebrowser-528e481021c4bc551ad8c1deda75935904fdb09e.zip |
mypy: check_untyped_defs for qutebrowser.commands
Diffstat (limited to 'qutebrowser/commands')
-rw-r--r-- | qutebrowser/commands/argparser.py | 4 | ||||
-rw-r--r-- | qutebrowser/commands/command.py | 21 | ||||
-rw-r--r-- | qutebrowser/commands/runners.py | 2 | ||||
-rw-r--r-- | qutebrowser/commands/userscripts.py | 3 |
4 files changed, 16 insertions, 14 deletions
diff --git a/qutebrowser/commands/argparser.py b/qutebrowser/commands/argparser.py index 289cdb54b..82095795a 100644 --- a/qutebrowser/commands/argparser.py +++ b/qutebrowser/commands/argparser.py @@ -72,9 +72,9 @@ class ArgumentParser(argparse.ArgumentParser): name: The command name. """ - def __init__(self, name, *args, **kwargs): + def __init__(self, name, **kwargs): self.name = name - super().__init__(*args, add_help=False, prog=name, **kwargs) + super().__init__(add_help=False, prog=name, **kwargs) def exit(self, status=0, message=None): raise ArgumentParserExit(status, message) diff --git a/qutebrowser/commands/command.py b/qutebrowser/commands/command.py index 952e1c340..41d4c1e54 100644 --- a/qutebrowser/commands/command.py +++ b/qutebrowser/commands/command.py @@ -116,12 +116,13 @@ class Command: self.parser.add_argument('-h', '--help', action=argparser.HelpAction, default=argparser.SUPPRESS, nargs=0, help=argparser.SUPPRESS) - self.opt_args = collections.OrderedDict() + self.opt_args = collections.OrderedDict( + ) # type: typing.Mapping[str, typing.Tuple[str, str]] self.namespace = None self._count = None - self.pos_args = [] - self.desc = None - self.flags_with_args = [] + self.pos_args = [ + ] # type: typing.Sequence[typing.Tuple[str, str]] + self.flags_with_args = [] # type: typing.Sequence[str] self._has_vararg = False # This is checked by future @cmdutils.argument calls so they fail @@ -243,8 +244,8 @@ class Command: args = self._param_to_argparse_args(param, is_bool) callsig = debug_utils.format_call(self.parser.add_argument, args, kwargs, full=False) - log.commands.vdebug('Adding arg {} of type {} -> {}'.format( - param.name, typ, callsig)) + log.commands.vdebug('Adding arg {} of type {} -> {}' # type: ignore + .format(param.name, typ, callsig)) self.parser.add_argument(*args, **kwargs) if param.kind == inspect.Parameter.VAR_POSITIONAL: self._has_vararg = True @@ -408,7 +409,7 @@ class Command: # Python 3.5.2 # pylint: disable=no-member,useless-suppression hasattr(typing, 'UnionMeta') and - isinstance(typ, typing.UnionMeta)): + isinstance(typ, typing.UnionMeta)): # type: ignore # this is... slightly evil, I know try: types = list(typ.__args__) @@ -491,8 +492,8 @@ class Command: Return: An (args, kwargs) tuple. """ - args = [] - kwargs = {} + args = [] # type: typing.Any + kwargs = {} # type: typing.MutableMapping[str, typing.Any] signature = inspect.signature(self.handler) for i, param in enumerate(signature.parameters.values()): @@ -570,7 +571,7 @@ class Command: def register(self): """Register this command in objects.commands.""" - log.commands.vdebug( + log.commands.vdebug( # type: ignore "Registering command {} (from {}:{})".format( self.name, self.handler.__module__, self.handler.__qualname__)) if self.name in objects.commands: diff --git a/qutebrowser/commands/runners.py b/qutebrowser/commands/runners.py index 994f7e71a..c18b5f6fb 100644 --- a/qutebrowser/commands/runners.py +++ b/qutebrowser/commands/runners.py @@ -108,7 +108,7 @@ def replace_variables(win_id, arglist): """Utility function to replace variables like {url} in a list of args.""" tabbed_browser = objreg.get('tabbed-browser', scope='window', window=win_id) - values = {} + values = {} # type: typing.MutableMapping[str, str] args = [] def repl_cb(matchobj): diff --git a/qutebrowser/commands/userscripts.py b/qutebrowser/commands/userscripts.py index 6470a5365..484a6c09f 100644 --- a/qutebrowser/commands/userscripts.py +++ b/qutebrowser/commands/userscripts.py @@ -22,6 +22,7 @@ import os import os.path import tempfile +import typing from PyQt5.QtCore import pyqtSignal, pyqtSlot, QObject, QSocketNotifier @@ -113,7 +114,7 @@ class _BaseUserscriptRunner(QObject): self._cleaned_up = False self._filepath = None self._proc = None - self._env = {} + self._env = {} # type: typing.MutableMapping[str, str] self._text_stored = False self._html_stored = False self._args = None |