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 type

  • StrCast – Cast to the int type

  • StrCast – Cast to the float type

  • StrCast – 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] type

  • ListIntCast – Cast to the list[int] type

  • ListFloatCast – Cast to the list[float] type

  • ListBoolCast – 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] type

  • DictStrIntCast – Cast to the dict[str, int] type

  • DictStrFloatCast – Cast to the dict[str, float] type

  • DictStrBoolCast – Cast to the dict[str, bool] type

  • DictIntStrCast – Cast to the dict[int, str] type

  • DictIntIntCast – Cast to the dict[int, int] type

  • DictIntFloatCast – Cast to the dict[int, float] type

  • DictIntBoolCast – Cast to the dict[int, bool] type