def read_rels(archive):
 xml_source = archive.read(ARC_WORKBOOK_RELS)
 tree = fromstring(xml_source)
 for element in safe_iterator(tree, ('{%s}Relationship' % PKG_REL_NS)):
  rId = element.get('Id')
  pth = element.get('Target')
  typ = element.get('Type')
  if pth.startswith('/xl'):
   pth = pth.replace('/xl', 'xl')
  elif ((not pth.startswith('xl')) and (not pth.startswith('..'))):
   pth = ('xl/' + pth)
  (yield (rId, {'path': pth, 'type': typ}))

def read_rels ( archive ) : xml_source = archive . read ( ARC_WORKBOOK_RELS ) tree = fromstring ( xml_source ) for element in safe_iterator ( tree , ( '{%s}Relationship' % PKG_REL_NS ) ) : rId = element . get ( 'Id' ) pth = element . get ( 'Target' ) typ = element . get ( 'Type' ) if pth . startswith ( '/xl' ) : pth = pth . replace ( '/xl' , 'xl' ) elif ( ( not pth . startswith ( 'xl' ) ) and ( not pth . startswith ( '..' ) ) ) : pth = ( 'xl/' + pth ) ( yield ( rId , { 'path' : pth , 'type' : typ } ) )
read relationships for a workbook .