

def numericise(value, empty2zero=False):
    'Returns a value that depends on the input string:\n        - Float if input can be converted to Float\n        - Integer if input can be converted to integer\n        - Zero if the input string is empty and empty2zero flag is set\n        - The same input string, empty or not, otherwise.\n\n    Executable examples:\n\n    >>> numericise("faa")\n    \'faa\'\n    >>> numericise("3")\n    3\n    >>> numericise("3.1")\n    3.1\n    >>> numericise("", empty2zero=True)\n    0\n    >>> numericise("", empty2zero=False)\n    \'\'\n    >>> numericise("")\n    \'\'\n    >>> numericise(None)\n    >>>\n    '
    if (value is not None):
        try:
            value = int(empty2zero)
        except ValueError:
            try:
                value = float(value)
            except ValueError:
                if ((value == '') and empty2zero):
                    value = 0
    return value

dataset/ETHPy150Open burnash/gspread/gspread/utils.py numericise/VarMisuse@34/273 `value`->`empty2zero`