Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-nbformat for openSUSE:Factory 
checked in at 2022-10-22 14:13:31
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-nbformat (Old)
 and      /work/SRC/openSUSE:Factory/.python-nbformat.new.2275 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-nbformat"

Sat Oct 22 14:13:31 2022 rev:14 rq:1030493 version:5.7.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-nbformat/python-nbformat.changes  
2022-09-28 17:51:37.775217348 +0200
+++ 
/work/SRC/openSUSE:Factory/.python-nbformat.new.2275/python-nbformat.changes    
    2022-10-22 14:14:03.800876820 +0200
@@ -1,0 +2,7 @@
+Sat Oct 22 03:43:12 UTC 2022 - Arun Persaud <a...@gmx.de>
+
+- update to version 5.7.0:
+  * Always use jsonschema to handle error reporting.
+  * Fix deprecation warning suggestion.
+
+-------------------------------------------------------------------

Old:
----
  nbformat-5.6.1.tar.gz

New:
----
  nbformat-5.7.0.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-nbformat.spec ++++++
--- /var/tmp/diff_new_pack.YASyvD/_old  2022-10-22 14:14:04.196877759 +0200
+++ /var/tmp/diff_new_pack.YASyvD/_new  2022-10-22 14:14:04.204877778 +0200
@@ -20,7 +20,7 @@
 %define doc_ver 5.2.0
 %bcond_without libalternatives
 Name:           python-nbformat
-Version:        5.6.1
+Version:        5.7.0
 Release:        0
 Summary:        The Jupyter Notebook format
 License:        BSD-3-Clause

++++++ nbformat-5.6.1.tar.gz -> nbformat-5.7.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/nbformat-5.6.1/.github/workflows/tests.yml 
new/nbformat-5.7.0/.github/workflows/tests.yml
--- old/nbformat-5.6.1/.github/workflows/tests.yml      2022-09-26 
16:32:02.000000000 +0200
+++ new/nbformat-5.7.0/.github/workflows/tests.yml      2022-10-10 
15:10:37.000000000 +0200
@@ -112,7 +112,7 @@
           pip check
       - name: Run the tests
         run: |
-          pytest -vv || pytest -vv --lf
+          pytest -vv -W default || pytest -vv --lf -W default
 
   make_sdist:
     name: Make SDist
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/nbformat-5.6.1/.pre-commit-config.yaml 
new/nbformat-5.7.0/.pre-commit-config.yaml
--- old/nbformat-5.6.1/.pre-commit-config.yaml  2022-09-26 16:32:02.000000000 
+0200
+++ new/nbformat-5.7.0/.pre-commit-config.yaml  2022-10-10 15:10:37.000000000 
+0200
@@ -35,7 +35,7 @@
       - id: prettier
 
   - repo: https://github.com/asottile/pyupgrade
-    rev: v2.38.0
+    rev: v2.38.2
     hooks:
       - id: pyupgrade
         args: [--py37-plus]
@@ -60,7 +60,7 @@
         stages: [manual]
 
   - repo: https://github.com/pre-commit/mirrors-mypy
-    rev: v0.971
+    rev: v0.981
     hooks:
       - id: mypy
         exclude: jupyter_client/tests
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/nbformat-5.6.1/docs/changelog.rst 
new/nbformat-5.7.0/docs/changelog.rst
--- old/nbformat-5.6.1/docs/changelog.rst       2022-09-26 16:32:02.000000000 
+0200
+++ new/nbformat-5.7.0/docs/changelog.rst       2022-10-10 15:10:37.000000000 
+0200
@@ -4,10 +4,15 @@
 Changes in nbformat
 =========================
 
+5.7.0
+=====
+* Always use jsonschema to handle error reporting.
+* Fix deprecation warning suggestion.
+
 5.6.1
 =====
 
-* Fix handling of ``__version__` on Python 3.7.
+* Fix handling of ``__version__`` on Python 3.7.
 
 5.6.0
 =====
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/nbformat-5.6.1/nbformat/validator.py 
new/nbformat-5.7.0/nbformat/validator.py
--- old/nbformat-5.6.1/nbformat/validator.py    2022-09-26 16:32:02.000000000 
+0200
+++ new/nbformat-5.7.0/nbformat/validator.py    2022-10-10 15:10:37.000000000 
+0200
@@ -223,6 +223,8 @@
     if it's a cell type or output_type error,
     try validating directly based on the type for a better error message
     """
+    if not len(error.schema_path):
+        return error
     key = error.schema_path[-1]
     ref = None
     if key.endswith("Of"):
@@ -381,7 +383,7 @@
             f"""`{field}` kwargs of validate has been deprecated for security
         reasons, and will be removed soon.
 
-        Please explicitly use the `new_notebook,n_changes = 
nbformat.validator.normalize(old_notebook, ...)` if you wish to
+        Please explicitly use the `n_changes, new_notebook = 
nbformat.validator.normalize(old_notebook, ...)` if you wish to
         normalise your notebook. `normalize` is available since nbformat 5.5.0
 
         """
@@ -503,6 +505,26 @@
         raise error
 
 
+def _get_errors(
+    nbdict: Any, version: int, version_minor: int, relax_add_props: bool, 
*args: Any
+) -> Any:
+    validator = get_validator(version, version_minor, 
relax_add_props=relax_add_props)
+    if not validator:
+        raise ValidationError(f"No schema for validating 
v{version}.{version_minor} notebooks")
+    iter_errors = validator.iter_errors(nbdict, *args)
+    errors = list(iter_errors)
+    # jsonschema gives the best error messages.
+    if len(errors) and validator.name != "jsonschema":
+        validator = get_validator(
+            version=version,
+            version_minor=version_minor,
+            relax_add_props=relax_add_props,
+            name="jsonschema",
+        )
+        return validator.iter_errors(nbdict, *args)
+    return iter(errors)
+
+
 def _strip_invalida_metadata(
     nbdict: Any, version: int, version_minor: int, relax_add_props: bool
 ) -> int:
@@ -527,22 +549,21 @@
         number of modifications
 
     """
-    validator = get_validator(version, version_minor, 
relax_add_props=relax_add_props)
-    if not validator:
-        raise ValidationError(f"No schema for validating 
v{version}.{version_minor} notebooks")
-    errors = [e for e in validator.iter_errors(nbdict)]
-
+    errors = _get_errors(nbdict, version, version_minor, relax_add_props)
     changes = 0
-    if len(errors) > 0:
-        if validator.name == "fastjsonschema":
-            validator = get_validator(
-                version=version,
-                version_minor=version_minor,
-                relax_add_props=relax_add_props,
-                name="jsonschema",
+    if len(list(errors)) > 0:
+        # jsonschema gives a better error tree.
+        validator = get_validator(
+            version=version,
+            version_minor=version_minor,
+            relax_add_props=relax_add_props,
+            name="jsonschema",
+        )
+        if not validator:
+            raise ValidationError(
+                f"No jsonschema for validating v{version}.{version_minor} 
notebooks"
             )
-            errors = list(validator.iter_errors(nbdict))
-
+        errors = validator.iter_errors(nbdict)
         error_tree = validator.error_tree(errors)
         if "metadata" in error_tree:
             for key in error_tree["metadata"]:
@@ -609,15 +630,15 @@
     if version is None:
         version, version_minor = get_version(nbdict)
 
-    validator = get_validator(version, version_minor, 
relax_add_props=relax_add_props)
-
-    if validator is None:
-        # no validator
-        yield ValidationError("No schema for validating v%s notebooks" % 
version)
-        return
-
     if ref:
-        errors = validator.iter_errors(nbdict, {"$ref": "#/definitions/%s" % 
ref})
+        try:
+            errors = _get_errors(
+                nbdict, version, version_minor, relax_add_props, {"$ref": 
"#/definitions/%s" % ref}
+            )
+        except ValidationError as e:
+            yield e
+            return
+
     else:
         if strip_invalid_metadata:
             _strip_invalida_metadata(nbdict, version, version_minor, 
relax_add_props)
@@ -626,7 +647,11 @@
         # didn't cause another complex validation issue in the schema.
         # Also to ensure that higher-level errors produced by individual 
metadata validation
         # failures are removed.
-        errors = validator.iter_errors(nbdict)
+        try:
+            errors = _get_errors(nbdict, version, version_minor, 
relax_add_props)
+        except ValidationError as e:
+            yield e
+            return
 
     for error in errors:
         yield better_validation_error(error, version, version_minor)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/nbformat-5.6.1/package.json 
new/nbformat-5.7.0/package.json
--- old/nbformat-5.6.1/package.json     2022-09-26 16:32:02.000000000 +0200
+++ new/nbformat-5.7.0/package.json     2022-10-10 15:10:37.000000000 +0200
@@ -1,6 +1,6 @@
 {
   "name": "nbformat-schema",
-  "version": "5.6.1",
+  "version": "5.7.0",
   "description": "JSON schemata for Jupyter notebook formats",
   "main": "index.js",
   "files": [
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/nbformat-5.6.1/tests/test_validator.py 
new/nbformat-5.7.0/tests/test_validator.py
--- old/nbformat-5.6.1/tests/test_validator.py  2022-09-26 16:32:02.000000000 
+0200
+++ new/nbformat-5.7.0/tests/test_validator.py  2022-10-10 15:10:37.000000000 
+0200
@@ -213,8 +213,7 @@
     assert isvalid(nb)
 
 
-# This is only a valid test for the default validator, jsonschema
-@pytest.mark.parametrize("validator_name", ["jsonschema"])
+@pytest.mark.parametrize("validator_name", VALIDATORS)
 def test_validation_error(validator_name):
     set_validator(validator_name)
     with TestsBase.fopen("invalid.ipynb", "r") as f:
@@ -229,8 +228,7 @@
     assert len(s.splitlines()) < 10
 
 
-# This is only a valid test for the default validator, jsonschema
-@pytest.mark.parametrize("validator_name", ["jsonschema"])
+@pytest.mark.parametrize("validator_name", VALIDATORS)
 def test_iter_validation_error(validator_name):
     set_validator(validator_name)
     with TestsBase.fopen("invalid.ipynb", "r") as f:
@@ -246,7 +244,7 @@
     """Test that an empty notebook (invalid) fails validation via 
iter_validate"""
     set_validator(validator_name)
     errors = list(iter_validate({}))
-    assert len(errors) == 1
+    assert len(errors)
     assert type(errors[0]) == ValidationError
 
 

Reply via email to