def get_latest_changelog():
 started = False
 lines = []
 with open(CHANGELOG) as f:
  for line in f:
   if re.match('^--+$', line.strip()):
    if started:
     del lines[(-1)]
     break
    else:
     started = True
   elif started:
    lines.append(line)
 return ''.join(lines).strip()

def get_latest_changelog ( ) : started = False lines = [ ] with open ( CHANGELOG ) as f : for line in f : if re . match ( '^--+$' , line . strip ( ) ) : if started : del lines [ ( - 1 ) ] break else : started = True elif started : lines . append ( line ) return '' . join ( lines ) . strip ( )
extract the first section of the changelog .