@@ -86,7 +86,7 @@ def __init__(self, *args, **kwargs):
86
86
def get_cell (self , index : int ) -> Dict [str , Any ]:
87
87
meta = self ._ymeta .to_json ()
88
88
cell = self ._ycells [index ].to_json ()
89
- cast_all (cell , float , int )
89
+ cast_all (cell , float , int ) # cells coming from Yjs have e.g. execution_count as float
90
90
if "id" in cell and meta ["nbformat" ] == 4 and meta ["nbformat_minor" ] <= 4 :
91
91
# strip cell IDs if we have notebook format 4.0-4.4
92
92
del cell ["id" ]
@@ -136,7 +136,7 @@ def set_ycell(self, index: int, ycell: Y.YMap, txn=None):
136
136
137
137
def get (self ):
138
138
meta = self ._ymeta .to_json ()
139
- cast_all (meta , float , int )
139
+ cast_all (meta , float , int ) # notebook coming from Yjs has e.g. nbformat as float
140
140
cells = []
141
141
for i in range (len (self ._ycells )):
142
142
cell = self .get_cell (i )
@@ -161,7 +161,7 @@ def get(self):
161
161
def set (self , value ):
162
162
nb_without_cells = {key : value [key ] for key in value .keys () if key != "cells" }
163
163
nb = copy .deepcopy (nb_without_cells )
164
- cast_all (nb , int , float )
164
+ cast_all (nb , int , float ) # Yjs expects numbers to be floating numbers
165
165
cells = value ["cells" ] or [
166
166
{
167
167
"cell_type" : "code" ,
0 commit comments