recline.arg_types.recline_type module
Original © NetApp 2024
This module contains the abstract base class for all recline custom types
- class recline.arg_types.recline_type.ReclineType
Bases:
ABC
The base class for all other custom types in recline. Default values for argparse are defined within each type.
- action
alias of
UniqueParam
- choices(eager=False) List[Any] | None
If an argument has a set list of choices that can be provided for it, then the type can specify to only allow that list
- completer(*args, **kwargs) List[Any]
The completer function should return a list of values that are valid for the argument. This function will usually be implemented such that it is dynamic based on some API call or some current application state. If it is a static set of choices, it would be easier to use the choices method instead.
- metavar = '<value>'
- nargs() str | int | None
The number of arguments that this type can accept. See the argparse documentation for details: https://docs.python.org/3/library/argparse.html#nargs
- validate(arg: str) Any
The validate function has two uses. First, a type should verify that the user’s input matches the data that the type accepts. Second, it should transform the data if necessary. For example, it might try to cast a string to an integer and if it can, return the integer value.
If validation fails, a ReclineTypeError should be raised with an appropriate message for the user.
- class recline.arg_types.recline_type.UniqueParam(option_strings, dest, nargs=None, const=None, default=None, type=None, choices=None, required=False, help=None, metavar=None)
Bases:
Action
Utility class that throws an error if more than one occurrence of param is found.