Class - IpAddressParamType#

class openfl.utilities.click_types.IpAddressParamType[source]#

Bases: ParamType

IpAddress Type for click arguments.

This class is used to validate that a command line argument is an IP address.

name#

The name of the parameter type.

Type:

str

__init__()#

Methods

__init__()

convert(value, param, ctx)

Validate value, if value is valid, return it.

fail(message[, param, ctx])

Helper method to fail with an invalid value message.

get_metavar(param, ctx)

Returns the metavar default for this param if it provides one.

get_missing_message(param, ctx)

Optionally might return extra information about a missing parameter.

shell_complete(ctx, param, incomplete)

Return a list of CompletionItem objects for the incomplete value.

split_envvar_value(rv)

Given a value from an environment variable this splits it up into small chunks depending on the defined envvar list splitter.

to_info_dict()

Gather information that could be useful for a tool generating user-facing documentation.

Attributes

arity

envvar_list_splitter

if a list of this type is expected and the value is pulled from a string environment variable, this is what splits it up.

is_composite

name

the descriptive name of this type

convert(value, param, ctx)[source]#

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:

The value, if it is valid.

Return type:

str

Raises:

click.exceptions.BadParameter – If the value is not a valid IP address.

envvar_list_splitter: t.ClassVar[str | None] = 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.pathsep by default (“:” on Unix and “;” on Windows).

fail(message, param=None, ctx=None)[source]#

Helper method to fail with an invalid value message.

Parameters:
  • message (str)

  • param (Parameter | None)

  • ctx (Context | None)

Return type:

t.NoReturn

get_metavar(param, ctx)[source]#

Returns the metavar default for this param if it provides one.

Parameters:
  • param (Parameter)

  • ctx (Context)

Return type:

str | None

get_missing_message(param, ctx)[source]#

Optionally might return extra information about a missing parameter.

Added in version 2.0.

Parameters:
  • param (Parameter)

  • ctx (Context | None)

Return type:

str | None

name: str = 'IpAddress type'#

the descriptive name of this type

shell_complete(ctx, param, incomplete)[source]#

Return a list of 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.

Parameters:
  • ctx (Context) – Invocation context for this command.

  • param (Parameter) – The parameter that is requesting completion.

  • incomplete (str) – Value being completed. May be empty.

Return type:

list[CompletionItem]

Added in version 8.0.

split_envvar_value(rv)[source]#

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.

Parameters:

rv (str)

Return type:

Sequence[str]

to_info_dict()[source]#

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.

Return type:

dict[str, Any]