@@ -23,11 +23,14 @@ def restore_bytes(nb):
2323 if "png" in output :
2424 output .png = output .png .encode ("ascii" , "replace" )
2525 if "jpeg" in output :
26- output .jpeg = output .jpeg .encode ("ascii" , "replace" )
26+ output .jpeg = output .jpeg .encode (
27+ "ascii" , "replace" )
2728 except KeyError as e :
28- raise validator .ValidationError (f"The notebook was invalid missing the key: { e .message } " )
29+ raise validator .ValidationError (
30+ f"The notebook was invalid missing the key: { e .message } " )
2931 return nb
3032
33+
3134# output keys that are likely to have multiline values
3235_multiline_outputs = ['text' , 'html' , 'svg' , 'latex' , 'javascript' , 'json' ]
3336
@@ -67,7 +70,7 @@ def rejoin_lines(nb):
6770 item = output .get (key , None )
6871 if isinstance (item , list ):
6972 output [key ] = _join_lines (item )
70- else : # text, heading cell
73+ else : # text, heading cell
7174 for key in ['source' , 'rendered' ]:
7275 item = cell .get (key , None )
7376 if isinstance (item , list ):
@@ -93,7 +96,7 @@ def split_lines(nb):
9396 item = output .get (key , None )
9497 if isinstance (item , str ):
9598 output [key ] = item .splitlines (True )
96- else : # text, heading cell
99+ else : # text, heading cell
97100 for key in ['source' , 'rendered' ]:
98101 item = cell .get (key , None )
99102 if isinstance (item , str ):
@@ -103,6 +106,7 @@ def split_lines(nb):
103106# b64 encode/decode are never actually used, because all bytes objects in
104107# the notebook are already b64-encoded, and we don't need/want to double-encode
105108
109+
106110def base64_decode (nb ):
107111 """Restore all bytes objects in the notebook from base64-encoded strings.
108112
@@ -179,8 +183,5 @@ def writes(self, nb, **kwargs):
179183
180184 def write (self , nb , fp , ** kwargs ):
181185 """Write a notebook to a file like object"""
182- nbs = self .writes (nb ,** kwargs )
186+ nbs = self .writes (nb , ** kwargs )
183187 return fp .write (nbs )
184-
185-
186-
0 commit comments