casts module
Note
This module is imports as from .. import *
. This means that there
is no need to import it separately or use ezbotf.argumentparser.casts.Cast
.
You can simply use ezbotf.argumentparser.ListCast
as example.
Defines initialized type-casts objects. Use it in Argument type definition
Cast
- class ezbotf.argumentparser.casts.Cast
Initialized ArgTypeCast casts
- Variables:
StrCast – Cast to the
str
typeStrCast – Cast to the
int
typeStrCast – Cast to the
float
typeStrCast – Cast to the
bool
type (have type of_casts.BoolCast
)
- static setup_bool_cast_translations(true_list: list[str], false_list: list[str])
Set up the BoolCast type-cast translations
- Parameters:
true_list – List with the true string variants
false_list – List with the false string variants
ListCast
- class ezbotf.argumentparser.casts.ListCast
Initialized ListCast casts. Usage example: ez example value1, value2, value3, …
- Variables:
ListStrCast – Cast to the
list[str]
typeListIntCast – Cast to the
list[int]
typeListFloatCast – Cast to the
list[float]
typeListBoolCast – Cast to the
list[bool]
type
DictCast
- class ezbotf.argumentparser.casts.DictCast
Initialized DictCast casts. Usage example: ez example key1=value2, key2=value2, …
- Variables:
DictStrStrCast – Cast to the
dict[str, str]
typeDictStrIntCast – Cast to the
dict[str, int]
typeDictStrFloatCast – Cast to the
dict[str, float]
typeDictStrBoolCast – Cast to the
dict[str, bool]
typeDictIntStrCast – Cast to the
dict[int, str]
typeDictIntIntCast – Cast to the
dict[int, int]
typeDictIntFloatCast – Cast to the
dict[int, float]
typeDictIntBoolCast – Cast to the
dict[int, bool]
type