def _str_to_num(val):
    """Converts a given string to either an int or a float if necessary."""

    try:
        num = int(val)
    except __HOLE__:
        # If this fails then an exception should be raised anyways
        num = float(val)
    return num
dataset/ETHPy150Open spacetelescope/PyFITS/pyfits/util.py/_str_to_num