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")
| 25 | |
| 26 | |
| 27 | def 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 | |
| 45 | def build_md_view( |
nothing calls this directly
no test coverage detected