Skip to content

Commit 88b47be

Browse files
fcollonvalmeeseeksmachine
authored andcommitted
Backport PR #77: Removes YMap for attachements
1 parent 14f2bf6 commit 88b47be

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)