Wrap a document cell with runtime state from the graph.
(self, cell: _NotebookCell)
| 502 | return self._ctx._document |
| 503 | |
| 504 | def _cell_view(self, cell: _NotebookCell) -> NotebookCell: |
| 505 | """Wrap a document cell with runtime state from the graph.""" |
| 506 | try: |
| 507 | graph = self._ctx.graph |
| 508 | impl = graph.cells.get(cell.id) |
| 509 | graph_errors = self._ctx._kernel.errors.get(cell.id, ()) |
| 510 | outputs = self._ctx._outputs |
| 511 | except AttributeError: |
| 512 | impl = None |
| 513 | graph_errors = () |
| 514 | outputs = None |
| 515 | |
| 516 | def record_read() -> None: |
| 517 | self._ctx._note_read(cell.id, cell.version) |
| 518 | |
| 519 | return NotebookCell( |
| 520 | cell, |
| 521 | impl, |
| 522 | graph_errors=graph_errors, |
| 523 | outputs=outputs, |
| 524 | record_read=record_read, |
| 525 | ) |
| 526 | |
| 527 | def _cell_ids(self) -> list[CellId_t]: |
| 528 | return list(self._doc) |