MCPcopy Index your code
hub / github.com/python-openxml/python-docx / _unmarshal_relationships

Method _unmarshal_relationships

src/docx/opc/package.py:212–219  ·  view source on GitHub ↗

Add a relationship to the source object corresponding to each of the relationships in `pkg_reader` with its target_part set to the actual target part in `parts`.

(pkg_reader, package, parts)

Source from the content-addressed store, hash-verified

210
211 @staticmethod
212 def _unmarshal_relationships(pkg_reader, package, parts):
213 """Add a relationship to the source object corresponding to each of the
214 relationships in `pkg_reader` with its target_part set to the actual target part
215 in `parts`."""
216 for source_uri, srel in pkg_reader.iter_srels():
217 source = package if source_uri == "/" else parts[source_uri]
218 target = srel.target_ref if srel.is_external else parts[srel.target_partname]
219 source.load_rel(srel.reltype, target, srel.rId, srel.is_external)

Callers 2

unmarshalMethod · 0.80

Calls 2

iter_srelsMethod · 0.80
load_relMethod · 0.45

Tested by 1