Skip to content

Commit 043db17

Browse files
Merge pull request #83 from meeseeksmachine/auto-backport-of-pr-77-on-0.2.x
Backport PR #77 on branch 0.2.x (Removes YMap for attachements)
2 parents 14f2bf6 + 88b47be commit 043db17

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

jupyter_ydoc/ydoc.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def get_cell(self, index: int) -> Dict[str, Any]:
9292
del cell["id"]
9393
if (
9494
"attachments" in cell
95-
and cell["cell_type"] in ["raw", "markdown"]
95+
and cell["cell_type"] in ("raw", "markdown")
9696
and not cell["attachments"]
9797
):
9898
del cell["attachments"]
@@ -119,7 +119,8 @@ def create_ycell(self, value: Dict[str, Any]) -> None:
119119
cell["metadata"] = cell.get("metadata", {})
120120

121121
if cell_type in ("raw", "markdown"):
122-
cell["attachments"] = Y.YMap(cell.get("attachments", {}))
122+
if "attachments" in cell and not cell["attachments"]:
123+
del cell["attachments"]
123124
elif cell_type == "code":
124125
cell["outputs"] = Y.YArray(cell.get("outputs", []))
125126

0 commit comments

Comments
 (0)