![]() |
Qucs-S S-parameter Viewer & RF Synthesis Tools
|


Public Member Functions | |
| None | __init__ (self, cabc.Iterable[ParamTypeValue] choices, bool case_sensitive=True) |
| dict[str, t.Any] | to_info_dict (self) |
| str | normalize_choice (self, ParamTypeValue choice, Context|None ctx) |
| str|None | get_metavar (self, Parameter param, Context ctx) |
| str | get_missing_message (self, Parameter param, Context|None ctx) |
| ParamTypeValue | convert (self, t.Any value, Parameter|None param, Context|None ctx) |
| str | get_invalid_choice_message (self, t.Any value, Context|None ctx) |
| str | __repr__ (self) |
| list[CompletionItem] | shell_complete (self, Context ctx, Parameter param, str incomplete) |
Public Member Functions inherited from click.types.ParamType | |
| t.Any | __call__ (self, t.Any value, Parameter|None param=None, Context|None ctx=None) |
| cabc.Sequence[str] | split_envvar_value (self, str rv) |
| t.NoReturn | fail (self, str message, Parameter|None param=None, Context|None ctx=None) |
Public Attributes | |
| case_sensitive | |
| choices | |
Public Attributes inherited from click.types.ParamType | |
| envvar_list_splitter | |
Static Public Attributes | |
| str | name = "choice" |
Static Public Attributes inherited from click.types.ParamType | |
| t | is_composite = False |
| t | arity = 1 |
| str | name |
| t | envvar_list_splitter = None |
Protected Member Functions | |
| cabc.Mapping[ParamTypeValue, str] | _normalized_mapping (self, Context|None ctx=None) |
The choice type allows a value to be checked against a fixed set
of supported values.
You may pass any iterable value which will be converted to a tuple
and thus will only be iterated once.
The resulting value will always be one of the originally passed choices.
See :meth:`normalize_choice` for more info on the mapping of strings
to choices. See :ref:`choice-opts` for an example.
:param case_sensitive: Set to false to make choices case
insensitive. Defaults to true.
.. versionchanged:: 8.2.0
Non-``str`` ``choices`` are now supported. It can additionally be any
iterable. Before you were not recommended to pass anything but a list or
tuple.
.. versionadded:: 8.2.0
Choice normalization can be overridden via :meth:`normalize_choice`.
|
protected |
Returns mapping where keys are the original choices and the values are the normalized values that are accepted via the command line. This is a simple wrapper around :meth:`normalize_choice`, use that instead which is supported.
| ParamTypeValue click.types.Choice.convert | ( | self, | |
| t.Any | value, | ||
| Parameter | None | param, | ||
| Context | None | ctx | ||
| ) |
For a given value from the parser, normalize it and find its matching normalized value in the list of choices. Then return the matched "original" choice.
Reimplemented from click.types.ParamType.
| str click.types.Choice.get_invalid_choice_message | ( | self, | |
| t.Any | value, | ||
| Context | None | ctx | ||
| ) |
Get the error message when the given choice is invalid. :param value: The invalid value. .. versionadded:: 8.2
Returns the metavar default for this param if it provides one.
Reimplemented from click.types.ParamType.
Message shown when no choice is passed. .. versionchanged:: 8.2.0 Added ``ctx`` argument.
Reimplemented from click.types.ParamType.
| str click.types.Choice.normalize_choice | ( | self, | |
| ParamTypeValue | choice, | ||
| Context | None | ctx | ||
| ) |
Normalize a choice value, used to map a passed string to a choice. Each choice must have a unique normalized value. By default uses :meth:`Context.token_normalize_func` and if not case sensitive, convert it to a casefolded value. .. versionadded:: 8.2.0
| list[CompletionItem] click.types.Choice.shell_complete | ( | self, | |
| Context | ctx, | ||
| Parameter | param, | ||
| str | incomplete | ||
| ) |
Complete choices that start with the incomplete value. :param ctx: Invocation context for this command. :param param: The parameter that is requesting completion. :param incomplete: Value being completed. May be empty. .. versionadded:: 8.0
Reimplemented from click.types.ParamType.
| dict[str, t.Any] click.types.Choice.to_info_dict | ( | self | ) |
Gather information that could be useful for a tool generating user-facing documentation. Use :meth:`click.Context.to_info_dict` to traverse the entire CLI structure. .. versionadded:: 8.0
Reimplemented from click.types.ParamType.