MCPcopy
hub / github.com/marimo-team/marimo / _ctx

Function _ctx

tests/_code_mode/test_cells_view.py:40–49  ·  view source on GitHub ↗

Build an AsyncCodeModeContext with a document snapshot from the kernel.

(k: Kernel)

Source from the content-addressed store, hash-verified

38
39@contextmanager
40def _ctx(k: Kernel) -> Generator[AsyncCodeModeContext, None, None]:
41 """Build an AsyncCodeModeContext with a document snapshot from the kernel."""
42 doc = NotebookDocument(
43 [
44 NotebookCell(id=cid, code=cell.code, name="", config=cell.config)
45 for cid, cell in k.graph.cells.items()
46 ]
47 )
48 with notebook_document_context(doc):
49 yield AsyncCodeModeContext(k)
50
51
52class TestCellsViewIndex:

Callers 13

test_positive_indexMethod · 0.70
test_negative_indexMethod · 0.70
test_lenMethod · 0.70
test_keysMethod · 0.70
test_valuesMethod · 0.70
test_itemsMethod · 0.70

Calls 5

NotebookDocumentClass · 0.90
NotebookCellClass · 0.90
itemsMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…