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

Method part_related_by

src/docx/opc/part.py:117–124  ·  view source on GitHub ↗

Return part to which this part has a relationship of `reltype`. Raises |KeyError| if no such relationship is found and |ValueError| if more than one such relationship is found. Provides ability to resolve implicitly related part, such as Slide -> SlideLayout.

(self, reltype: str)

Source from the content-addressed store, hash-verified

115 self._partname = partname
116
117 def part_related_by(self, reltype: str) -> Part:
118 """Return part to which this part has a relationship of `reltype`.
119
120 Raises |KeyError| if no such relationship is found and |ValueError| if more than
121 one such relationship is found. Provides ability to resolve implicitly related
122 part, such as Slide -> SlideLayout.
123 """
124 return self.rels.part_with_reltype(reltype)
125
126 def relate_to(self, target: Part | str, reltype: str, is_external: bool = False) -> str:
127 """Return rId key of relationship of `reltype` to `target`.

Callers 6

numbering_partMethod · 0.45
_comments_partMethod · 0.45
_settings_partMethod · 0.45
_styles_partMethod · 0.45

Calls 1

part_with_reltypeMethod · 0.80