def str2boolintorfloat(str_):
    match = re.match('([\d\.]+)', str_)
    type_ = None
    if not match:
        type_ = str_.__class__
        value = str_
        value_lower = value.strip().lower()
        if value_lower == 'true':
            type_ = bool
            value = True
        elif value_lower == 'false':
            type_ = bool
            value = False
        return value
    else:
        try:
            numstr = match.group(1)
            if '.' in numstr:
                type_ = float
                value = type_(numstr)
            else:
                type_ = int
                value = type_(numstr)
        except (ValueError, NameError, IndexError) as e:
            value = str_
            log.exception((e, (type_, value)))
    return value
Try to cast a string as a ``bool``, ``float``, ``int``,
dataset/ETHPy150Open westurner/pyline/pyline.py/str2boolintorfloat