Coverage for qutebrowser/commands/argparser.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/>.
"""Exception raised when the ArgumentParser signals an error."""
"""Exception raised when the argument parser exited.
Attributes: status: The exit status. """
"""Argparse action to open the help page in the browser.
This is horrible encapsulation, but I can't think of a good way to do this better... """
window='last-focused') QUrl('qute://help/commands.html#{}'.format(parser.name)))
"""Subclass ArgumentParser to be more suitable for runtime parsing.
Attributes: name: The command name. """
"""Get the name an argument should have based on its Python name."""
"one of: {}".format( param.name, value, expected_values))
"""Convert a value based on a type.
Args: param: The argparse.Parameter we're checking types: The allowed type value: The value to convert str_choices: The allowed choices if the type ends up being a string
Return: The converted value """
# int, float, etc. param.name, typ.__name__, value) else:
"""Convert a value based on a choice of types.
Args: param: The inspect.Parameter we're checking types: The allowed types ("overloads") value: The value to convert str_choices: The allowed choices if the type ends up being a string
Return: The converted value """ # Make sure str is always the last type in the list, so e.g. '23' gets # returned as 23 if we have typing.Union[str, int]
param.name, value)) |