@@ -86,7 +86,7 @@ def __init__(self, *args, **kwargs):
8686 def get_cell (self , index : int ) -> Dict [str , Any ]:
8787 meta = self ._ymeta .to_json ()
8888 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
9090 if "id" in cell and meta ["nbformat" ] == 4 and meta ["nbformat_minor" ] <= 4 :
9191 # strip cell IDs if we have notebook format 4.0-4.4
9292 del cell ["id" ]
@@ -136,7 +136,7 @@ def set_ycell(self, index: int, ycell: Y.YMap, txn=None):
136136
137137 def get (self ):
138138 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
140140 cells = []
141141 for i in range (len (self ._ycells )):
142142 cell = self .get_cell (i )
@@ -161,7 +161,7 @@ def get(self):
161161 def set (self , value ):
162162 nb_without_cells = {key : value [key ] for key in value .keys () if key != "cells" }
163163 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
165165 cells = value ["cells" ] or [
166166 {
167167 "cell_type" : "code" ,
0 commit comments