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

Method _get_by_sha1

src/docx/package.py:87–93  ·  view source on GitHub ↗

Return the image part in this collection having a SHA1 hash matching `sha1`, or |None| if not found.

(self, sha1: str)

Source from the content-addressed store, hash-verified

85 return image_part
86
87 def _get_by_sha1(self, sha1: str) -> ImagePart | None:
88 """Return the image part in this collection having a SHA1 hash matching `sha1`,
89 or |None| if not found."""
90 for image_part in self._image_parts:
91 if image_part.sha1 == sha1:
92 return image_part
93 return None
94
95 def _next_image_partname(self, ext: str) -> PackURI:
96 """The next available image partname, starting from ``/word/media/image1.{ext}``

Callers 1

get_or_add_image_partMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected