string_to_type¶
- Stoner.core.base.string_to_type(value: Union[str, bytes]) Any [source]¶
Given a string value try to work out if there is a better python type dor the value.
First of all the first character is checked to see if it is a [ or { which would suggest this is a list of dictionary. If the value looks like a common boolean value (i.e. Yes, No, True, Fale, On, Off) then it is assumed to be a boolean value. Finally it interpretation as an int, float or string is tried.
- Parameters:
value (string) – string representation of he value
- Returns:
A python object of the natural type for value