Skip to content

Commit 3e21fc6

Browse files
Removes YMap for cell metadata (#50)
* Removes YMap for cell metadata * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent af88d3d commit 3e21fc6

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

jupyter_ydoc/ydoc.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,13 @@ def create_ycell(self, value: Dict[str, Any]) -> None:
116116
cell["id"] = str(uuid4())
117117
cell_type = cell["cell_type"]
118118
cell["source"] = Y.YText(cell["source"])
119-
cell["metadata"] = Y.YMap(cell.get("metadata", {}))
119+
cell["metadata"] = cell.get("metadata", {})
120+
120121
if cell_type in ("raw", "markdown"):
121122
cell["attachments"] = Y.YMap(cell.get("attachments", {}))
122123
elif cell_type == "code":
123124
cell["outputs"] = Y.YArray(cell.get("outputs", []))
125+
124126
return Y.YMap(cell)
125127

126128
def set_ycell(self, index: int, ycell: Y.YMap, txn=None):
@@ -170,6 +172,7 @@ def set(self, value):
170172
"id": str(uuid4()),
171173
}
172174
]
175+
173176
with self._ydoc.begin_transaction() as t:
174177
# clear document
175178
cells_len = len(self._ycells)

0 commit comments

Comments
 (0)