Show More
@@ -87,7 +87,7 b' def reads_json(nbjson, **kwargs):' | |||||
87 | nb = reader_reads(nbjson, **kwargs) |
|
87 | nb = reader_reads(nbjson, **kwargs) | |
88 | nb_current = convert(nb, current_nbformat) |
|
88 | nb_current = convert(nb, current_nbformat) | |
89 | errors = validate(nb_current) |
|
89 | errors = validate(nb_current) | |
90 |
if |
|
90 | if errors: | |
91 | logger.error( |
|
91 | logger.error( | |
92 | "Notebook JSON is invalid (%d errors detected during read)", |
|
92 | "Notebook JSON is invalid (%d errors detected during read)", | |
93 | len(errors)) |
|
93 | len(errors)) | |
@@ -100,7 +100,7 b' def writes_json(nb, **kwargs):' | |||||
100 |
|
100 | |||
101 | """ |
|
101 | """ | |
102 | errors = validate(nb) |
|
102 | errors = validate(nb) | |
103 |
if |
|
103 | if errors: | |
104 | logger.error( |
|
104 | logger.error( | |
105 | "Notebook JSON is invalid (%d errors detected during write)", |
|
105 | "Notebook JSON is invalid (%d errors detected during write)", | |
106 | len(errors)) |
|
106 | len(errors)) |
@@ -23,7 +23,7 b' def isvalid(nbjson):' | |||||
23 | """ |
|
23 | """ | |
24 |
|
24 | |||
25 | errors = validate(nbjson) |
|
25 | errors = validate(nbjson) | |
26 |
return errors == |
|
26 | return errors == [] | |
27 |
|
27 | |||
28 |
|
28 | |||
29 | def validate(nbjson): |
|
29 | def validate(nbjson): | |
@@ -42,7 +42,7 b' def validate(nbjson):' | |||||
42 |
|
42 | |||
43 | # count how many errors there are |
|
43 | # count how many errors there are | |
44 | v = Draft3Validator(v3schema) |
|
44 | v = Draft3Validator(v3schema) | |
45 |
errors = |
|
45 | errors = list(v.iter_errors(nbjson)) | |
46 | return errors |
|
46 | return errors | |
47 |
|
47 | |||
48 |
|
48 |
General Comments 0
You need to be logged in to leave comments.
Login now