def parse_changes():
    """ grab version from CHANGES and validate entry """

    with open('CHANGES') as changes:
        for match in re.finditer(RE_CHANGES, changes.read(1024), re.M):
            if len(match.group(1)) != len(match.group(3)):
                error('incorrect underline in CHANGES')

            date = datetime.datetime.strptime(match.group(4),
                                              '%Y-%m-%d').date()

            if date != datetime.date.today():
                error('release date is not today')

            return match.group(2)

    error('invalid release entry in CHANGES')
def parse_changes ( ) : with open ( 'CHANGES' ) as changes : for match in re . finditer ( RE_CHANGES , changes . read ( 1024 ) , re . M ) : if len ( match . group ( 1 ) ) != len ( match . group ( 3 ) ) : error ( 'incorrect underline in CHANGES' ) date = datetime . datetime . strptime ( match . group ( 4 ) , '%Y-%m-%d' ) . date ( ) if date != datetime . date . today ( ) : error ( 'release date is not today' ) return match . group ( 2 ) error ( 'invalid release entry in CHANGES' )
grab version from CHANGES and validate entry