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

Method __new__

src/docx/opc/part.py:182–196  ·  view source on GitHub ↗
(
        cls,
        partname: PackURI,
        content_type: str,
        reltype: str,
        blob: bytes,
        package: Package,
    )

Source from the content-addressed store, hash-verified

180 default_part_type = Part
181
182 def __new__(
183 cls,
184 partname: PackURI,
185 content_type: str,
186 reltype: str,
187 blob: bytes,
188 package: Package,
189 ):
190 PartClass: Type[Part] | None = None
191 if cls.part_class_selector is not None:
192 part_class_selector = cls_method_fn(cls, "part_class_selector")
193 PartClass = part_class_selector(content_type, reltype)
194 if PartClass is None:
195 PartClass = cls._part_cls_for(content_type)
196 return PartClass.load(partname, content_type, blob, package)
197
198 @classmethod
199 def _part_cls_for(cls, content_type: str):

Callers

nothing calls this directly

Calls 4

cls_method_fnFunction · 0.90
part_class_selectorFunction · 0.85
_part_cls_forMethod · 0.80
loadMethod · 0.45

Tested by

no test coverage detected