def convert_pep0():
 check_paths()
 pep0_path = os.path.join(settings.PEP_REPO_PATH, 'pep-0000.html')
 pep0_content = open(pep0_path).read()
 soup = BeautifulSoup(pep0_content)
 body_children = list(soup.body.children)
 header = body_children[3]
 pep_content = body_children[7]
 body_links = pep_content.find_all('a')
 pep_href_re = re.compile('pep-(\\d+)\\.html')
 for b in body_links:
  m = pep_href_re.search(b.attrs['href'])
  if (not m):
   continue
  b.attrs['href'] = '/dev/peps/pep-{}/'.format(m.group(1))
 header_rows = header.find_all('th')
 for t in header_rows:
  if (('Version:' in t.text) and ('N/A' in t.next_sibling.text)):
   t.parent.extract()
 return ''.join([header.prettify(), pep_content.prettify()])

def convert_pep0 ( ) : check_paths ( ) pep0_path = os . path . join ( settings . PEP_REPO_PATH , 'pep-0000.html' ) pep0_content = open ( pep0_path ) . read ( ) soup = BeautifulSoup ( pep0_content ) body_children = list ( soup . body . children ) header = body_children [ 3 ] pep_content = body_children [ 7 ] body_links = pep_content . find_all ( 'a' ) pep_href_re = re . compile ( 'pep-(\\d+)\\.html' ) for b in body_links : m = pep_href_re . search ( b . attrs [ 'href' ] ) if ( not m ) : continue b . attrs [ 'href' ] = '/dev/peps/pep-{}/' . format ( m . group ( 1 ) ) header_rows = header . find_all ( 'th' ) for t in header_rows : if ( ( 'Version:' in t . text ) and ( 'N/A' in t . next_sibling . text ) ) : t . parent . extract ( ) return '' . join ( [ header . prettify ( ) , pep_content . prettify ( ) ] )
take existing generated pep-0000 .