Skip to content

Commit

Permalink
Fix missing nbformat version (#304)
Browse files Browse the repository at this point in the history
* Fix missing nbformat version

* Convert format version to int
  • Loading branch information
fcollonval authored Jan 16, 2025
1 parent 2b8e788 commit 697715e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion jupyter_ydoc/ynotebook.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,11 @@ def get(self) -> Dict:
cells = []
for i in range(len(self._ycells)):
cell = self.get_cell(i)
if "id" in cell and meta["nbformat"] == 4 and meta["nbformat_minor"] <= 4:
if (
"id" in cell
and int(meta.get("nbformat", 0)) == 4
and int(meta.get("nbformat_minor", 0)) <= 4
):
# strip cell IDs if we have notebook format 4.0-4.4
del cell["id"]
if (
Expand Down

0 comments on commit 697715e

Please sign in to comment.