def get_info(pyfile):
    '''Retrieve dunder values from a pyfile'''
    info = {}
    info_re = re.compile(r"^__(\w+)__ = ['\"](.*)['\"]")
    with open(pyfile, 'r') as f:
        for line in f.readlines():
            match = info_re.search(line)
            if match:
                info[match.group(1)] = match.group(2)
    return info
def get_info ( pyfile ) : info = { } info_re = re . compile ( r"^__(\w+)__ = ['\"](.*)['\"]" ) with open ( pyfile , 'r' ) as f : for line in f . readlines ( ) : match = info_re . search ( line ) if match : info [ match . group ( 1 ) ] = match . group ( 2 ) return info
Retrieve dunder values from a pyfile