Python types
If you need a refresher about how to use Python type hints, read here Python Type Checking (Guide).
You can also check the mypy cheat sheet. In short (very short), you can declare a function with parameters like:
from enum import Enum
class Color(Enum):
WHITE = 1
RED = 2
def type_example(name: str, formal: bool, exit: int, amount: float, color: Color, *args: str, **kwargs: int):
pass
And your editor (and DynaCLI) will know that:
name
is type ofstr
and is a required parameter.formal
is type ofbool
and is a required parameter.exit
is type ofint
and is a required parameter.amount
is type offloat
and is a required parameter.color
is type ofColor
and is a required parameter.*args
variable length arguments with type ofstr
.**kwargs
keyword arguments with type ofint
.
These type hints are what give you autocomplete in your editor and several other features.
DynaCLI is based on these type hints.