##// END OF EJS Templates
Make sure to pass correct datatype to validate
Jessica B. Hamrick -
Show More
@@ -79,18 +79,19 b' def parse_py(s, **kwargs):'
79 79 return nbf, nbm, s
80 80
81 81
82 def reads_json(s, **kwargs):
82 def reads_json(nbjson, **kwargs):
83 83 """Read a JSON notebook from a string and return the NotebookNode
84 84 object. Report if any JSON format errors are detected.
85 85
86 86 """
87 nbjson = reader_reads(s)
88 num_errors = validate(nbjson)
87 nb = reader_reads(nbjson, **kwargs)
88 nb_current = convert(nb, current_nbformat)
89 num_errors = validate(nb_current)
89 90 if num_errors > 0:
90 91 logger.error(
91 92 "Notebook JSON is invalid (%d errors detected)",
92 93 num_errors)
93 return convert(nbjson, current_nbformat)
94 return nb_current
94 95
95 96
96 97 def writes_json(nb, **kwargs):
@@ -98,12 +99,12 b' def writes_json(nb, **kwargs):'
98 99 any JSON format errors are detected.
99 100
100 101 """
101 nbjson = versions[current_nbformat].writes_json(nb, **kwargs)
102 num_errors = validate(nbjson)
102 num_errors = validate(nb)
103 103 if num_errors > 0:
104 104 logger.error(
105 105 "Notebook JSON is invalid (%d errors detected)",
106 106 num_errors)
107 nbjson = versions[current_nbformat].writes_json(nb, **kwargs)
107 108 return nbjson
108 109
109 110
General Comments 0
You need to be logged in to leave comments. Login now