From c30f7c33db0947af380ccdc923e24149e7149070 2014-04-22 23:15:30 From: Jessica B. Hamrick Date: 2014-04-22 23:15:30 Subject: [PATCH] Small style fixes --- diff --git a/IPython/nbformat/current.py b/IPython/nbformat/current.py index 09870f1..5688e50 100644 --- a/IPython/nbformat/current.py +++ b/IPython/nbformat/current.py @@ -87,7 +87,7 @@ def reads_json(nbjson, **kwargs): nb = reader_reads(nbjson, **kwargs) nb_current = convert(nb, current_nbformat) errors = validate(nb_current) - if len(errors) > 0: + if errors: logger.error( "Notebook JSON is invalid (%d errors detected during read)", len(errors)) @@ -100,7 +100,7 @@ def writes_json(nb, **kwargs): """ errors = validate(nb) - if len(errors) > 0: + if errors: logger.error( "Notebook JSON is invalid (%d errors detected during write)", len(errors)) diff --git a/IPython/nbformat/validator.py b/IPython/nbformat/validator.py index e937142..e7dae33 100644 --- a/IPython/nbformat/validator.py +++ b/IPython/nbformat/validator.py @@ -23,7 +23,7 @@ def isvalid(nbjson): """ errors = validate(nbjson) - return errors == 0 + return errors == [] def validate(nbjson): @@ -42,7 +42,7 @@ def validate(nbjson): # count how many errors there are v = Draft3Validator(v3schema) - errors = [e for e in v.iter_errors(nbjson)] + errors = list(v.iter_errors(nbjson)) return errors