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

Class _CellCollection

src/pptx/table.py:427–448  ·  view source on GitHub ↗

Horizontal sequence of row cells

Source from the content-addressed store, hash-verified

425
426
427class _CellCollection(Subshape):
428 """Horizontal sequence of row cells"""
429
430 def __init__(self, tr: CT_TableRow, parent: _Row):
431 super(_CellCollection, self).__init__(parent)
432 self._parent = parent
433 self._tr = tr
434
435 def __getitem__(self, idx: int) -> _Cell:
436 """Provides indexed access, (e.g. 'cells[0]')."""
437 if idx < 0 or idx >= len(self._tr.tc_lst):
438 msg = "cell index [%d] out of range" % idx
439 raise IndexError(msg)
440 return _Cell(self._tr.tc_lst[idx], self)
441
442 def __iter__(self) -> Iterator[_Cell]:
443 """Provides iterability."""
444 return (_Cell(tc, self) for tc in self._tr.tc_lst)
445
446 def __len__(self) -> int:
447 """Supports len() function (e.g. 'len(cells) == 1')."""
448 return len(self._tr.tc_lst)
449
450
451class _ColumnCollection(Subshape):

Callers 5

iter_fixtureMethod · 0.90
len_fixtureMethod · 0.90
cellsMethod · 0.85

Calls

no outgoing calls

Tested by 4

iter_fixtureMethod · 0.72
len_fixtureMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…