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

Method iter_items

src/docx/oxml/text/run.py:69–87  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

67 accum = TextAccumulator()
68
69 def iter_items() -> Iterator[str | CT_Drawing | CT_LastRenderedPageBreak]:
70 for e in self.xpath(
71 "w:br"
72 " | w:cr"
73 " | w:drawing"
74 " | w:lastRenderedPageBreak"
75 " | w:noBreakHyphen"
76 " | w:ptab"
77 " | w:t"
78 " | w:tab"
79 ):
80 if isinstance(e, (CT_Drawing, CT_LastRenderedPageBreak)):
81 yield from accum.pop()
82 yield e
83 else:
84 accum.push(str(e))
85
86 # -- don't forget the "tail" string --
87 yield from accum.pop()
88
89 return list(iter_items())
90

Callers

nothing calls this directly

Calls 3

xpathMethod · 0.80
popMethod · 0.80
pushMethod · 0.80

Tested by

no test coverage detected