Improve docstrings
This commit is contained in:
parent
e576847b91
commit
f9858733c1
@ -17,7 +17,7 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
|
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
"""Contains various command utils and a global command dict."""
|
"""Utilities for command handlers."""
|
||||||
|
|
||||||
import inspect
|
import inspect
|
||||||
import typing
|
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.
|
"""Check if the given argument is in bounds for the given type.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
arg: The argument to check
|
arg: The argument to check.
|
||||||
ctype: The C/Qt type to check as a string.
|
ctype: The C++/Qt type to check as a string ('int'/'int64').
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
qtutils.check_overflow(arg, ctype)
|
qtutils.check_overflow(arg, ctype)
|
||||||
@ -49,8 +49,8 @@ def check_exclusive(flags: typing.Iterable[bool],
|
|||||||
Raise a CommandError if not.
|
Raise a CommandError if not.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
flags: An iterable of booleans to check.
|
flags: The flag values to check.
|
||||||
names: An iterable of flag names for the error message.
|
names: A list of names (corresponding to the flags argument).
|
||||||
"""
|
"""
|
||||||
if sum(1 for e in flags if e) > 1:
|
if sum(1 for e in flags if e) > 1:
|
||||||
argstr = '/'.join('-' + e for e in names)
|
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.
|
"""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:
|
Attributes:
|
||||||
_instance: The object from the object registry to be used as "self".
|
_instance: The object from the object registry to be used as "self".
|
||||||
_name: The name (as string) or names (as list) of the command.
|
_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.
|
"""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:
|
Attributes:
|
||||||
_argname: The name of the argument to handle.
|
_argname: The name of the argument to handle.
|
||||||
_kwargs: Keyword arguments, valid ArgInfo members
|
_kwargs: Keyword arguments, valid ArgInfo members
|
||||||
|
Loading…
Reference in New Issue
Block a user