MCPcopy Create free account
hub / github.com/datapane/datapane / add_code

Function add_code

python-client/src/datapane/builtins.py:27–42  ·  view source on GitHub ↗

Attach code fragment to an existing plot/figure/dataframe for use within a report Args: block: The existing object to add code to - can be either an existing dp Block or an Python object code: The code fragment to add language: The language of the code fragment (opt

(block: b.BlockOrPrimitive, code: str, language: str = "python")

Source from the content-addressed store, hash-verified

25
26
27def add_code(block: b.BlockOrPrimitive, code: str, language: str = "python") -> b.Select:
28 """
29 Attach code fragment to an existing plot/figure/dataframe for use within a report
30
31 Args:
32 block: The existing object to add code to - can be either an existing dp Block or an Python object
33 code: The code fragment to add
34 language: The language of the code fragment (optional)
35
36 Returns:
37 A Select block that provides the figure and the code in tabs that can be selected by the user
38 """
39
40 w_block = b.wrap_block(block)
41 w_block._add_attributes(label="Figure")
42 return b.Select(w_block, b.Code(code, language, label="Code"), type=b.SelectType.TABS)
43
44
45def build_md_view(

Callers

nothing calls this directly

Calls 1

_add_attributesMethod · 0.80

Tested by

no test coverage detected