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

Method to_setup_cell

marimo/_ast/parse.py:396–413  ·  view source on GitHub ↗
(self, node: Node)

Source from the content-addressed store, hash-verified

394 )
395
396 def to_setup_cell(self, node: Node) -> ParseResult[SetupCell]:
397 kwargs, _violations = _maybe_kwargs(node.items[0].context_expr) # type: ignore
398 code_result = self.extract_from_code(node)
399 _violations.extend(code_result.violations)
400 code = code_result.unwrap()
401 code = code.removesuffix("\npass")
402 return ParseResult(
403 SetupCell(
404 code=code,
405 options=kwargs,
406 lineno=node.lineno,
407 col_offset=node.col_offset,
408 end_lineno=max(node.lineno, _none_to_0(node.end_lineno)),
409 end_col_offset=_none_to_0(node.end_col_offset),
410 name=SETUP_CELL_NAME,
411 ),
412 violations=_violations,
413 )
414
415 def to_cell(
416 self, node: Node, attribute: str | None = None

Callers 1

parse_setupMethod · 0.80

Calls 6

extract_from_codeMethod · 0.95
SetupCellClass · 0.90
_maybe_kwargsFunction · 0.85
_none_to_0Function · 0.85
unwrapMethod · 0.80
ParseResultClass · 0.70

Tested by

no test coverage detected