openfl.utilities.click_types.IpAddressParamType
- class openfl.utilities.click_types.IpAddressParamType
Bases:
ParamTypeIpAddress Type for click arguments.
This class is used to validate that a command line argument is an IP address.
- Class Attributes:
name (str) – The name of the parameter type.
Methods
Validate value, if value is valid, return it.
Helper method to fail with an invalid value message.
Returns the metavar default for this param if it provides one.
Optionally might return extra information about a missing parameter.
Return a list of
CompletionItemobjects for the incomplete value.Given a value from an environment variable this splits it up into small chunks depending on the defined envvar list splitter.
Gather information that could be useful for a tool generating user-facing documentation.
Attributes
arityif a list of this type is expected and the value is pulled from a string environment variable, this is what splits it up.
is_compositethe descriptive name of this type
- __call__(value: Any, param: Parameter | None = None, ctx: Context | None = None) Any
Call self as a function.
- convert(value, param, ctx)
Validate value, if value is valid, return it.
- Parameters:
value (str) – The value to validate.
param (click.core.Option) – The option that this value was supplied to.
ctx (click.core.Context) – The context for the parameter.
- Returns:
str – The value, if it is valid.
- Raises:
click.exceptions.BadParameter – If the value is not a valid IP address.
- envvar_list_splitter: t.ClassVar[t.Optional[str]] = None
if a list of this type is expected and the value is pulled from a string environment variable, this is what splits it up. None means any whitespace. For all parameters the general rule is that whitespace splits them up. The exception are paths and files which are split by
os.path.pathsepby default (“:” on Unix and “;” on Windows).
- fail(message: str, param: Parameter | None = None, ctx: Context | None = None) t.NoReturn
Helper method to fail with an invalid value message.
- get_metavar(param: Parameter) str | None
Returns the metavar default for this param if it provides one.
- get_missing_message(param: Parameter) str | None
Optionally might return extra information about a missing parameter.
Added in version 2.0.
- name: str = 'IpAddress type'
the descriptive name of this type
- shell_complete(ctx: Context, param: Parameter, incomplete: str) List[CompletionItem]
Return a list of
CompletionItemobjects for the incomplete value. Most types do not provide completions, but some do, and this allows custom types to provide custom completions as well.- Parameters:
ctx – Invocation context for this command.
param – The parameter that is requesting completion.
incomplete – Value being completed. May be empty.
Added in version 8.0.
- split_envvar_value(rv: str) Sequence[str]
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, Any]
Gather information that could be useful for a tool generating user-facing documentation.
Use
click.Context.to_info_dict()to traverse the entire CLI structure.Added in version 8.0.