Skip to content

Commit

Permalink
Be more cautious about cell 'id'
Browse files Browse the repository at this point in the history
  • Loading branch information
athornton committed Oct 29, 2024
1 parent dfde0c6 commit 6062e9a
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/mobu/services/business/notebookrunner.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,14 +296,11 @@ async def execute_code(self, session: JupyterLabSession) -> None:

for cell in self.read_notebook(self._notebook):
code = "".join(cell["source"])
if "id" in cell:
cell_id = f'`{cell["id"]}` (#{cell["_index"]})'
else:
cell_id = f'#{cell["_index"]}'
cell_id = cell.get("id") or "<unknown cell ID>"
ctx = CodeContext(
notebook=self._notebook.name,
path=str(self._notebook),
cell=cell["id"],
cell=cell_id,
cell_number=f"#{cell['_index']}",
cell_source=code,
)
Expand Down

0 comments on commit 6062e9a

Please sign in to comment.