##// END OF EJS Templates
Some small fixes and changes of nb version conversion
Jonathan Frederic -
Show More
@@ -73,7 +73,7 b' def writes_json(nb, **kwargs):'
73 def reads_py(s, **kwargs):
73 def reads_py(s, **kwargs):
74 """Read a .py notebook from a string and return the NotebookNode object."""
74 """Read a .py notebook from a string and return the NotebookNode object."""
75 nbf, nbm, s = parse_py(s, **kwargs)
75 nbf, nbm, s = parse_py(s, **kwargs)
76 if nbf == 2 or nbf == 3:
76 if nbf in (2, 3):
77 nb = versions[nbf].to_notebook_py(s, **kwargs)
77 nb = versions[nbf].to_notebook_py(s, **kwargs)
78 else:
78 else:
79 raise NBFormatError('Unsupported PY nbformat version: %i' % nbf)
79 raise NBFormatError('Unsupported PY nbformat version: %i' % nbf)
@@ -62,8 +62,8 b' def get_version(nb):'
62 return (major, minor)
62 return (major, minor)
63
63
64
64
65 def reads(s, format='ipynb', **kwargs):
65 def reads(s, **kwargs):
66 """Read a notebook from a 'ipynb' (json) string and return the
66 """Read a notebook from a json string and return the
67 NotebookNode object.
67 NotebookNode object.
68
68
69 This function properly reads notebooks of any version. No version
69 This function properly reads notebooks of any version. No version
@@ -103,4 +103,4 b' def read(fp, **kwargs):'
103 nb : NotebookNode
103 nb : NotebookNode
104 The notebook that was read.
104 The notebook that was read.
105 """
105 """
106 return reads(fp.read(), format, **kwargs)
106 return reads(fp.read(), **kwargs)
General Comments 0
You need to be logged in to leave comments. Login now