Horizontal sequence of row cells
| 425 | |
| 426 | |
| 427 | class _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 | |
| 451 | class _ColumnCollection(Subshape): |
no outgoing calls
searching dependent graphs…