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

Method __getitem__

src/docx/shape.py:28–36  ·  view source on GitHub ↗

Provide indexed access, e.g. 'inline_shapes[idx]'.

(self, idx: int)

Source from the content-addressed store, hash-verified

26 self._body = body_elm
27
28 def __getitem__(self, idx: int):
29 """Provide indexed access, e.g. 'inline_shapes[idx]'."""
30 try:
31 inline = self._inline_lst[idx]
32 except IndexError:
33 msg = "inline shape index [%d] out of range" % idx
34 raise IndexError(msg)
35
36 return InlineShape(inline)
37
38 def __iter__(self):
39 return (InlineShape(inline) for inline in self._inline_lst)

Callers

nothing calls this directly

Calls 1

InlineShapeClass · 0.85

Tested by

no test coverage detected