Coverage for qutebrowser/commands/cmdutils.py : 100%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2014-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # # This file is part of qutebrowser. # # qutebrowser is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # qutebrowser is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
Module attributes: cmd_dict: A mapping from command-strings to command objects. """
"""Check if the given argument is in bounds for the given type.
Args: arg: The argument to check ctype: The C/Qt type to check as a string. """ "Numeric argument is too large for internal {} " "representation.".format(ctype))
"""Check if only one flag is set with exclusive flags.
Raise a CommandError if not.
Args: flags: An iterable of booleans to check. names: An iterable of flag names for the error message. """ argstr))
"""Decorator to register a new command handler.
This could also be a function, but as a class (with a "wrong" name) it's much cleaner to implement.
Attributes: _instance: The object from the object registry to be used as "self". _name: The name (as string) or names (as list) of the command. _kwargs: The arguments to pass to Command. """
"""Save decorator arguments.
Gets called on parse-time with the decorator arguments.
Args: See class attributes. """
"""Register the command before running the function.
Gets called when a function should be decorated.
Doesn't actually decorate anything, but creates a Command object and registers it in the cmd_dict.
Args: func: The function to be decorated.
Return: The original function (unmodified). """ else: name, func.__module__, func.__qualname__)) handler=func, **self._kwargs)
"""Decorator to customize an argument for @cmdutils.register.
This could also be a function, but as a class (with a "wrong" name) it's much cleaner to implement.
Attributes: _argname: The name of the argument to handle. _kwargs: Keyword arguments, valid ArgInfo members """
self._argname)) "@cmdutils.register for {}!".format(funcname))
|