Show More
@@ -80,21 +80,30 b' def parse_py(s, **kwargs):' | |||
|
80 | 80 | |
|
81 | 81 | |
|
82 | 82 | def reads_json(s, **kwargs): |
|
83 |
"""Read a JSON notebook from a string and return the NotebookNode |
|
|
83 | """Read a JSON notebook from a string and return the NotebookNode | |
|
84 | object. Report if any JSON format errors are detected. | |
|
85 | ||
|
86 | """ | |
|
84 | 87 | nbjson = reader_reads(s) |
|
85 | 88 | num_errors = validate(nbjson) |
|
86 | 89 | if num_errors > 0: |
|
87 | 90 | logger.error( |
|
88 |
"Notebook JSON is invalid (%d errors detected)" |
|
|
91 | "Notebook JSON is invalid (%d errors detected)", | |
|
92 | num_errors) | |
|
89 | 93 | return convert(nbjson, current_nbformat) |
|
90 | 94 | |
|
91 | 95 | |
|
92 | 96 | def writes_json(nb, **kwargs): |
|
97 | """Take a NotebookNode object and write out a JSON string. Report if | |
|
98 | any JSON format errors are detected. | |
|
99 | ||
|
100 | """ | |
|
93 | 101 | nbjson = versions[current_nbformat].writes_json(nb, **kwargs) |
|
94 | 102 | num_errors = validate(nbjson) |
|
95 | 103 | if num_errors > 0: |
|
96 | 104 | logger.error( |
|
97 |
"Notebook JSON is invalid (%d errors detected)" |
|
|
105 | "Notebook JSON is invalid (%d errors detected)", | |
|
106 | num_errors) | |
|
98 | 107 | return nbjson |
|
99 | 108 | |
|
100 | 109 |
General Comments 0
You need to be logged in to leave comments.
Login now