Convert a IPython notebook output cell to a Datapane Block
(cell: dict, ipython_output_cache: dict)
| 17 | |
| 18 | |
| 19 | def output_cell_to_block(cell: dict, ipython_output_cache: dict) -> typing.Optional[BaseBlock]: |
| 20 | """Convert a IPython notebook output cell to a Datapane Block""" |
| 21 | from datapane.blocks import wrap_block |
| 22 | |
| 23 | # Get the output object from the IPython output cache |
| 24 | cell_output_object = ipython_output_cache.get(cell["execution_count"], None) |
| 25 | |
| 26 | # If there's no corresponding output object, skip |
| 27 | if cell_output_object is not None: |
| 28 | with suppress(Exception): |
| 29 | return wrap_block(cell_output_object) |
| 30 | |
| 31 | return None |
| 32 | |
| 33 | |
| 34 | def check_notebook_cache_parity(notebook_json: dict, ipython_input_cache: list) -> typing.Tuple[bool, typing.List[int]]: |
no test coverage detected