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

Method pop

src/docx/shared.py:372–382  ·  view source on GitHub ↗

Generate sero-or-one str from those accumulated. Using `yield from accum.pop()` in a generator setting avoids producing an empty string when no text is in the accumulator.

(self)

Source from the content-addressed store, hash-verified

370 self._texts.append(text)
371
372 def pop(self) -> Iterator[str]:
373 """Generate sero-or-one str from those accumulated.
374
375 Using `yield from accum.pop()` in a generator setting avoids producing an empty
376 string when no text is in the accumulator.
377 """
378 if not self._texts:
379 return
380 text = self._separator.join(self._texts)
381 self._texts.clear()
382 yield text

Callers 1

iter_itemsMethod · 0.80

Calls 1

clearMethod · 0.45

Tested by

no test coverage detected