Class - InputSpec#

class openfl.utilities.click_types.InputSpec(param_decls=None, show_default=None, prompt=False, confirmation_prompt=False, prompt_required=True, hide_input=False, is_flag=None, flag_value=Sentinel.UNSET, multiple=False, count=False, allow_from_autoenv=True, type=None, help=None, hidden=False, show_choices=True, show_envvar=False, deprecated=False, **attrs)[source]#

Bases: Option

List or dictionary that corresponds to the input shape for a model

Parameters:
  • param_decls (cabc.Sequence[str] | None)

  • show_default (bool | str | None)

  • prompt (bool | str)

  • confirmation_prompt (bool | str)

  • prompt_required (bool)

  • hide_input (bool)

  • is_flag (bool | None)

  • flag_value (t.Any)

  • multiple (bool)

  • count (bool)

  • allow_from_autoenv (bool)

  • type (types.ParamType | t.Any | None)

  • help (str | None)

  • hidden (bool)

  • show_choices (bool)

  • show_envvar (bool)

  • deprecated (bool | str)

  • attrs (t.Any)

__init__(param_decls=None, show_default=None, prompt=False, confirmation_prompt=False, prompt_required=True, hide_input=False, is_flag=None, flag_value=Sentinel.UNSET, multiple=False, count=False, allow_from_autoenv=True, type=None, help=None, hidden=False, show_choices=True, show_envvar=False, deprecated=False, **attrs)[source]#
Parameters:
  • param_decls (Sequence[str] | None)

  • show_default (bool | str | None)

  • prompt (bool | str)

  • confirmation_prompt (bool | str)

  • prompt_required (bool)

  • hide_input (bool)

  • is_flag (bool | None)

  • flag_value (Any)

  • multiple (bool)

  • count (bool)

  • allow_from_autoenv (bool)

  • type (ParamType | Any | None)

  • help (str | None)

  • hidden (bool)

  • show_choices (bool)

  • show_envvar (bool)

  • deprecated (bool | str)

  • attrs (Any)

Return type:

None

Methods

__init__([param_decls, show_default, ...])

add_to_parser(parser, ctx)

consume_value(ctx, opts)

For Option, the value can be collected from an interactive prompt if the option is a flag that needs a value (and the prompt property is set).

get_default(ctx[, call])

Get the default for the parameter.

get_error_hint(ctx)

Get a stringified version of the param for use in error messages to indicate which param caused the error.

get_help_extra(ctx)

get_help_record(ctx)

get_usage_pieces(ctx)

handle_parse_result(ctx, opts, args)

Process the value produced by the parser from user input.

make_metavar(ctx)

process_value(ctx, value)

Process the value of this parameter:

prompt_for_value(ctx)

This is an alternative flow that can be activated in the full value processing if a value does not exist.

resolve_envvar_value(ctx)

Option resolves its environment variable the same way as Parameter.resolve_envvar_value(), but it also supports Context.auto_envvar_prefix. If we could not find an environment from the envvar property, we fallback on Context.auto_envvar_prefix to build dynamiccaly the environment variable name using the :python:`{ctx.auto_envvar_prefix}_{self.name.upper()}` template.

shell_complete(ctx, incomplete)

Return a list of completions for the incomplete value.

to_info_dict()

type_cast_value(ctx, value)

Convert and validate a value against the parameter's type, multiple, and nargs.

value_from_envvar(ctx)

For Option, this method processes the raw environment variable string the same way as Parameter.value_from_envvar() does.

value_is_missing(value)

A value is considered missing if:

Attributes

human_readable_name

Returns the human readable name of this parameter.

param_type_name

get_default(ctx, call=True)[source]#

Get the default for the parameter. Tries Context.lookup_default() first, then the local default.

Parameters:
  • ctx (Context) – Current context.

  • call (bool) – If the default is a callable, call it. Disable to return the callable instead.

Return type:

Any | Callable[[], Any] | None

Changed in version 8.0.2: Type casting is no longer performed when getting a default.

Changed in version 8.0.1: Type casting can fail in resilient parsing mode. Invalid defaults will not prevent showing help text.

Changed in version 8.0: Looks at ctx.default_map first.

Changed in version 8.0: Added the call parameter.

get_error_hint(ctx)[source]#

Get a stringified version of the param for use in error messages to indicate which param caused the error.

Parameters:

ctx (Context)

Return type:

str

property human_readable_name: str[source]#

Returns the human readable name of this parameter. This is the same as the name for options, but the metavar for arguments.

prompt_for_value(ctx)[source]#

This is an alternative flow that can be activated in the full value processing if a value does not exist. It will prompt the user until a valid value exists and then returns the processed value as result.

Parameters:

ctx (Context)

Return type:

Any

shell_complete(ctx, incomplete)[source]#

Return a list of completions for the incomplete value. If a shell_complete function was given during init, it is used. Otherwise, the type shell_complete() function is used.

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

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

Return type:

list[CompletionItem]

Added in version 8.0.

to_info_dict()[source]#

Changed in version 8.3.0: Returns None for the flag_value if it was not set.

Return type:

dict[str, Any]

type_cast_value(ctx, value)[source]#

Convert and validate a value against the parameter’s type, multiple, and nargs.