MCPcopy Create free account
hub / github.com/scanny/python-pptx / __iter__

Method __iter__

src/pptx/package.py:132–144  ·  view source on GitHub ↗

Generate a reference to each |ImagePart| object in the package.

(self)

Source from the content-addressed store, hash-verified

130 self._package = package
131
132 def __iter__(self) -> Iterator[ImagePart]:
133 """Generate a reference to each |ImagePart| object in the package."""
134 image_parts = []
135 for rel in self._package.iter_rels():
136 if rel.is_external:
137 continue
138 if rel.reltype != RT.IMAGE:
139 continue
140 image_part = rel.target_part
141 if image_part in image_parts:
142 continue
143 image_parts.append(image_part)
144 yield image_part
145
146 def get_or_add_image_part(self, image_file: str | IO[bytes]) -> ImagePart:
147 """Return |ImagePart| object containing the image in `image_file`.

Callers

nothing calls this directly

Calls 2

iter_relsMethod · 0.80
appendMethod · 0.45

Tested by

no test coverage detected