Qucs-S S-parameter Viewer & RF Synthesis Tools
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
click.types.ParamType Class Reference
Inheritance diagram for click.types.ParamType:
Inheritance graph
[legend]
Collaboration diagram for click.types.ParamType:
Collaboration graph
[legend]

Public Member Functions

dict[str, t.Any] to_info_dict (self)
 
t.Any __call__ (self, t.Any value, Parameter|None param=None, Context|None ctx=None)
 
str|None get_metavar (self, Parameter param, Context ctx)
 
str|None get_missing_message (self, Parameter param, Context|None ctx)
 
t.Any convert (self, t.Any value, Parameter|None param, Context|None ctx)
 
cabc.Sequence[str] split_envvar_value (self, str rv)
 
t.NoReturn fail (self, str message, Parameter|None param=None, Context|None ctx=None)
 
list[CompletionItemshell_complete (self, Context ctx, Parameter param, str incomplete)
 

Public Attributes

 envvar_list_splitter
 

Static Public Attributes

is_composite = False
 
arity = 1
 
str name
 
envvar_list_splitter = None
 

Detailed Description

Represents the type of a parameter. Validates and converts values
from the command line or Python into the correct type.

To implement a custom type, subclass and implement at least the
following:

-   The :attr:`name` class attribute must be set.
-   Calling an instance of the type with ``None`` must return
    ``None``. This is already implemented by default.
-   :meth:`convert` must convert string values to the correct type.
-   :meth:`convert` must accept values that are already the correct
    type.
-   It must be able to convert a value if the ``ctx`` and ``param``
    arguments are ``None``. This can occur when converting prompt
    input.

Member Function Documentation

◆ convert()

t.Any click.types.ParamType.convert (   self,
t.Any  value,
Parameter | None  param,
Context | None   ctx 
)
Convert the value to the correct type. This is not called if
the value is ``None`` (the missing value).

This must accept string values from the command line, as well as
values that are already the correct type. It may also convert
other compatible types.

The ``param`` and ``ctx`` arguments may be ``None`` in certain
situations, such as when converting prompt input.

If the value cannot be converted, call :meth:`fail` with a
descriptive message.

:param value: The value to convert.
:param param: The parameter that is using this type to convert
    its value. May be ``None``.
:param ctx: The current context that arrived at this value. May
    be ``None``.

Reimplemented in click.types.Path, click.types.File, click.types.FuncParamType, click.types.UnprocessedParamType, click.types.StringParamType, click.types.Choice, click.types.DateTime, click.types._NumberParamTypeBase, click.types._NumberRangeBase, click.types.BoolParamType, click.types.UUIDParameterType, and click.types.Tuple.

◆ fail()

t.NoReturn click.types.ParamType.fail (   self,
str  message,
Parameter | None   param = None,
Context | None   ctx = None 
)
Helper method to fail with an invalid value message.

◆ get_metavar()

str | None click.types.ParamType.get_metavar (   self,
Parameter  param,
Context  ctx 
)
Returns the metavar default for this param if it provides one.

Reimplemented in click.types.Choice, and click.types.DateTime.

◆ get_missing_message()

str | None click.types.ParamType.get_missing_message (   self,
Parameter  param,
Context | None  ctx 
)
Optionally might return extra information about a missing
parameter.

.. versionadded:: 2.0

Reimplemented in click.types.Choice.

◆ shell_complete()

list[CompletionItem] click.types.ParamType.shell_complete (   self,
Context  ctx,
Parameter  param,
str   incomplete 
)
Return a list of
:class:`~click.shell_completion.CompletionItem` objects for the
incomplete value. Most types do not provide completions, but
some do, and this allows custom types to provide custom
completions as well.

: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 in click.types.Choice, click.types.File, and click.types.Path.

◆ split_envvar_value()

cabc.Sequence[str] click.types.ParamType.split_envvar_value (   self,
str  rv 
)
Given a value from an environment variable this splits it up
into small chunks depending on the defined envvar list splitter.

If the splitter is set to `None`, which means that whitespace splits,
then leading and trailing whitespace is ignored.  Otherwise, leading
and trailing splitters usually lead to empty items being included.

◆ to_info_dict()

dict[str, t.Any] click.types.ParamType.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 in click.types.FuncParamType, click.types.Choice, click.types.DateTime, click.types._NumberRangeBase, click.types.File, click.types.Path, and click.types.Tuple.


The documentation for this class was generated from the following file: