diff --git a/IPython/nbformat/current.py b/IPython/nbformat/current.py index ab1f6a9..889d6d5 100644 --- a/IPython/nbformat/current.py +++ b/IPython/nbformat/current.py @@ -73,7 +73,7 @@ def writes_json(nb, **kwargs): def reads_py(s, **kwargs): """Read a .py notebook from a string and return the NotebookNode object.""" nbf, nbm, s = parse_py(s, **kwargs) - if nbf == 2 or nbf == 3: + if nbf in (2, 3): nb = versions[nbf].to_notebook_py(s, **kwargs) else: raise NBFormatError('Unsupported PY nbformat version: %i' % nbf) diff --git a/IPython/nbformat/reader.py b/IPython/nbformat/reader.py index 7993cd5..1526301 100644 --- a/IPython/nbformat/reader.py +++ b/IPython/nbformat/reader.py @@ -62,8 +62,8 @@ def get_version(nb): return (major, minor) -def reads(s, format='ipynb', **kwargs): - """Read a notebook from a 'ipynb' (json) string and return the +def reads(s, **kwargs): + """Read a notebook from a json string and return the NotebookNode object. This function properly reads notebooks of any version. No version @@ -103,4 +103,4 @@ def read(fp, **kwargs): nb : NotebookNode The notebook that was read. """ - return reads(fp.read(), format, **kwargs) + return reads(fp.read(), **kwargs)