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 2023-01-16 17:59:06 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-nbformat (Old) and /work/SRC/openSUSE:Factory/.python-nbformat.new.32243 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-nbformat" Mon Jan 16 17:59:06 2023 rev:16 rq:1058566 version:5.7.3 Changes: -------- --- /work/SRC/openSUSE:Factory/python-nbformat/python-nbformat.changes 2022-12-27 11:55:03.567313754 +0100 +++ /work/SRC/openSUSE:Factory/.python-nbformat.new.32243/python-nbformat.changes 2023-01-16 18:01:41.519755186 +0100 @@ -1,0 +2,8 @@ +Sun Jan 15 20:39:15 UTC 2023 - Ben Greiner <c...@bnavigator.de> + +- Update to 5.7.3 + * Undeprecate validate(nb, relax_add_props=True) #343 (@minrk) +- Release 5.7.2 + * Only require nbformat_minor for v4 #342 (@minrk) + +------------------------------------------------------------------- Old: ---- nbformat-5.7.1.tar.gz New: ---- nbformat-5.7.3.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-nbformat.spec ++++++ --- /var/tmp/diff_new_pack.1giyKN/_old 2023-01-16 18:01:42.243759248 +0100 +++ /var/tmp/diff_new_pack.1giyKN/_new 2023-01-16 18:01:42.247759270 +0100 @@ -1,7 +1,7 @@ # # spec file for package python-nbformat # -# Copyright (c) 2022 SUSE LLC +# Copyright (c) 2023 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,7 +18,7 @@ %bcond_without libalternatives Name: python-nbformat -Version: 5.7.1 +Version: 5.7.3 Release: 0 Summary: The Jupyter Notebook format License: BSD-3-Clause ++++++ nbformat-5.7.1.tar.gz -> nbformat-5.7.3.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbformat-5.7.1/.github/workflows/tests.yml new/nbformat-5.7.3/.github/workflows/tests.yml --- old/nbformat-5.7.1/.github/workflows/tests.yml 2020-02-02 01:00:00.000000000 +0100 +++ new/nbformat-5.7.3/.github/workflows/tests.yml 2020-02-02 01:00:00.000000000 +0100 @@ -60,11 +60,11 @@ run: | hatch run typing:test hatch run lint:style - pipx run 'validate-pyproject[all]' pyproject.toml + pipx run interrogate -v nbformat pipx run doc8 --max-line-length=200 docs: - runs-on: ubuntu-latest + runs-on: windows-latest steps: - uses: actions/checkout@v3 - uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbformat-5.7.1/.pre-commit-config.yaml new/nbformat-5.7.3/.pre-commit-config.yaml --- old/nbformat-5.7.1/.pre-commit-config.yaml 2020-02-02 01:00:00.000000000 +0100 +++ new/nbformat-5.7.3/.pre-commit-config.yaml 2020-02-02 01:00:00.000000000 +0100 @@ -5,17 +5,18 @@ - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.4.0 hooks: - - id: end-of-file-fixer - id: check-case-conflict + - id: check-ast + - id: check-docstring-first - id: check-executables-have-shebangs - - id: requirements-txt-fixer - id: check-added-large-files - id: check-case-conflict + - id: check-merge-conflict + - id: check-json - id: check-toml - id: check-yaml - id: debug-statements - - id: forbid-new-submodules - - id: check-builtin-literals + - id: end-of-file-fixer - id: trailing-whitespace - repo: https://github.com/python-jsonschema/check-jsonschema @@ -29,12 +30,13 @@ - id: mdformat - repo: https://github.com/psf/black - rev: 22.10.0 + rev: 22.12.0 hooks: - id: black - repo: https://github.com/charliermarsh/ruff-pre-commit - rev: v0.0.185 + rev: v0.0.207 hooks: - id: ruff args: ["--fix"] + exclude: script diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbformat-5.7.1/CHANGELOG.md new/nbformat-5.7.3/CHANGELOG.md --- old/nbformat-5.7.1/CHANGELOG.md 2020-02-02 01:00:00.000000000 +0100 +++ new/nbformat-5.7.3/CHANGELOG.md 2020-02-02 01:00:00.000000000 +0100 @@ -1,7 +1,45 @@ (changelog)= +# Changelog + <!-- <START NEW CHANGELOG ENTRY> --> +## 5.7.3 + +([Full Changelog](https://github.com/jupyter/nbformat/compare/v5.7.2...1eefc29edff5da06f78c0087e7c06e644a6abcc9)) + +### Maintenance and upkeep improvements + +- Undeprecate validate(nb, relax_add_props=True) [#343](https://github.com/jupyter/nbformat/pull/343) ([@minrk](https://github.com/minrk)) + +### Contributors to this release + +([GitHub contributors page for this release](https://github.com/jupyter/nbformat/graphs/contributors?from=2023-01-11&to=2023-01-12&type=c)) + +[@minrk](https://github.com/search?q=repo%3Ajupyter%2Fnbformat+involves%3Aminrk+updated%3A2023-01-11..2023-01-12&type=Issues) + +<!-- <END NEW CHANGELOG ENTRY> --> + +## 5.7.2 + +([Full Changelog](https://github.com/jupyter/nbformat/compare/v5.7.1...30f3d81e7113ad7628443fc4cd389ca16b2d186a)) + +### Bugs fixed + +- Only require nbformat_minor for v4 [#342](https://github.com/jupyter/nbformat/pull/342) ([@minrk](https://github.com/minrk)) + +### Maintenance and upkeep improvements + +- Fix check release [#341](https://github.com/jupyter/nbformat/pull/341) ([@blink1073](https://github.com/blink1073)) +- Add spell checker and enforce docstrings [#339](https://github.com/jupyter/nbformat/pull/339) ([@blink1073](https://github.com/blink1073)) +- Fix docs build [#338](https://github.com/jupyter/nbformat/pull/338) ([@blink1073](https://github.com/blink1073)) + +### Contributors to this release + +([GitHub contributors page for this release](https://github.com/jupyter/nbformat/graphs/contributors?from=2022-12-19&to=2023-01-11&type=c)) + +[@blink1073](https://github.com/search?q=repo%3Ajupyter%2Fnbformat+involves%3Ablink1073+updated%3A2022-12-19..2023-01-11&type=Issues) | [@minrk](https://github.com/search?q=repo%3Ajupyter%2Fnbformat+involves%3Aminrk+updated%3A2022-12-19..2023-01-11&type=Issues) | [@pre-commit-ci](https://github.com/search?q=repo%3Ajupyter%2Fnbformat+involves%3Apre-commit-ci+updated%3A2022-12-19..2023-01-11&type=Issues) + ## 5.7.1 ([Full Changelog](https://github.com/jupyter/nbformat/compare/5.7.0...45ff0cd6dbc5e46a3b620124deeda00aaeebfa29)) @@ -31,8 +69,6 @@ [@blink1073](https://github.com/search?q=repo%3Ajupyter%2Fnbformat+involves%3Ablink1073+updated%3A2022-10-10..2022-12-19&type=Issues) | [@chrisjsewell](https://github.com/search?q=repo%3Ajupyter%2Fnbformat+involves%3Achrisjsewell+updated%3A2022-10-10..2022-12-19&type=Issues) | [@pre-commit-ci](https://github.com/search?q=repo%3Ajupyter%2Fnbformat+involves%3Apre-commit-ci+updated%3A2022-10-10..2022-12-19&type=Issues) -<!-- <END NEW CHANGELOG ENTRY> --> - # Changes in nbformat ## 5.7.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbformat-5.7.1/PKG-INFO new/nbformat-5.7.3/PKG-INFO --- old/nbformat-5.7.1/PKG-INFO 2020-02-02 01:00:00.000000000 +0100 +++ new/nbformat-5.7.3/PKG-INFO 2020-02-02 01:00:00.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: nbformat -Version: 5.7.1 +Version: 5.7.3 Summary: The Jupyter Notebook format Project-URL: Homepage, https://jupyter.org Author-email: Jupyter Development Team <jupy...@googlegroups.com> @@ -90,6 +90,7 @@ Requires-Dist: pydata-sphinx-theme; extra == 'docs' Requires-Dist: sphinx; extra == 'docs' Requires-Dist: sphinxcontrib-github-alt; extra == 'docs' +Requires-Dist: sphinxcontrib-spelling; extra == 'docs' Provides-Extra: test Requires-Dist: pep440; extra == 'test' Requires-Dist: pre-commit; extra == 'test' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbformat-5.7.1/docs/conf.py new/nbformat-5.7.3/docs/conf.py --- old/nbformat-5.7.1/docs/conf.py 2020-02-02 01:00:00.000000000 +0100 +++ new/nbformat-5.7.3/docs/conf.py 2020-02-02 01:00:00.000000000 +0100 @@ -37,6 +37,13 @@ "sphinx.ext.napoleon", ] +try: + import enchant # type:ignore # noqa + + extensions += ["sphinxcontrib.spelling"] +except ImportError: + pass + # Add any paths that contain templates here, relative to this directory. templates_path = ["_templates"] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbformat-5.7.1/nbformat/_struct.py new/nbformat-5.7.3/nbformat/_struct.py --- old/nbformat-5.7.1/nbformat/_struct.py 2020-02-02 01:00:00.000000000 +0100 +++ new/nbformat-5.7.3/nbformat/_struct.py 2020-02-02 01:00:00.000000000 +0100 @@ -1,8 +1,3 @@ -""" -Vendoring of old ipython_genutils Struct -""" - - """A dict subclass that supports attribute style access. Can probably be replaced by types.SimpleNamespace from Python 3.3 @@ -206,6 +201,7 @@ return outdict def dict(self): + """Get the dict representation of the struct.""" return self def copy(self): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbformat-5.7.1/nbformat/_version.py new/nbformat-5.7.3/nbformat/_version.py --- old/nbformat-5.7.1/nbformat/_version.py 2020-02-02 01:00:00.000000000 +0100 +++ new/nbformat-5.7.3/nbformat/_version.py 2020-02-02 01:00:00.000000000 +0100 @@ -1,3 +1,4 @@ +"""The version information for nbformat.""" # Use "hatchling version xx.yy.zz" to handle version changes import re diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbformat-5.7.1/nbformat/corpus/tests/test_words.py new/nbformat-5.7.3/nbformat/corpus/tests/test_words.py --- old/nbformat-5.7.1/nbformat/corpus/tests/test_words.py 2020-02-02 01:00:00.000000000 +0100 +++ new/nbformat-5.7.3/nbformat/corpus/tests/test_words.py 2020-02-02 01:00:00.000000000 +0100 @@ -7,6 +7,7 @@ def test_generate_corpus_id(recwarn): + """Test generating a corpus id.""" assert len(words.generate_corpus_id()) > 7 # 1 in 4294967296 (2^32) times this will fail assert words.generate_corpus_id() != words.generate_corpus_id() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbformat-5.7.1/nbformat/corpus/words.py new/nbformat-5.7.3/nbformat/corpus/words.py --- old/nbformat-5.7.1/nbformat/corpus/words.py 2020-02-02 01:00:00.000000000 +0100 +++ new/nbformat-5.7.3/nbformat/corpus/words.py 2020-02-02 01:00:00.000000000 +0100 @@ -1,5 +1,7 @@ +"""Generate a corpus id.""" import uuid def generate_corpus_id(): + """Generate a corpus id.""" return uuid.uuid4().hex[:8] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbformat-5.7.1/nbformat/current.py new/nbformat-5.7.3/nbformat/current.py --- old/nbformat-5.7.1/nbformat/current.py 2020-02-02 01:00:00.000000000 +0100 +++ new/nbformat-5.7.3/nbformat/current.py 2020-02-02 01:00:00.000000000 +0100 @@ -80,6 +80,8 @@ class NBFormatError(ValueError): + """An error raised for an nbformat error.""" + pass diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbformat-5.7.1/nbformat/json_compat.py new/nbformat-5.7.3/nbformat/json_compat.py --- old/nbformat-5.7.1/nbformat/json_compat.py 2020-02-02 01:00:00.000000000 +0100 +++ new/nbformat-5.7.3/nbformat/json_compat.py 2020-02-02 01:00:00.000000000 +0100 @@ -1,9 +1,9 @@ -# Copyright (c) Jupyter Development Team. -# Distributed under the terms of the Modified BSD License. """ Common validator wrapper to provide a uniform usage of other schema validation libraries. """ +# Copyright (c) Jupyter Development Team. +# Distributed under the terms of the Modified BSD License. import os @@ -15,17 +15,22 @@ class JsonSchemaValidator: + """A json schema validator.""" + name = "jsonschema" def __init__(self, schema): + """Initialize the validator.""" self._schema = schema self._default_validator = _JsonSchemaValidator(schema) # Default self._validator = self._default_validator def validate(self, data): + """Validate incoming data.""" self._default_validator.validate(data) def iter_errors(self, data, schema=None): + """Iterate over errors in incoming data.""" if schema is None: return self._default_validator.iter_errors(data) if hasattr(self._default_validator, "evolve"): @@ -33,23 +38,29 @@ return self._default_validator.iter_errors(data, schema) def error_tree(self, errors): + """Create an error tree for the errors.""" return ErrorTree(errors=errors) class FastJsonSchemaValidator(JsonSchemaValidator): + """A schema validator using fastjsonschema.""" + name = "fastjsonschema" def __init__(self, schema): + """Initialize the validator.""" super().__init__(schema) self._validator = fastjsonschema.compile(schema) def validate(self, data): + """Validate incoming data.""" try: self._validator(data) except _JsonSchemaException as error: raise ValidationError(str(error), schema_path=error.path) from error def iter_errors(self, data, schema=None): + """Iterate over errors in incoming data.""" if schema is not None: return super().iter_errors(data, schema) @@ -63,6 +74,7 @@ return errors def error_tree(self, errors): + """Create an error tree for the errors.""" # fastjsonschema's exceptions don't contain the same information that the jsonschema ValidationErrors # do. This method is primarily used for introspecting metadata schema failures so that we can strip # them if asked to do so in `nbformat.validate`. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbformat-5.7.1/nbformat/notebooknode.py new/nbformat-5.7.3/nbformat/notebooknode.py --- old/nbformat-5.7.1/nbformat/notebooknode.py 2020-02-02 01:00:00.000000000 +0100 +++ new/nbformat-5.7.3/nbformat/notebooknode.py 2020-02-02 01:00:00.000000000 +0100 @@ -9,6 +9,7 @@ """A dict-like node with attribute-access""" def __setitem__(self, key, value): + """Set an item on the notebook.""" if isinstance(value, Mapping) and not isinstance(value, NotebookNode): value = from_dict(value) super().__setitem__(key, value) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbformat-5.7.1/nbformat/reader.py new/nbformat-5.7.3/nbformat/reader.py --- old/nbformat-5.7.1/nbformat/reader.py 2020-02-02 01:00:00.000000000 +0100 +++ new/nbformat-5.7.3/nbformat/reader.py 2020-02-02 01:00:00.000000000 +0100 @@ -9,6 +9,8 @@ class NotJSONError(ValueError): + """An error raised when an object is not valid JSON.""" + pass diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbformat-5.7.1/nbformat/sentinel.py new/nbformat-5.7.3/nbformat/sentinel.py --- old/nbformat-5.7.1/nbformat/sentinel.py 2020-02-02 01:00:00.000000000 +0100 +++ new/nbformat-5.7.3/nbformat/sentinel.py 2020-02-02 01:00:00.000000000 +0100 @@ -5,11 +5,15 @@ class Sentinel: + """Sentinel class for constants with useful reprs""" + def __init__(self, name, module, docstring=None): + """Initialize the sentinel.""" self.name = name self.module = module if docstring: self.__doc__ = docstring def __repr__(self): + """The string repr for the sentinel.""" return str(self.module) + "." + self.name diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbformat-5.7.1/nbformat/sign.py new/nbformat-5.7.3/nbformat/sign.py --- old/nbformat-5.7.1/nbformat/sign.py 2020-02-02 01:00:00.000000000 +0100 +++ new/nbformat-5.7.3/nbformat/sign.py 2020-02-02 01:00:00.000000000 +0100 @@ -73,11 +73,13 @@ cache_size = 65535 def __init__(self): + """Initialize a memory signature store.""" # We really only want an ordered set, but the stdlib has OrderedDict, # and it's easy to use a dict as a set. self.data = OrderedDict() def store_signature(self, digest, algorithm): + """Store a signature.""" key = (digest, algorithm) # Pop it so it goes to the end when we reinsert it self.data.pop(key, None) @@ -94,6 +96,7 @@ self.data.popitem(last=False) def check_signature(self, digest, algorithm): + """Check a signature.""" key = (digest, algorithm) if key in self.data: # Move it to the end (.move_to_end() method is new in Py3) @@ -103,6 +106,7 @@ return False def remove_signature(self, digest, algorithm): + """Remove a signature.""" self.data.pop((digest, algorithm), None) @@ -119,11 +123,13 @@ ).tag(config=True) def __init__(self, db_file, **kwargs): + """Initialize a sql signature store.""" super().__init__(**kwargs) self.db_file = db_file self.db = self._connect_db(db_file) def close(self): + """Close the db.""" if self.db is not None: self.db.close() @@ -169,6 +175,7 @@ return db def init_db(self, db): + """Initialize the db.""" db.execute( """ CREATE TABLE IF NOT EXISTS nbsignatures @@ -188,6 +195,7 @@ db.commit() def store_signature(self, digest, algorithm): + """Store a signature in the db.""" if self.db is None: return if not self.check_signature(digest, algorithm): @@ -214,6 +222,7 @@ self.cull_db() def check_signature(self, digest, algorithm): + """Check a signature against the db.""" if self.db is None: return False r = self.db.execute( @@ -236,6 +245,7 @@ return True def remove_signature(self, digest, algorithm): + """Remove a signature from the db.""" self.db.execute( """DELETE FROM nbsignatures WHERE algorithm = ? AND @@ -395,6 +405,7 @@ return secret def __init__(self, **kwargs): + """Initialize the notary.""" super().__init__(**kwargs) self.store = self.store_factory() @@ -540,6 +551,8 @@ class TrustNotebookApp(JupyterApp): + """An application for handling notebook trust.""" + version = __version__ description = """Sign one or more Jupyter notebooks with your key, to trust their dynamic (HTML, Javascript) output. @@ -594,6 +607,7 @@ self.notary._write_secret_file(os.urandom(1024)) def start(self): + """Start the trust notebook app.""" if self.reset: if os.path.exists(self.notary.db_file): print("Removing trusted signature cache: %s" % self.notary.db_file) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbformat-5.7.1/nbformat/v1/convert.py new/nbformat-5.7.3/nbformat/v1/convert.py --- old/nbformat-5.7.1/nbformat/v1/convert.py 2020-02-02 01:00:00.000000000 +0100 +++ new/nbformat-5.7.3/nbformat/v1/convert.py 2020-02-02 01:00:00.000000000 +0100 @@ -13,4 +13,5 @@ def upgrade(nb, orig_version=None): + """Upgrade a notebook.""" raise ValueError("Cannot convert to v1 notebook format") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbformat-5.7.1/nbformat/v1/nbbase.py new/nbformat-5.7.3/nbformat/v1/nbbase.py --- old/nbformat-5.7.1/nbformat/v1/nbbase.py 2020-02-02 01:00:00.000000000 +0100 +++ new/nbformat-5.7.3/nbformat/v1/nbbase.py 2020-02-02 01:00:00.000000000 +0100 @@ -24,10 +24,13 @@ class NotebookNode(Struct): + """A notebook node object.""" + pass def from_dict(d): + """Create notebook node(s) from an object.""" if isinstance(d, dict): newd = NotebookNode() for k, v in d.items(): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbformat-5.7.1/nbformat/v1/nbjson.py new/nbformat-5.7.3/nbformat/v1/nbjson.py --- old/nbformat-5.7.1/nbformat/v1/nbjson.py 2020-02-02 01:00:00.000000000 +0100 +++ new/nbformat-5.7.3/nbformat/v1/nbjson.py 2020-02-02 01:00:00.000000000 +0100 @@ -27,7 +27,10 @@ class JSONReader(NotebookReader): + """A JSON notebook reader.""" + def reads(self, s, **kwargs): + """Convert a string to a notebook object.""" nb = json.loads(s, **kwargs) return self.to_notebook(nb, **kwargs) @@ -37,7 +40,10 @@ class JSONWriter(NotebookWriter): + """A JSON notebook writer.""" + def writes(self, nb, **kwargs): + """Convert a notebook object to a string.""" kwargs["indent"] = 4 return json.dumps(nb, **kwargs) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbformat-5.7.1/nbformat/v1/rwbase.py new/nbformat-5.7.3/nbformat/v1/rwbase.py --- old/nbformat-5.7.1/nbformat/v1/rwbase.py 2020-02-02 01:00:00.000000000 +0100 +++ new/nbformat-5.7.3/nbformat/v1/rwbase.py 2020-02-02 01:00:00.000000000 +0100 @@ -22,6 +22,8 @@ class NotebookReader: + """The base notebook reader.""" + def reads(self, s, **kwargs): """Read a notebook from a string.""" raise NotImplementedError("loads must be implemented in a subclass") @@ -32,6 +34,8 @@ class NotebookWriter: + """The base notebook writer.""" + def writes(self, nb, **kwargs): """Write a notebook to a string.""" raise NotImplementedError("loads must be implemented in a subclass") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbformat-5.7.1/nbformat/v2/nbbase.py new/nbformat-5.7.3/nbformat/v2/nbbase.py --- old/nbformat-5.7.1/nbformat/v2/nbbase.py 2020-02-02 01:00:00.000000000 +0100 +++ new/nbformat-5.7.3/nbformat/v2/nbbase.py 2020-02-02 01:00:00.000000000 +0100 @@ -29,10 +29,13 @@ class NotebookNode(Struct): + """A notebook node object.""" + pass def from_dict(d): + """Create notebook node(s) from a value.""" if isinstance(d, dict): newd = NotebookNode() for k, v in d.items(): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbformat-5.7.1/nbformat/v2/nbjson.py new/nbformat-5.7.3/nbformat/v2/nbjson.py --- old/nbformat-5.7.1/nbformat/v2/nbjson.py 2020-02-02 01:00:00.000000000 +0100 +++ new/nbformat-5.7.3/nbformat/v2/nbjson.py 2020-02-02 01:00:00.000000000 +0100 @@ -31,23 +31,31 @@ """A JSON encoder that accepts b64 (and other *ascii*) bytestrings.""" def default(self, obj): + """The default value of an object.""" if isinstance(obj, bytes): return obj.decode("ascii") return json.JSONEncoder.default(self, obj) class JSONReader(NotebookReader): + """A JSON notebook reader.""" + def reads(self, s, **kwargs): + """Convert a string to a notebook.""" nb = json.loads(s, **kwargs) nb = self.to_notebook(nb, **kwargs) return nb def to_notebook(self, d, **kwargs): + """Convert a string to a notebook.""" return restore_bytes(rejoin_lines(from_dict(d))) class JSONWriter(NotebookWriter): + """A JSON notebook writer.""" + def writes(self, nb, **kwargs): + """Convert a notebook object to a string.""" kwargs["cls"] = BytesEncoder kwargs["indent"] = 1 kwargs["sort_keys"] = True diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbformat-5.7.1/nbformat/v2/nbpy.py new/nbformat-5.7.3/nbformat/v2/nbpy.py --- old/nbformat-5.7.1/nbformat/v2/nbpy.py 2020-02-02 01:00:00.000000000 +0100 +++ new/nbformat-5.7.3/nbformat/v2/nbpy.py 2020-02-02 01:00:00.000000000 +0100 @@ -30,14 +30,20 @@ class PyReaderError(Exception): + """An error raised by the PyReader.""" + pass class PyReader(NotebookReader): + """A Python notebook reader.""" + def reads(self, s, **kwargs): + """Convert a string to a notebook.""" return self.to_notebook(s, **kwargs) def to_notebook(self, s, **kwargs): + """Convert a string to a notebook.""" lines = s.splitlines() cells = [] cell_lines: List[str] = [] @@ -74,6 +80,7 @@ return nb def new_cell(self, state, lines): + """Create a new cell.""" if state == "codecell": input = "\n".join(lines) input = input.strip("\n") @@ -100,6 +107,7 @@ return text def split_lines_into_blocks(self, lines): + """Split lines into code blocks.""" if len(lines) == 1: yield lines[0] raise StopIteration() @@ -114,7 +122,10 @@ class PyWriter(NotebookWriter): + """A Python notebook writer.""" + def writes(self, nb, **kwargs): + """Convert a notebook object to a string.""" lines = ["# -*- coding: utf-8 -*-"] lines.extend(["# <nbformat>2</nbformat>", ""]) for ws in nb.worksheets: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbformat-5.7.1/nbformat/v2/nbxml.py new/nbformat-5.7.3/nbformat/v2/nbxml.py --- old/nbformat-5.7.1/nbformat/v2/nbxml.py 2020-02-02 01:00:00.000000000 +0100 +++ new/nbformat-5.7.3/nbformat/v2/nbxml.py 2020-02-02 01:00:00.000000000 +0100 @@ -19,12 +19,15 @@ def reads(s, **kwargs): + """REMOVED""" raise Exception(REMOVED_MSG) def read(fp, **kwargs): + """REMOVED""" raise Exception(REMOVED_MSG) def to_notebook(root, **kwargs): + """REMOVED""" raise Exception(REMOVED_MSG) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbformat-5.7.1/nbformat/v3/nbbase.py new/nbformat-5.7.3/nbformat/v3/nbbase.py --- old/nbformat-5.7.1/nbformat/v3/nbbase.py 2020-02-02 01:00:00.000000000 +0100 +++ new/nbformat-5.7.3/nbformat/v3/nbbase.py 2020-02-02 01:00:00.000000000 +0100 @@ -24,10 +24,13 @@ class NotebookNode(Struct): + """A notebook node object.""" + pass def from_dict(d): + """Create notebook node(s) from an object.""" if isinstance(d, dict): newd = NotebookNode() for k, v in d.items(): @@ -48,6 +51,7 @@ def cast_str(obj): + """Cast an object as a string.""" if isinstance(obj, bytes): # really this should never happend, it should # have been base64 encoded before. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbformat-5.7.1/nbformat/v3/nbjson.py new/nbformat-5.7.3/nbformat/v3/nbjson.py --- old/nbformat-5.7.1/nbformat/v3/nbjson.py 2020-02-02 01:00:00.000000000 +0100 +++ new/nbformat-5.7.3/nbformat/v3/nbjson.py 2020-02-02 01:00:00.000000000 +0100 @@ -14,24 +14,32 @@ """A JSON encoder that accepts b64 (and other *ascii*) bytestrings.""" def default(self, obj): + """Get the default value of an object.""" if isinstance(obj, bytes): return obj.decode("ascii") return json.JSONEncoder.default(self, obj) class JSONReader(NotebookReader): + """A JSON notebook reader.""" + def reads(self, s, **kwargs): + """Convert a string to a notebook.""" nb = json.loads(s, **kwargs) nb = self.to_notebook(nb, **kwargs) nb = strip_transient(nb) return nb def to_notebook(self, d, **kwargs): + """Convert a dict to a notebook.""" return rejoin_lines(from_dict(d)) class JSONWriter(NotebookWriter): + """A JSON notebook writer.""" + def writes(self, nb, **kwargs): + """Convert a notebook to a string.""" kwargs["cls"] = BytesEncoder kwargs["indent"] = 1 kwargs["sort_keys"] = True diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbformat-5.7.1/nbformat/v3/nbpy.py new/nbformat-5.7.3/nbformat/v3/nbpy.py --- old/nbformat-5.7.1/nbformat/v3/nbpy.py 2020-02-02 01:00:00.000000000 +0100 +++ new/nbformat-5.7.3/nbformat/v3/nbpy.py 2020-02-02 01:00:00.000000000 +0100 @@ -38,14 +38,20 @@ class PyReaderError(Exception): + """An error raised for a pyreader error.""" + pass class PyReader(NotebookReader): + """A python notebook reader.""" + def reads(self, s, **kwargs): + """Convert a string to a notebook""" return self.to_notebook(s, **kwargs) def to_notebook(self, s, **kwargs): + """Convert a string to a notebook""" lines = s.splitlines() cells = [] cell_lines: List[str] = [] @@ -108,6 +114,7 @@ return nb def new_cell(self, state, lines, **kwargs): + """Create a new cell.""" if state == "codecell": input = "\n".join(lines) input = input.strip("\n") @@ -143,6 +150,7 @@ return text def split_lines_into_blocks(self, lines): + """Split lines into code blocks.""" if len(lines) == 1: yield lines[0] raise StopIteration() @@ -157,7 +165,10 @@ class PyWriter(NotebookWriter): + """A Python notebook writer.""" + def writes(self, nb, **kwargs): + """Convert a notebook to a string.""" lines = ["# -*- coding: utf-8 -*-"] lines.extend( [ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbformat-5.7.1/nbformat/v4/convert.py new/nbformat-5.7.3/nbformat/v4/convert.py --- old/nbformat-5.7.1/nbformat/v4/convert.py 2020-02-02 01:00:00.000000000 +0100 +++ new/nbformat-5.7.3/nbformat/v4/convert.py 2020-02-02 01:00:00.000000000 +0100 @@ -40,10 +40,14 @@ from_version = nb["nbformat"] if not from_minor: if "nbformat_minor" not in nb: - raise validator.ValidationError( - "The notebook does not include the nbformat minor which is needed" - ) - from_minor = nb["nbformat_minor"] + if from_version == 4: + raise validator.ValidationError( + "The v4 notebook does not include the nbformat minor, which is needed." + ) + else: + from_minor = 0 + else: + from_minor = nb["nbformat_minor"] if from_version == 3: # Validate the notebook before conversion diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbformat-5.7.1/nbformat/v4/nbjson.py new/nbformat-5.7.3/nbformat/v4/nbjson.py --- old/nbformat-5.7.1/nbformat/v4/nbjson.py 2020-02-02 01:00:00.000000000 +0100 +++ new/nbformat-5.7.3/nbformat/v4/nbjson.py 2020-02-02 01:00:00.000000000 +0100 @@ -14,12 +14,15 @@ """A JSON encoder that accepts b64 (and other *ascii*) bytestrings.""" def default(self, obj): + """Get the default value of an object.""" if isinstance(obj, bytes): return obj.decode("ascii") return json.JSONEncoder.default(self, obj) class JSONReader(NotebookReader): + """A JSON notebook reader.""" + def reads(self, s, **kwargs): """Read a JSON string into a Notebook object""" nb = json.loads(s, **kwargs) @@ -38,6 +41,8 @@ class JSONWriter(NotebookWriter): + """A JSON notebook writer.""" + def writes(self, nb, **kwargs): """Serialize a NotebookNode object as a JSON string""" kwargs["cls"] = BytesEncoder diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbformat-5.7.1/nbformat/validator.py new/nbformat-5.7.3/nbformat/validator.py --- old/nbformat-5.7.1/nbformat/validator.py 2020-02-02 01:00:00.000000000 +0100 +++ new/nbformat-5.7.3/nbformat/validator.py 2020-02-02 01:00:00.000000000 +0100 @@ -1,3 +1,4 @@ +"""Notebook format validators.""" # Copyright (c) IPython Development Team. # Distributed under the terms of the Modified BSD License. @@ -182,11 +183,13 @@ """ def __init__(self, original, ref=None): + """Initialize the error class.""" self.original = original self.ref = getattr(self.original, "ref", ref) self.message = self.original.message def __getattr__(self, key): + """Get an attribute from the error.""" return getattr(self.original, key) def __unicode__(self): @@ -398,7 +401,7 @@ ref: Optional[str] = None, version: Optional[int] = None, version_minor: Optional[int] = None, - relax_add_props: bool = _deprecated, # type: ignore + relax_add_props: bool = False, nbjson: Any = None, repair_duplicate_cell_ids: bool = _deprecated, # type: ignore strip_invalid_metadata: bool = _deprecated, # type: ignore @@ -417,11 +420,10 @@ version : int version_minor : int relax_add_props : bool - Deprecated since 5.5.0 - will be removed in the future. - Wether to allow extra property in the Json schema validating the - notebook. + Wether to allow extra properties in the JSON schema validating the notebook. + When True, all known fields are validated, but unknown fields are ignored. nbjson - repair_duplicate_cell_ids : boolny + repair_duplicate_cell_ids : bool Deprecated since 5.5.0 - will be removed in the future. strip_invalid_metadata : bool Deprecated since 5.5.0 - will be removed in the future. @@ -444,11 +446,6 @@ """ assert isinstance(ref, str) or ref is None - if relax_add_props is _deprecated: - relax_add_props = False - else: - _dep_warn("relax_add_props") - if strip_invalid_metadata is _deprecated: strip_invalid_metadata = False else: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbformat-5.7.1/package.json new/nbformat-5.7.3/package.json --- old/nbformat-5.7.1/package.json 2020-02-02 01:00:00.000000000 +0100 +++ new/nbformat-5.7.3/package.json 2020-02-02 01:00:00.000000000 +0100 @@ -1,6 +1,6 @@ { "name": "nbformat-schema", - "version": "5.7.1", + "version": "5.7.3", "description": "JSON schemata for Jupyter notebook formats", "main": "index.js", "files": [ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbformat-5.7.1/pyproject.toml new/nbformat-5.7.3/pyproject.toml --- old/nbformat-5.7.1/pyproject.toml 2020-02-02 01:00:00.000000000 +0100 +++ new/nbformat-5.7.3/pyproject.toml 2020-02-02 01:00:00.000000000 +0100 @@ -46,7 +46,8 @@ "myst_parser", "pydata_sphinx_theme", "sphinx", -"sphinxcontrib_github_alt" +"sphinxcontrib_github_alt", +"sphinxcontrib-spelling", ] test = [ "testpath", @@ -86,7 +87,7 @@ test = "mypy --install-types --non-interactive {args:nbformat tests}" [tool.hatch.envs.lint] -dependencies = ["black[jupyter]==22.10.0", "mdformat>0.7", "ruff==0.0.185"] +dependencies = ["black[jupyter]==22.12.0", "mdformat>0.7", "ruff==0.0.207"] detached = true [tool.hatch.envs.lint.scripts] style = [ @@ -209,3 +210,15 @@ "tests/*" = ["B011", "F841", "C408", "E402", "T201", "B007", "N802", "RUF001", "RUF002"] # F401 `nbxml.to_notebook` imported but unused "nbformat/*__init__.py" = ["F401"] + +[tool.interrogate] +ignore-init-module=true +ignore-private=true +ignore-semiprivate=true +ignore-property-decorators=true +ignore-nested-functions=true +ignore-nested-classes=true +fail-under=100 + +[tool.check-wheel-contents] +ignore = ["W002"] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbformat-5.7.1/tests/test3_no_min_version.ipynb new/nbformat-5.7.3/tests/test3_no_min_version.ipynb --- old/nbformat-5.7.1/tests/test3_no_min_version.ipynb 1970-01-01 01:00:00.000000000 +0100 +++ new/nbformat-5.7.3/tests/test3_no_min_version.ipynb 2020-02-02 01:00:00.000000000 +0100 @@ -0,0 +1,12 @@ +{ + "metadata": { + "name": "" + }, + "nbformat": 3, + "worksheets": [ + { + "metadata": {}, + "cells": [] + } + ] +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbformat-5.7.1/tests/test_validator.py new/nbformat-5.7.3/tests/test_validator.py --- old/nbformat-5.7.1/tests/test_validator.py 2020-02-02 01:00:00.000000000 +0100 +++ new/nbformat-5.7.3/tests/test_validator.py 2020-02-02 01:00:00.000000000 +0100 @@ -355,6 +355,12 @@ validate(nb) +def test_notebook_v3_valid_without_min_version(): + with TestsBase.fopen("test3_no_min_version.ipynb", "r") as f: + nb = read(f, as_version=4) + validate(nb) + + def test_notebook_invalid_without_main_version(): pass