ninjecto.utils.types
¶Utilities to convert string to other data types.
booleanize()
:
Convert a string to a boolean.autocast()
:
Try to convert a string to some basic data types.ninjecto.utils.types.
booleanize
(value)¶Convert a string to a boolean.
ninjecto.utils.types.
autocast
(value)¶Try to convert a string to some basic data types.
datetime
, if string is in ISO8601 with timezone format.int
, if succeeds.float
, if succeeds.boolean
, using the booleanize()
function.If all the above fails, the source string is returned as-is.