openfl.utilities.click_types.InputSpec
- class openfl.utilities.click_types.InputSpec(param_decls: Sequence[str] | None = None, show_default: bool | str | None = None, prompt: bool | str = False, confirmation_prompt: bool | str = False, prompt_required: bool = True, hide_input: bool = False, is_flag: bool | None = None, flag_value: Any | None = None, multiple: bool = False, count: bool = False, allow_from_autoenv: bool = True, type: ParamType | Any | None = None, help: str | None = None, hidden: bool = False, show_choices: bool = True, show_envvar: bool = False, **attrs: Any)
Bases:
OptionList or dictionary that corresponds to the input shape for a model
Methods
add_to_parserconsume_valueGet the default for the parameter.
Get a stringified version of the param for use in error messages to indicate which param caused the error.
get_help_recordget_usage_pieceshandle_parse_resultmake_metavarprocess_valueThis is an alternative flow that can be activated in the full value processing if a value does not exist.
resolve_envvar_valueReturn a list of completions for the incomplete value.
Gather information that could be useful for a tool generating user-facing documentation.
Convert and validate a value against the option's
type,multiple, andnargs.value_from_envvarvalue_is_missingAttributes
Returns the human readable name of this parameter.
param_type_name- get_default(ctx: Context, call: bool = True) Any | Callable[[], Any] | None
Get the default for the parameter. Tries
Context.lookup_default()first, then the local default.- Parameters:
ctx – Current context.
call – If the default is a callable, call it. Disable to return the callable instead.
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_mapfirst.Changed in version 8.0: Added the
callparameter.
- get_error_hint(ctx: Context) str
Get a stringified version of the param for use in error messages to indicate which param caused the error.
- property human_readable_name: str
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: Context) Any
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.
- shell_complete(ctx: Context, incomplete: str) List[CompletionItem]
Return a list of completions for the incomplete value. If a
shell_completefunction was given during init, it is used. Otherwise, thetypeshell_complete()function is used.- Parameters:
ctx – Invocation context for this command.
incomplete – Value being completed. May be empty.
Added in version 8.0.
- 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.
- type_cast_value(ctx, value)
Convert and validate a value against the option’s
type,multiple, andnargs.