##// END OF EJS Templates
Fixes (iptest), simplified v1, v2, .. , vX import code
Jonathan Frederic -
Show More
@@ -62,7 +62,7 b' def parse_py(s, **kwargs):'
62 62
63 63 def reads_json(s, **kwargs):
64 64 """Read a JSON notebook from a string and return the NotebookNode object."""
65 return convert(reader.reads(nb), current_nbformat)
65 return convert(reader.reads(s), current_nbformat)
66 66
67 67
68 68 def writes_json(nb, **kwargs):
@@ -18,9 +18,15 b' Authors:'
18 18
19 19 import json
20 20
21 versions = {}
22 for i in range(3):
23 versions[i+1] = __import__('v{0}'.format(i+1))
21 import v1
22 import v2
23 import v3
24
25 versions = {
26 1: v1,
27 2: v2,
28 3: v3,
29 }
24 30
25 31 #-----------------------------------------------------------------------------
26 32 # Code
@@ -76,7 +82,7 b" def reads(s, format='ipynb', **kwargs):"
76 82 nb_dict = parse_json(s, **kwargs)
77 83 (major, minor) = get_version(nb_dict)
78 84 if major in versions:
79 return versions[major].to_notebook_json(nb, minor=minor)
85 return versions[major].to_notebook_json(nb_dict, minor=minor)
80 86 else:
81 87 raise NBFormatError('Unsupported nbformat version %s' % major)
82 88
@@ -20,4 +20,4 b' from .nbjson import reads as reads_json, writes as writes_json'
20 20 from .nbjson import reads as read_json, writes as write_json
21 21 from .nbjson import to_notebook as to_notebook_json
22 22
23 from .convert import downgrade, upgrade
23 from .convert import upgrade
General Comments 0
You need to be logged in to leave comments. Login now