From f9858733c1ba7d4500ad8b20bef281341dc12f12 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Thu, 29 Nov 2018 13:32:20 +0100 Subject: [PATCH] Improve docstrings --- qutebrowser/commands/cmdutils.py | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/qutebrowser/commands/cmdutils.py b/qutebrowser/commands/cmdutils.py index b9874c85b..a30b7e799 100644 --- a/qutebrowser/commands/cmdutils.py +++ b/qutebrowser/commands/cmdutils.py @@ -17,7 +17,7 @@ # You should have received a copy of the GNU General Public License # along with qutebrowser. If not, see . -"""Contains various command utils and a global command dict.""" +"""Utilities for command handlers.""" import inspect import typing @@ -31,8 +31,8 @@ def check_overflow(arg: int, ctype: str) -> None: """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. + arg: The argument to check. + ctype: The C++/Qt type to check as a string ('int'/'int64'). """ try: qtutils.check_overflow(arg, ctype) @@ -49,8 +49,8 @@ def check_exclusive(flags: typing.Iterable[bool], Raise a CommandError if not. Args: - flags: An iterable of booleans to check. - names: An iterable of flag names for the error message. + flags: The flag values to check. + names: A list of names (corresponding to the flags argument). """ if sum(1 for e in flags if e) > 1: argstr = '/'.join('-' + e for e in names) @@ -62,9 +62,6 @@ class register: # noqa: N801,N806 pylint: disable=invalid-name """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. @@ -120,9 +117,6 @@ class argument: # noqa: N801,N806 pylint: disable=invalid-name """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