class IntRange(_NumberRangeBase, IntParamType): (source)
Restrict an :data:`click.INT` value to a range of accepted values. See :ref:`ranges`. If ``min`` or ``max`` are not passed, any value is accepted in that direction. If ``min_open`` or ``max_open`` are enabled, the corresponding boundary is not included in the range. If ``clamp`` is enabled, a value outside the range is clamped to the boundary instead of failing. .. versionchanged:: 8.0 Added the ``min_open`` and ``max_open`` parameters.
Class Variable | name |
Undocumented |
Method | _clamp |
Find the valid value to clamp to bound in the given direction. |
Inherited from _NumberRangeBase
:
Method | __init__ |
Undocumented |
Method | __repr__ |
Undocumented |
Method | convert |
Convert the value to the correct type. This is not called if the value is ``None`` (the missing value). |
Method | to |
Gather information that could be useful for a tool generating user-facing documentation. |
Instance Variable | clamp |
Undocumented |
Instance Variable | max |
Undocumented |
Instance Variable | max |
Undocumented |
Instance Variable | min |
Undocumented |
Instance Variable | min |
Undocumented |
Method | _describe |
Describe the range for use in help text. |
Inherited from _NumberParamTypeBase
(via _NumberRangeBase
):
Class Variable | _number |
Undocumented |
Inherited from ParamType
(via _NumberRangeBase
, _NumberParamTypeBase
):
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. |
Class Variable | arity |
Undocumented |
Class Variable | envvar |
Undocumented |
Class Variable | is |
Undocumented |
Inherited from IntParamType
:
Method | __repr__ |
Undocumented |
Inherited from _NumberParamTypeBase
(via IntParamType
):
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
(via IntParamType
, _NumberParamTypeBase
):
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 |
click.types._NumberRangeBase._clamp
Find the valid value to clamp to bound in the given direction. :param bound: The boundary value. :param dir: 1 or -1 indicating the direction to move. :param open: If true, the range does not include the bound.
Parameters | |
bound:int | Undocumented |
dir:te.Literal[ | Undocumented |
open:bool | Undocumented |
Returns | |
int | Undocumented |