class _NumberParamTypeBase(ParamType): (source)
Known subclasses: click.types.FloatParamType
, click.types.IntParamType
, click.types._NumberRangeBase
Undocumented
Method | convert |
Convert the value to the correct type. This is not called if the value is ``None`` (the missing value). |
Class Variable | _number |
Undocumented |
Inherited from ParamType
:
Method | __call__ |
Undocumented |
Method | fail |
Helper method to fail with an invalid value message. |
Method | get |
Returns the metavar default for this param if it provides one. |
Method | get |
Optionally might return extra information about a missing parameter. |
Method | shell |
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. |
Method | split |
Given a value from an environment variable this splits it up into small chunks depending on the defined envvar list splitter. |
Method | to |
Gather information that could be useful for a tool generating user-facing documentation. |
Class Variable | arity |
Undocumented |
Class Variable | envvar |
Undocumented |
Class Variable | is |
Undocumented |
Class Variable | name |
Undocumented |
click.types.ParamType.convert
click.types._NumberRangeBase
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``.
Parameters | |
value:t.Any | Undocumented |
param:t.Optional[ | Undocumented |
ctx:t.Optional[ | Undocumented |
Returns | |
t.Any | Undocumented |