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

Method _styles_part

src/docx/parts/document.py:157–169  ·  view source on GitHub ↗

Instance of |StylesPart| for this document. Creates an empty styles part if one is not present.

(self)

Source from the content-addressed store, hash-verified

155
156 @property
157 def _styles_part(self) -> StylesPart:
158 """Instance of |StylesPart| for this document.
159
160 Creates an empty styles part if one is not present.
161 """
162 try:
163 return cast(StylesPart, self.part_related_by(RT.STYLES))
164 except KeyError:
165 package = self.package
166 assert package is not None
167 styles_part = StylesPart.default(package)
168 self.relate_to(styles_part, RT.STYLES)
169 return styles_part

Callers

nothing calls this directly

Calls 3

part_related_byMethod · 0.45
defaultMethod · 0.45
relate_toMethod · 0.45

Tested by

no test coverage detected