Base Module
Custom input handlers for Parameters
- author:
Doug Skrypa
- class cli_command_parser.inputs.base.InputType(fix_default: bool | Any = True)[source]
-
- abstract __call__(value: str) T [source]
Process the parsed argument and convert it to the desired type
- is_valid_type(value: str) bool [source]
Called during parsing when
ParamAction.would_accept()
is called to determine if the value would be accepted later for processing / conversion via__call__()
. May be overridden in subclasses to provide actual validation, if necessary.Note: value validation should happen in
__call__()
, not in this method.- Parameters:
value¶ – A parsed argument
- Returns:
True if this input would accept it for processing later (where it may still be rejected), False if it should be rejected before attempting to process / convert / store it.