MCPcopy Create free account
hub / github.com/python-openxml/python-docx / _unmarshal_parts

Method _unmarshal_parts

src/docx/opc/package.py:199–209  ·  view source on GitHub ↗

Return a dictionary of |Part| instances unmarshalled from `pkg_reader`, keyed by partname. Side-effect is that each part in `pkg_reader` is constructed using `part_factory`.

(pkg_reader, package, part_factory)

Source from the content-addressed store, hash-verified

197
198 @staticmethod
199 def _unmarshal_parts(pkg_reader, package, part_factory):
200 """Return a dictionary of |Part| instances unmarshalled from `pkg_reader`, keyed
201 by partname.
202
203 Side-effect is that each part in `pkg_reader` is constructed using
204 `part_factory`.
205 """
206 parts = {}
207 for partname, content_type, reltype, blob in pkg_reader.iter_sparts():
208 parts[partname] = part_factory(partname, content_type, reltype, blob, package)
209 return parts
210
211 @staticmethod
212 def _unmarshal_relationships(pkg_reader, package, parts):

Callers 2

unmarshalMethod · 0.80

Calls 1

iter_spartsMethod · 0.80

Tested by 1