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 3581f69 commit 54a246f
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 cell["_index"]
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 54a246f

Please sign in to comment.