(fname)
return version
Attempts to find the version number in the file names fname.
    Raises RuntimeError if not found.
Attempts to find the version number in the file names fname.
    Raises RuntimeError if not found.
Attempts to find the version number in the file names fname . Raises RuntimeError if not found .
def find_version(fname):
    """Attempts to find the version number in the file names fname.
    Raises RuntimeError if not found.
    """
    version = ""
    with open(fname) as fp:
        reg = re.compile(r'__version__ = [\'"]([^\'"]*)[\'"]')
        for line in fp:
            m = reg.match(line)
            if m:
                version = m.group(1)
                break
    if not version:
        raise RuntimeError("Cannot find version information")
    return version
def find_version ( fname ) : version = "" with open ( fname ) as fp : reg = re . compile ( r'__version__ = [\'"]([^\'"]*)[\'"]' ) for line in fp : m = reg . match ( line ) if m : version = m . group ( 1 ) break if not version : raise RuntimeError ( "Cannot find version information" ) return version