commit python-nbconvert for openSUSE:Factory
Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package python-nbconvert for openSUSE:Factory checked in at 2023-12-28 23:03:42
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-nbconvert (Old)
and /work/SRC/openSUSE:Factory/.python-nbconvert.new.28375 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-nbconvert"
Thu Dec 28 23:03:42 2023 rev:30 rq:1135497 version:7.13.1
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-nbconvert/python-nbconvert.changes 2023-12-17 21:34:36.326556165 +0100
+++ /work/SRC/openSUSE:Factory/.python-nbconvert.new.28375/python-nbconvert.changes 2023-12-28 23:05:13.866704490 +0100
@@ -1,0 +2,8 @@
+Thu Dec 28 15:21:52 UTC 2023 - Ben Greiner
+
+- Update to 7.13.1
+ * Restore removed import #2086 (@blink1073)
+- Release 7.13.0
+ * Add table, td, tr to allowed list of tags #2083 (@yuvipanda)
+
+-------------------------------------------------------------------
Old:
----
nbconvert-7.12.0.tar.gz
New:
----
nbconvert-7.13.1.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-nbconvert.spec ++++++
--- /var/tmp/diff_new_pack.TWAuHR/_old 2023-12-28 23:05:14.290719986 +0100
+++ /var/tmp/diff_new_pack.TWAuHR/_new 2023-12-28 23:05:14.290719986 +0100
@@ -30,9 +30,9 @@
%bcond_with libalternatives
%endif
# X.X.0 gets abbreviated by pythondistdeps
-%define shortversion 7.12
+%define shortversion 7.13.1
Name: python-nbconvert%{psuffix}
-Version: 7.12.0
+Version: 7.13.1
Release: 0
Summary: Conversion of Jupyter Notebooks
License: BSD-3-Clause AND MIT
@@ -80,7 +80,7 @@
%if %{with test}
BuildRequires: %{python_module flaky}
BuildRequires: %{python_module ipykernel}
-BuildRequires: %{python_module ipywidgets >= 7}
+BuildRequires: %{python_module ipywidgets >= 7.5}
BuildRequires: %{python_module nbconvert = %{version}}
BuildRequires: %{python_module pytest}
%endif
++++++ nbconvert-7.12.0.tar.gz -> nbconvert-7.13.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbconvert-7.12.0/.github/workflows/tests.yml new/nbconvert-7.13.1/.github/workflows/tests.yml
--- old/nbconvert-7.12.0/.github/workflows/tests.yml 2020-02-02 01:00:00.000000000 +0100
+++ new/nbconvert-7.13.1/.github/workflows/tests.yml 2020-02-02 01:00:00.000000000 +0100
@@ -23,13 +23,14 @@
strategy:
matrix:
os: ["ubuntu-20.04", "macos-latest", "windows-latest"]
- python-version: ["3.8", "3.11"]
+ python-version: ["3.8", "3.12"]
include:
- os: "windows-latest"
python-version: "3.9"
- - os: "ubuntu-20.04"
+ - os: "macos-latest"
python-version: "3.10"
- os: "ubuntu-20.04"
+ python-version: "3.11"
fail-fast: false
steps:
- uses: actions/checkout@v4
@@ -57,15 +58,6 @@
- uses: jupyterlab/maintainer-tools/.github/actions/upload-coverage@v1
- python312:
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v4
- - uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
- with:
- python_version: "3.12"
- - run: hatch run test:test
-
coverage:
runs-on: ubuntu-latest
needs:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbconvert-7.12.0/.pre-commit-config.yaml new/nbconvert-7.13.1/.pre-commit-config.yaml
--- old/nbconvert-7.12.0/.pre-commit-config.yaml 2020-02-02 01:00:00.000000000 +0100
+++ new/nbconvert-7.13.1/.pre-commit-config.yaml 2020-02-02 01:00:00.000000000 +0100
@@ -21,7 +21,7 @@
- id: trailing-whitespace
- repo: https://github.com/python-jsonschema/check-jsonschema
- rev: 0.27.1
+ rev: 0.27.3
hooks:
- id: check-github-workflows
@@ -51,7 +51,7 @@
args: ["-L", "sur,nd"]
- repo: https://github.com/pre-commit/mirrors-mypy
- rev: "v1.6.1"
+ rev: "v1.7.1"
hooks:
- id: mypy
files: "^nbconvert"
@@ -81,7 +81,7 @@
- id: rst-inline-touching-normal
- repo: https://github.com/astral-sh/ruff-pre-commit
- rev: v0.1.4
+ rev: v0.1.7
hooks:
- id: ruff
types_or: [python, jupyter]
@@ -90,7 +90,7 @@
types_or: [python, jupyter]
- repo: https://github.com/scientific-python/cookie
- rev: "2023.10.27"
+ rev: "2023.11.17"
hooks:
- id: sp-repo-review
additional_dependencies: ["repo-review[cli]"]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbconvert-7.12.0/CHANGELOG.md new/nbconvert-7.13.1/CHANGELOG.md
--- old/nbconvert-7.12.0/CHANGELOG.md 2020-02-02 01:00:00.000000000 +0100
+++ new/nbconvert-7.13.1/CHANGELOG.md 2020-02-02 01:00:00.000000000 +0100
@@ -2,6 +2,42 @@
<!-- <START NEW CHANGELOG ENTRY> -->
+## 7.13.1
+
+([Full Changelog](https://github.com/jupyter/nbconvert/compare/v7.13.0...15b2bc2e215bc3d0ab375...))
+
+### Bugs fixed
+
+- Restore removed import [#2086](https://github.com/jupyter/nbconvert/pull/2086) ([@blink1073](https://github.com/blink1073))
+
+### Contributors to this release
+
+([GitHub contributors page for this release](https://github.com/jupyter/nbconvert/graphs/contributors?from=2023-12-18&to=2023-12-21&type=c))
+
+[@blink1073](https://github.com/search?q=repo%3Ajupyter%2Fnbconvert+involves%3Ablink1073+updated%3A2023-12-18..2023-12-21&type=Issues)
+
+<!-- <END NEW CHANGELOG ENTRY> -->
+
+## 7.13.0
+
+([Full Changelog](https://github.com/jupyter/nbconvert/compare/v7.12.0...c72ad76251d50c9cf3139...))
+
+### Enhancements made
+
+- Add table, td, tr to allowed list of tags [#2083](https://github.com/jupyter/nbconvert/pull/2083) ([@yuvipanda](https://github.com/yuvipanda))
+
+### Maintenance and upkeep improvements
+
+- Remove twitter links that cause linkcheck to fail [#2084](https://github.com/jupyter/nbconvert/pull/2084) ([@yuvipanda](https://github.com/yuvipanda))
+- Update ruff config [#2079](https://github.com/jupyter/nbconvert/pull/2079) ([@blink1073](https://github.com/blink1073))
+- chore: update pre-commit hooks [#2076](https://github.com/jupyter/nbconvert/pull/2076) ([@pre-commit-ci](https://github.com/pre-commit-ci))
+
+### Contributors to this release
+
+([GitHub contributors page for this release](https://github.com/jupyter/nbconvert/graphs/contributors?from=2023-12-04&to=2023-12-18&type=c))
+
+[@blink1073](https://github.com/search?q=repo%3Ajupyter%2Fnbconvert+involves%3Ablink1073+updated%3A2023-12-04..2023-12-18&type=Issues) | [@pre-commit-ci](https://github.com/search?q=repo%3Ajupyter%2Fnbconvert+involves%3Apre-commit-ci+updated%3A2023-12-04..2023-12-18&type=Issues) | [@yuvipanda](https://github.com/search?q=repo%3Ajupyter%2Fnbconvert+involves%3Ayuvipanda+updated%3A2023-12-04..2023-12-18&type=Issues)
+
## 7.12.0
([Full Changelog](https://github.com/jupyter/nbconvert/compare/v7.11.0...4f6ab6583de771e74874e...))
@@ -24,8 +60,6 @@
[@blink1073](https://github.com/search?q=repo%3Ajupyter%2Fnbconvert+involves%3Ablink1073+updated%3A2023-11-06..2023-12-04&type=Issues) | [@Carreau](https://github.com/search?q=repo%3Ajupyter%2Fnbconvert+involves%3ACarreau+updated%3A2023-11-06..2023-12-04&type=Issues) | [@gnestor](https://github.com/search?q=repo%3Ajupyter%2Fnbconvert+involves%3Agnestor+updated%3A2023-11-06..2023-12-04&type=Issues) | [@minrk](https://github.com/search?q=repo%3Ajupyter%2Fnbconvert+involves%3Aminrk+updated%3A2023-11-06..2023-12-04&type=Issues) | [@mpacer](https://github.com/search?q=repo%3Ajupyter%2Fnbconvert+involves%3Ampacer+updated%3A2023-11-06..2023-12-04&type=Issues)
-<!-- <END NEW CHANGELOG ENTRY> -->
-
## 7.11.0
([Full Changelog](https://github.com/jupyter/nbconvert/compare/v7.10.0...422dd2a1697b191dc8e11...))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbconvert-7.12.0/PKG-INFO new/nbconvert-7.13.1/PKG-INFO
--- old/nbconvert-7.12.0/PKG-INFO 2020-02-02 01:00:00.000000000 +0100
+++ new/nbconvert-7.13.1/PKG-INFO 2020-02-02 01:00:00.000000000 +0100
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: nbconvert
-Version: 7.12.0
+Version: 7.13.1
Summary: Converting Jupyter Notebooks
Project-URL: Homepage, https://jupyter.org
Author-email: Jupyter Development Team
<p>As https://twitter.com/Mbussonn\">@Mbussonn</a> requested... easieeeeer! Deploy your Nikola site with just a click in the IPython notebook! http://t.co/860sJunZvj\">http://t.co/860sJunZvj</a> cc https://twitter.com/ralsina\">@ralsina</a></p>— Damián Avila (@damian_avila) https://twitter.com/damian_avila/statuses/370306057828335616\">August 21, 2013</a></blockquote>\n",
- "</center>"
- ]
}
],
"metadata": {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbconvert-7.12.0/hatch_build.py new/nbconvert-7.13.1/hatch_build.py
--- old/nbconvert-7.12.0/hatch_build.py 2020-02-02 01:00:00.000000000 +0100
+++ new/nbconvert-7.13.1/hatch_build.py 2020-02-02 01:00:00.000000000 +0100
@@ -47,7 +47,7 @@
os.makedirs(directory)
print("Downloading CSS: %s" % url)
try:
- css = urlopen(url).read() # noqa
+ css = urlopen(url).read() # noqa: S310
except Exception as e:
msg = f"Failed to download css from {url}: {e}"
print(msg, file=sys.stderr)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbconvert-7.12.0/nbconvert/_version.py new/nbconvert-7.13.1/nbconvert/_version.py
--- old/nbconvert-7.12.0/nbconvert/_version.py 2020-02-02 01:00:00.000000000 +0100
+++ new/nbconvert-7.13.1/nbconvert/_version.py 2020-02-02 01:00:00.000000000 +0100
@@ -3,12 +3,12 @@
from typing import List
# Version string must appear intact for versioning
-__version__ = "7.12.0"
+__version__ = "7.13.1"
# Build up version_info tuple for backwards compatibility
pattern = r"(?P<major>\d+).(?P<minor>\d+).(?P<patch>\d+)(?P<rest>.*)"
match = re.match(pattern, __version__)
-assert match is not None # noqa
+assert match is not None
parts: List[object] = [int(match[part]) for part in ["major", "minor", "patch"]]
if match["rest"]:
parts.append(match["rest"])
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbconvert-7.12.0/nbconvert/exporters/base.py new/nbconvert-7.13.1/nbconvert/exporters/base.py
--- old/nbconvert-7.12.0/nbconvert/exporters/base.py 2020-02-02 01:00:00.000000000 +0100
+++ new/nbconvert-7.13.1/nbconvert/exporters/base.py 2020-02-02 01:00:00.000000000 +0100
@@ -33,14 +33,10 @@
class ExporterNameError(NameError):
"""An exporter name error."""
- pass
-
class ExporterDisabledError(ValueError):
"""An exporter disabled error."""
- pass
-
def export(exporter, nb, **kw):
"""
@@ -74,7 +70,7 @@
if exporter is None:
msg = "Exporter is None"
raise TypeError(msg)
- elif not isinstance(exporter, Exporter) and not issubclass(exporter, Exporter):
+ if not isinstance(exporter, Exporter) and not issubclass(exporter, Exporter):
msg = "exporter does not inherit from Exporter (base)"
raise TypeError(msg)
if nb is None:
@@ -95,7 +91,7 @@
return output, resources
-def get_exporter(name, config=get_config()): # noqa
+def get_exporter(name, config=get_config()): # noqa: B008
"""Given an exporter name or import path, return a class ready to be instantiated
Raises ExporterName if exporter is not found or ExporterDisabledError if not enabled
@@ -110,8 +106,7 @@
exporter = items[0].load()
if getattr(exporter(config=config), "enabled", True):
return exporter
- else:
- raise ExporterDisabledError('Exporter "%s" disabled in configuration' % (name))
+ raise ExporterDisabledError('Exporter "%s" disabled in configuration' % (name))
except IndexError:
pass
@@ -120,11 +115,10 @@
exporter = import_item(name)
if getattr(exporter(config=config), "enabled", True):
return exporter
- else:
- raise ExporterDisabledError('Exporter "%s" disabled in configuration' % (name))
+ raise ExporterDisabledError('Exporter "%s" disabled in configuration' % (name))
except ImportError:
log = get_logger()
- log.error("Error importing %s" % name, exc_info=True)
+ log.error("Error importing %s", name, exc_info=True) # noqa: G201
msg = 'Unknown exporter "{}", did you mean one of: {}?'.format(
name, ", ".join(get_export_names())
@@ -132,7 +126,7 @@
raise ExporterNameError(msg)
-def get_export_names(config=get_config()): # noqa
+def get_export_names(config=get_config()): # noqa: B008
"""Return a list of the currently supported export targets
Exporters can be found in external packages by registering
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbconvert-7.12.0/nbconvert/exporters/exporter.py new/nbconvert-7.13.1/nbconvert/exporters/exporter.py
--- old/nbconvert-7.12.0/nbconvert/exporters/exporter.py 2020-02-02 01:00:00.000000000 +0100
+++ new/nbconvert-7.13.1/nbconvert/exporters/exporter.py 2020-02-02 01:00:00.000000000 +0100
@@ -253,7 +253,7 @@
preprocessor_cls = import_item(preprocessor)
return self.register_preprocessor(preprocessor_cls, enabled)
- if constructed and hasattr(preprocessor, "__call__"): # noqa
+ if constructed and callable(preprocessor):
# Preprocessor is a function, no need to construct it.
# Register and return the preprocessor.
if enabled:
@@ -261,21 +261,22 @@
self._preprocessors.append(preprocessor)
return preprocessor
- elif isclass and issubclass(preprocessor, HasTraits):
+ if isclass and issubclass(preprocessor, HasTraits):
# Preprocessor is configurable. Make sure to pass in new default for
# the enabled flag if one was specified.
self.register_preprocessor(preprocessor(parent=self), enabled)
+ return None
- elif isclass:
+ if isclass:
# Preprocessor is not configurable, construct it
self.register_preprocessor(preprocessor(), enabled)
+ return None
- else:
- # Preprocessor is an instance of something without a __call__
- # attribute.
- raise TypeError(
- "preprocessor must be callable or an importable constructor, got %r" % preprocessor
- )
+ # Preprocessor is an instance of something without a __call__
+ # attribute.
+ raise TypeError(
+ "preprocessor must be callable or an importable constructor, got %r" % preprocessor
+ )
def _init_preprocessors(self):
"""
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbconvert-7.12.0/nbconvert/exporters/html.py new/nbconvert-7.13.1/nbconvert/exporters/html.py
--- old/nbconvert-7.12.0/nbconvert/exporters/html.py 2020-02-02 01:00:00.000000000 +0100
+++ new/nbconvert-7.13.1/nbconvert/exporters/html.py 2020-02-02 01:00:00.000000000 +0100
@@ -213,8 +213,9 @@
def _valid_language_code(self, proposal):
if self.language_code not in iso639_1:
self.log.warning(
- f'"{self.language_code}" is not an ISO 639-1 language code. '
- 'It has been replaced by the default value "en".'
+ '"%s" is not an ISO 639-1 language code. '
+ 'It has been replaced by the default value "en".',
+ self.language_code,
)
return proposal["trait"].default_value
return proposal["value"]
@@ -265,7 +266,7 @@
elem.attrs["alt"] = "No description has been provided for this image"
missing_alt += 1
if missing_alt:
- self.log.warning(f"Alternative text is missing on {missing_alt} image(s).")
+ self.log.warning("Alternative text is missing on %s image(s).", missing_alt)
# Set input and output focusable
for elem in soup.select(".jp-Notebook div.jp-Cell-inputWrapper"):
elem.attrs["tabindex"] = "0"
@@ -274,7 +275,7 @@
return str(soup), resources
- def _init_resources(self, resources): # noqa
+ def _init_resources(self, resources):
def resources_include_css(name):
env = self.environment
code = """<style type="text/css">\n%s</style>""" % (env.loader.get_source(env, name)[0])
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbconvert-7.12.0/nbconvert/exporters/pdf.py new/nbconvert-7.13.1/nbconvert/exporters/pdf.py
--- old/nbconvert-7.12.0/nbconvert/exporters/pdf.py 2020-02-02 01:00:00.000000000 +0100
+++ new/nbconvert-7.13.1/nbconvert/exporters/pdf.py 2020-02-02 01:00:00.000000000 +0100
@@ -17,7 +17,7 @@
from .latex import LatexExporter
-class LatexFailed(IOError): # noqa
+class LatexFailed(IOError):
"""Exception for failed latex run
Captured latex output is in error.output.
@@ -33,8 +33,7 @@
def __str__(self):
"""String representation."""
- u = self.__unicode__()
- return u
+ return self.__unicode__()
def prepend_to_env_search_path(varname, value, envdict):
@@ -85,9 +84,7 @@
def _template_extension_default(self):
return ".tex.j2"
- def run_command( # noqa
- self, command_list, filename, count, log_function, raise_on_failure=None
- ):
+ def run_command(self, command_list, filename, count, log_function, raise_on_failure=None):
"""Run command_list count times.
Parameters
@@ -141,12 +138,12 @@
stdout=stdout,
stderr=subprocess.STDOUT,
stdin=null,
- shell=shell, # noqa
+ shell=shell, # noqa: S603
env=env,
)
out, _ = p.communicate()
if p.returncode:
- if self.verbose: # noqa
+ if self.verbose: # noqa: SIM108
# verbose means I didn't capture stdout with PIPE,
# so it's already been displayed and `out` is None.
out_str = ""
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbconvert-7.12.0/nbconvert/exporters/qt_exporter.py new/nbconvert-7.13.1/nbconvert/exporters/qt_exporter.py
--- old/nbconvert-7.12.0/nbconvert/exporters/qt_exporter.py 2020-02-02 01:00:00.000000000 +0100
+++ new/nbconvert-7.13.1/nbconvert/exporters/qt_exporter.py 2020-02-02 01:00:00.000000000 +0100
@@ -12,7 +12,7 @@
"""A qt exporter."""
paginate = None
- format = "" # noqa
+ format = ""
@default("file_extension")
def _file_extension_default(self):
@@ -41,7 +41,7 @@
with temp_file:
temp_file.write(html.encode("utf-8"))
try:
- QtScreenshot = self._check_launch_reqs() # noqa
+ QtScreenshot = self._check_launch_reqs()
s = QtScreenshot()
s.capture(f"file://{temp_file.name}", filename, self.paginate)
finally:
@@ -54,9 +54,9 @@
self._check_launch_reqs()
html, resources = super().from_notebook_node(nb, resources=resources, **kw)
- self.log.info(f"Building {self.format.upper()}")
+ self.log.info("Building %s", self.format.upper())
data = self._run_pyqtwebengine(html)
- self.log.info(f"{self.format.upper()} successfully created")
+ self.log.info("%s successfully created", self.format.upper())
# convert output extension
# the writer above required it to be html
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbconvert-7.12.0/nbconvert/exporters/qtpdf.py new/nbconvert-7.13.1/nbconvert/exporters/qtpdf.py
--- old/nbconvert-7.12.0/nbconvert/exporters/qtpdf.py 2020-02-02 01:00:00.000000000 +0100
+++ new/nbconvert-7.13.1/nbconvert/exporters/qtpdf.py 2020-02-02 01:00:00.000000000 +0100
@@ -16,7 +16,7 @@
"""
export_from_notebook = "PDF via HTML"
- format = "pdf" # noqa
+ format = "pdf"
paginate = Bool( # type:ignore[assignment]
True,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbconvert-7.12.0/nbconvert/exporters/qtpng.py new/nbconvert-7.13.1/nbconvert/exporters/qtpng.py
--- old/nbconvert-7.12.0/nbconvert/exporters/qtpng.py 2020-02-02 01:00:00.000000000 +0100
+++ new/nbconvert-7.13.1/nbconvert/exporters/qtpng.py 2020-02-02 01:00:00.000000000 +0100
@@ -14,4 +14,4 @@
"""
export_from_notebook = "PNG via HTML"
- format = "png" # noqa
+ format = "png"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbconvert-7.12.0/nbconvert/exporters/script.py new/nbconvert-7.13.1/nbconvert/exporters/script.py
--- old/nbconvert-7.12.0/nbconvert/exporters/script.py 2020-02-02 01:00:00.000000000 +0100
+++ new/nbconvert-7.13.1/nbconvert/exporters/script.py 2020-02-02 01:00:00.000000000 +0100
@@ -39,7 +39,7 @@
if lang_name not in self._lang_exporters:
try:
exporters = entry_points(group="nbconvert.exporters.script")
- exporter = [e for e in exporters if e.name == lang_name][0].load() # noqa
+ exporter = [e for e in exporters if e.name == lang_name][0].load() # noqa: RUF015
except (KeyError, IndexError):
self._lang_exporters[lang_name] = None
else:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbconvert-7.12.0/nbconvert/exporters/templateexporter.py new/nbconvert-7.13.1/nbconvert/exporters/templateexporter.py
--- old/nbconvert-7.12.0/nbconvert/exporters/templateexporter.py 2020-02-02 01:00:00.000000000 +0100
+++ new/nbconvert-7.13.1/nbconvert/exporters/templateexporter.py 2020-02-02 01:00:00.000000000 +0100
@@ -151,7 +151,7 @@
"""
# finish the docstring
- __doc__ = __doc__.format(filters="- " + "\n - ".join(sorted(default_filters.keys()))) # noqa
+ __doc__ = __doc__.format(filters="- " + "\n - ".join(sorted(default_filters.keys())))
_template_cached = None
@@ -247,6 +247,7 @@
def _template_file_default(self):
if self.template_extension:
return "index" + self.template_extension
+ return None
@observe("raw_template")
def _raw_template_changed(self, change):
@@ -269,15 +270,11 @@
jupyter_path("nbconvert", "templates"), help="Path where templates can be installed too."
).tag(affects_environment=True)
- # Extension that the template files use.
- template_extension = Unicode().tag(config=True, affects_environment=True)
-
@default("template_extension")
def _template_extension_default(self):
if self.file_extension:
return self.file_extension + ".j2"
- else:
- return self.file_extension
+ return self.file_extension
exclude_input = Bool(
False, help="This allows you to exclude code cell inputs from all templates if set to True."
@@ -453,27 +450,28 @@
filter_cls = import_item(jinja_filter)
return self._register_filter(environ, name, filter_cls)
- if constructed and hasattr(jinja_filter, "__call__"): # noqa
+ if constructed and callable(jinja_filter):
# filter is a function, no need to construct it.
environ.filters[name] = jinja_filter
return jinja_filter
- elif isclass and issubclass(jinja_filter, HasTraits):
+ if isclass and issubclass(jinja_filter, HasTraits):
# filter is configurable. Make sure to pass in new default for
# the enabled flag if one was specified.
filter_instance = jinja_filter(parent=self)
self._register_filter(environ, name, filter_instance)
+ return None
- elif isclass:
+ if isclass:
# filter is not configurable, construct it
filter_instance = jinja_filter()
self._register_filter(environ, name, filter_instance)
+ return None
- else:
- # filter is an instance of something without a __call__
- # attribute.
- msg = "filter"
- raise TypeError(msg)
+ # filter is an instance of something without a __call__
+ # attribute.
+ msg = "filter"
+ raise TypeError(msg)
def register_filter(self, name, jinja_filter):
"""
@@ -513,7 +511,7 @@
ExtensionTolerantLoader(FileSystemLoader(paths), self.template_extension),
DictLoader({self._raw_template_key: self.raw_template}),
]
- environment = Environment( # noqa
+ environment = Environment( # noqa: S701
loader=ChoiceLoader(loaders),
extensions=JINJA_EXTENSIONS,
enable_async=self.enable_async,
@@ -547,7 +545,7 @@
preprocessor_cls = import_item(preprocessor_cls)
if preprocessor_cls.__name__ in self.config:
kwargs.update(self.config[preprocessor_cls.__name__])
- preprocessor = preprocessor_cls(**kwargs) # noqa
+ preprocessor = preprocessor_cls(**kwargs) # noqa: PLW2901
self.register_preprocessor(preprocessor)
def _get_conf(self):
@@ -602,8 +600,9 @@
return {"base_template": "base"}
if name == "full":
return {"base_template": "classic", "mimetypes": {"text/html": True}}
+ return None
- def get_template_names(self): # noqa
+ def get_template_names(self):
"""Finds a list of template names where each successive template name is the base template"""
template_names = []
root_dirs = self.get_prefix_root_dirs()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbconvert-7.12.0/nbconvert/exporters/webpdf.py new/nbconvert-7.13.1/nbconvert/exporters/webpdf.py
--- old/nbconvert-7.12.0/nbconvert/exporters/webpdf.py 2020-02-02 01:00:00.000000000 +0100
+++ new/nbconvert-7.13.1/nbconvert/exporters/webpdf.py 2020-02-02 01:00:00.000000000 +0100
@@ -85,7 +85,7 @@
if self.allow_chromium_download:
cmd = [sys.executable, "-m", "playwright", "install", "chromium"]
- subprocess.check_call(cmd) # noqa
+ subprocess.check_call(cmd) # noqa: S603
playwright = await async_playwright().start()
chromium = playwright.chromium
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbconvert-7.12.0/nbconvert/filters/ansi.py new/nbconvert-7.13.1/nbconvert/filters/ansi.py
--- old/nbconvert-7.12.0/nbconvert/filters/ansi.py 2020-02-02 01:00:00.000000000 +0100
+++ new/nbconvert-7.13.1/nbconvert/filters/ansi.py 2020-02-02 01:00:00.000000000 +0100
@@ -71,7 +71,7 @@
return _ansi2anything(text, _latexconverter)
-def _htmlconverter(fg, bg, bold, underline, inverse): # noqa
+def _htmlconverter(fg, bg, bold, underline, inverse):
"""
Return start and end tags for given foreground/background/bold/underline.
@@ -114,7 +114,7 @@
return starttag, "</span>"
-def _latexconverter(fg, bg, bold, underline, inverse): # noqa
+def _latexconverter(fg, bg, bold, underline, inverse):
"""
Return start and end markup given foreground/background/bold/underline.
@@ -165,7 +165,7 @@
return starttag, endtag
-def _ansi2anything(text, converter): # noqa
+def _ansi2anything(text, converter):
r"""
Convert ANSI colors to HTML or LaTeX.
@@ -275,10 +275,10 @@
idx = numbers.pop(0)
if idx < 0:
raise ValueError()
- elif idx < 16:
+ if idx < 16:
# 16 default terminal colors
return idx
- elif idx < 232:
+ if idx < 232:
# 6x6x6 color cube, see http://stackoverflow.com/a/27165165/500098
r = (idx - 16) // 36
r = 55 + r * 40 if r > 0 else 0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbconvert-7.12.0/nbconvert/filters/citation.py new/nbconvert-7.13.1/nbconvert/filters/citation.py
--- old/nbconvert-7.12.0/nbconvert/filters/citation.py 2020-02-02 01:00:00.000000000 +0100
+++ new/nbconvert-7.13.1/nbconvert/filters/citation.py 2020-02-02 01:00:00.000000000 +0100
@@ -44,7 +44,7 @@
for citation in parser.citelist:
outtext += s[startpos : citation[1]]
outtext += "\\cite{%s}" % citation[0]
- startpos = citation[2] if len(citation) == 3 else -1 # noqa
+ startpos = citation[2] if len(citation) == 3 else -1
outtext += s[startpos:] if startpos != -1 else ""
return outtext
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbconvert-7.12.0/nbconvert/filters/filter_links.py new/nbconvert-7.13.1/nbconvert/filters/filter_links.py
--- old/nbconvert-7.12.0/nbconvert/filters/filter_links.py 2020-02-02 01:00:00.000000000 +0100
+++ new/nbconvert-7.13.1/nbconvert/filters/filter_links.py 2020-02-02 01:00:00.000000000 +0100
@@ -1,4 +1,3 @@
-#!/usr/bin/env python3
"""A pandoc filter used in converting notebooks to Latex.
Converts links between notebooks to Latex cross-references.
"""
@@ -37,5 +36,5 @@
label = re.sub(r"[^\w-]+", "", label) # Strip HTML entities
text = re.sub(r"_", r"\_", text) # Escape underscores in display text
return RawInline("tex", rf"\hyperref[{label}]{{{text}}}")
-
+ return None
# Other elements will be returned unchanged.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbconvert-7.12.0/nbconvert/filters/highlight.py new/nbconvert-7.13.1/nbconvert/filters/highlight.py
--- old/nbconvert-7.12.0/nbconvert/filters/highlight.py 2020-02-02 01:00:00.000000000 +0100
+++ new/nbconvert-7.13.1/nbconvert/filters/highlight.py 2020-02-02 01:00:00.000000000 +0100
@@ -133,8 +133,7 @@
if strip_verbatim:
latex = latex.replace(r"\begin{Verbatim}[commandchars=\\\{\}]" + "\n", "")
return latex.replace("\n\\end{Verbatim}\n", "")
- else:
- return latex
+ return latex
def _pygments_highlight(source, output_formatter, language="ipython", metadata=None):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbconvert-7.12.0/nbconvert/filters/markdown_mistune.py new/nbconvert-7.13.1/nbconvert/filters/markdown_mistune.py
--- old/nbconvert-7.12.0/nbconvert/filters/markdown_mistune.py 2020-02-02 01:00:00.000000000 +0100
+++ new/nbconvert-7.13.1/nbconvert/filters/markdown_mistune.py 2020-02-02 01:00:00.000000000 +0100
@@ -52,11 +52,9 @@
return PLUGINS[name] # type: ignore[no-any-return]
-class InvalidNotebook(Exception): # noqa
+class InvalidNotebook(Exception):
"""An invalid notebook model."""
- pass
-
def _dotall(pattern: str) -> str:
"""Makes the '.' special character match any character inside the pattern, including a newline.
@@ -268,7 +266,7 @@
class IPythonRenderer(HTMLRenderer):
"""An ipython html renderer."""
- def __init__( # noqa
+ def __init__(
self,
escape: bool = True,
allow_harmful_protocols: bool = True,
@@ -402,7 +400,7 @@
default_mime_type = next(iter(attachment.keys()))
return f"data:{default_mime_type};base64,{attachment[default_mime_type]}"
- elif self.embed_images:
+ if self.embed_images:
base64_url = self._src_to_base64(src)
if base64_url is not None:
return base64_url
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbconvert-7.12.0/nbconvert/filters/strings.py new/nbconvert-7.13.1/nbconvert/filters/strings.py
--- old/nbconvert-7.12.0/nbconvert/filters/strings.py 2020-02-02 01:00:00.000000000 +0100
+++ new/nbconvert-7.13.1/nbconvert/filters/strings.py 2020-02-02 01:00:00.000000000 +0100
@@ -56,7 +56,7 @@
"""
split_text = text.split("\n")
- wrp = map(lambda x: textwrap.wrap(x, width), split_text) # noqa
+ wrp = map(lambda x: textwrap.wrap(x, width), split_text) # noqa: C417
wrpd = map("\n".join, wrp)
return "\n".join(wrpd)
@@ -89,7 +89,7 @@
kwargs["css_sanitizer"] = css_sanitizer
return bleach.clean(
element,
- tags=[*bleach.ALLOWED_TAGS, "div", "pre", "code", "span"],
+ tags=[*bleach.ALLOWED_TAGS, "div", "pre", "code", "span", "table", "tr", "td"],
attributes={
**bleach.ALLOWED_ATTRIBUTES,
"*": ["class", "id"],
@@ -174,7 +174,7 @@
"""
cleaned_text = files_url_pattern.sub(r"\1=\2", text)
cleaned_text = markdown_url_pattern.sub(r"\1[\2](\3)", cleaned_text)
- return cleaned_text
+ return cleaned_text # noqa: RET504
def comment_lines(text, prefix="# "):
@@ -269,7 +269,7 @@
out = re.sub(r"(^\s*)\-", r"\1\-", out)
out = re.sub(r"(^\s*)\+", r"\1\+", out)
out = re.sub(r"(^\s*)\*", r"\1\*", out)
- return out
+ return out # noqa: RET504
def strip_trailing_newline(text):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbconvert-7.12.0/nbconvert/nbconvertapp.py new/nbconvert-7.13.1/nbconvert/nbconvertapp.py
--- old/nbconvert-7.12.0/nbconvert/nbconvertapp.py 2020-02-02 01:00:00.000000000 +0100
+++ new/nbconvert-7.13.1/nbconvert/nbconvertapp.py 2020-02-02 01:00:00.000000000 +0100
@@ -25,7 +25,6 @@
from nbconvert.utils.text import indent
from .exporters.base import get_export_names, get_exporter
-from .filters.markdown_mistune import InvalidNotebook # noqa For backward compatibility
from .utils.base import NbConvertBase
from .utils.exceptions import ConversionException
from .utils.io import unicode_stdin_stream
@@ -46,8 +45,7 @@
"""Validate an input."""
if value is not None and len(value) > 0:
return super().validate(obj, value)
- else:
- return value
+ return value
nbconvert_aliases = {}
@@ -422,7 +420,7 @@
notebook_name = basename[: basename.rfind(".")]
notebook_name = self.output_base.format(notebook_name=notebook_name)
- return notebook_name
+ return notebook_name # noqa: RET504
def init_single_notebook_resources(self, notebook_filename):
"""Step 1: Initialize resources
@@ -482,7 +480,7 @@
notebook_filename, resources=resources
)
except ConversionException:
- self.log.error("Error while converting '%s'", notebook_filename, exc_info=True)
+ self.log.error("Error while converting '%s'", notebook_filename, exc_info=True) # noqa: G201
self.exit(1)
return output, resources
@@ -517,8 +515,7 @@
if not self.writer:
msg = "No writer object defined!"
raise ValueError(msg)
- write_results = self.writer.write(output, resources, notebook_name=notebook_name)
- return write_results
+ return self.writer.write(output, resources, notebook_name=notebook_name)
def postprocess_single_notebook(self, write_results):
"""Step 4: Post-process the written file
@@ -594,6 +591,7 @@
input_buffer = unicode_stdin_stream()
# default name when conversion from stdin
self.convert_single_notebook("notebook.ipynb", input_buffer=input_buffer)
+ input_buffer.close()
def document_flag_help(self):
"""
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbconvert-7.12.0/nbconvert/postprocessors/serve.py new/nbconvert-7.13.1/nbconvert/postprocessors/serve.py
--- old/nbconvert-7.12.0/nbconvert/postprocessors/serve.py 2020-02-02 01:00:00.000000000 +0100
+++ new/nbconvert-7.13.1/nbconvert/postprocessors/serve.py 2020-02-02 01:00:00.000000000 +0100
@@ -61,7 +61,7 @@
ip = Unicode("127.0.0.1", help="The IP address to listen on.").tag(config=True)
port = Int(8000, help="port for the server to listen on.").tag(config=True)
- def postprocess(self, input): # noqa
+ def postprocess(self, input):
"""Serve the build directory with a webserver."""
dirname, filename = os.path.split(input)
handlers: list[tuple[t.Any, ...]] = [
@@ -96,10 +96,10 @@
if self.open_in_browser:
try:
browser = webbrowser.get(self.browser or None)
- b = lambda: browser.open(url, new=2) # noqa
+ b = lambda: browser.open(url, new=2) # noqa: E731
threading.Thread(target=b).start()
except webbrowser.Error as e:
- self.log.warning("No web browser found: %s." % e)
+ self.log.warning("No web browser found: %s.", e)
browser = None
try:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbconvert-7.12.0/nbconvert/preprocessors/base.py new/nbconvert-7.13.1/nbconvert/preprocessors/base.py
--- old/nbconvert-7.12.0/nbconvert/preprocessors/base.py 2020-02-02 01:00:00.000000000 +0100
+++ new/nbconvert-7.13.1/nbconvert/preprocessors/base.py 2020-02-02 01:00:00.000000000 +0100
@@ -46,8 +46,7 @@
if self.enabled:
self.log.debug("Applying preprocessor: %s", self.__class__.__name__)
return self.preprocess(nb, resources)
- else:
- return nb, resources
+ return nb, resources
def preprocess(self, nb, resources):
"""
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbconvert-7.12.0/nbconvert/preprocessors/clearmetadata.py new/nbconvert-7.13.1/nbconvert/preprocessors/clearmetadata.py
--- old/nbconvert-7.12.0/nbconvert/preprocessors/clearmetadata.py 2020-02-02 01:00:00.000000000 +0100
+++ new/nbconvert-7.13.1/nbconvert/preprocessors/clearmetadata.py 2020-02-02 01:00:00.000000000 +0100
@@ -41,11 +41,10 @@
"""Get the current key for a mask key."""
if isinstance(mask_key, str):
return mask_key
- elif len(mask_key) == 0:
+ if len(mask_key) == 0:
# Safeguard
return None
- else:
- return mask_key[0]
+ return mask_key[0]
def current_mask(self, mask):
"""Get the current mask for a mask."""
@@ -76,7 +75,7 @@
"""
All the code cells are returned with an empty metadata field.
"""
- if self.clear_cell_metadata and cell.cell_type == "code": # noqa
+ if self.clear_cell_metadata and cell.cell_type == "code": # noqa: SIM102
# Remove metadata
if "metadata" in cell:
cell.metadata = dict(
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbconvert-7.12.0/nbconvert/preprocessors/csshtmlheader.py new/nbconvert-7.13.1/nbconvert/preprocessors/csshtmlheader.py
--- old/nbconvert-7.12.0/nbconvert/preprocessors/csshtmlheader.py 2020-02-02 01:00:00.000000000 +0100
+++ new/nbconvert-7.13.1/nbconvert/preprocessors/csshtmlheader.py 2020-02-02 01:00:00.000000000 +0100
@@ -87,7 +87,7 @@
def _hash(self, filename):
"""Compute the hash of a file."""
- md5 = hashlib.md5() # noqa
+ md5 = hashlib.md5() # noqa: S324
with open(filename, "rb") as f:
md5.update(f.read())
return md5.digest()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbconvert-7.12.0/nbconvert/preprocessors/execute.py new/nbconvert-7.13.1/nbconvert/preprocessors/execute.py
--- old/nbconvert-7.12.0/nbconvert/preprocessors/execute.py 2020-02-02 01:00:00.000000000 +0100
+++ new/nbconvert-7.13.1/nbconvert/preprocessors/execute.py 2020-02-02 01:00:00.000000000 +0100
@@ -7,10 +7,9 @@
from jupyter_client.manager import KernelManager
from nbclient.client import NotebookClient
from nbclient.client import execute as _execute
+from nbclient.exceptions import CellExecutionError # noqa: F401
# Backwards compatibility for imported name
-from nbclient.exceptions import CellExecutionError # noqa
-
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
from nbformat import NotebookNode
@@ -94,9 +93,9 @@
self._check_assign_resources(resources)
with self.setup_kernel():
- assert self.kc # noqa
+ assert self.kc
info_msg = self.wait_for_reply(self.kc.kernel_info())
- assert info_msg # noqa
+ assert info_msg
self.nb.metadata["language_info"] = info_msg["content"]["language_info"]
for index, cell in enumerate(self.nb.cells):
self.preprocess_cell(cell, resources, index)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbconvert-7.12.0/nbconvert/preprocessors/extractattachments.py new/nbconvert-7.13.1/nbconvert/preprocessors/extractattachments.py
--- old/nbconvert-7.12.0/nbconvert/preprocessors/extractattachments.py 2020-02-02 01:00:00.000000000 +0100
+++ new/nbconvert-7.13.1/nbconvert/preprocessors/extractattachments.py 2020-02-02 01:00:00.000000000 +0100
@@ -80,7 +80,7 @@
"""
if "attachments" in cell:
for fname in cell.attachments:
- self.log.debug(f"Encountered attachment {fname}")
+ self.log.debug("Encountered attachment %s", fname)
# Add file for writer
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbconvert-7.12.0/nbconvert/preprocessors/extractoutput.py new/nbconvert-7.13.1/nbconvert/preprocessors/extractoutput.py
--- old/nbconvert-7.12.0/nbconvert/preprocessors/extractoutput.py 2020-02-02 01:00:00.000000000 +0100
+++ new/nbconvert-7.13.1/nbconvert/preprocessors/extractoutput.py 2020-02-02 01:00:00.000000000 +0100
@@ -53,7 +53,7 @@
config=True
)
- def preprocess_cell(self, cell, resources, cell_index): # noqa
+ def preprocess_cell(self, cell, resources, cell_index):
"""
Apply a transformation on each cell,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbconvert-7.12.0/nbconvert/preprocessors/highlightmagics.py new/nbconvert-7.13.1/nbconvert/preprocessors/highlightmagics.py
--- old/nbconvert-7.12.0/nbconvert/preprocessors/highlightmagics.py 2020-02-02 01:00:00.000000000 +0100
+++ new/nbconvert-7.13.1/nbconvert/preprocessors/highlightmagics.py 2020-02-02 01:00:00.000000000 +0100
@@ -77,8 +77,7 @@
# By construction of the re, the matched language must be in the
# languages dictionary
return self.default_languages[m.group(1)]
- else:
- return None
+ return None
def preprocess_cell(self, cell, resources, cell_index):
"""
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbconvert-7.12.0/nbconvert/preprocessors/sanitize.py new/nbconvert-7.13.1/nbconvert/preprocessors/sanitize.py
--- old/nbconvert-7.12.0/nbconvert/preprocessors/sanitize.py 2020-02-02 01:00:00.000000000 +0100
+++ new/nbconvert-7.13.1/nbconvert/preprocessors/sanitize.py 2020-02-02 01:00:00.000000000 +0100
@@ -117,12 +117,13 @@
# but erring on the side of safety maybe.
cell.source = self.sanitize_html_tags(cell.source)
return cell, resources
- elif cell.cell_type == "markdown":
+ if cell.cell_type == "markdown":
cell.source = self.sanitize_html_tags(cell.source)
return cell, resources
- elif cell.cell_type == "code":
+ if cell.cell_type == "code":
cell.outputs = self.sanitize_code_outputs(cell.outputs)
return cell, resources
+ return None
def sanitize_code_outputs(self, outputs):
"""
@@ -140,15 +141,15 @@
for key in data:
if key in self.safe_output_keys:
continue
- elif key in self.sanitized_output_types:
- self.log.info("Sanitizing %s" % key)
+ if key in self.sanitized_output_types:
+ self.log.info("Sanitizing %s", key)
data[key] = self.sanitize_html_tags(data[key])
else:
# Mark key for removal. (Python doesn't allow deletion of
# keys from a dict during iteration)
to_remove.append(key)
for key in to_remove:
- self.log.info("Removing %s" % key)
+ self.log.info("Removing %s", key)
del data[key]
return outputs
@@ -175,3 +176,4 @@
def _get_default_css_sanitizer():
if _USE_BLEACH_CSS_SANITIZER:
return CSSSanitizer(allowed_css_properties=ALLOWED_STYLES)
+ return None
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbconvert-7.12.0/nbconvert/preprocessors/svg2pdf.py new/nbconvert-7.13.1/nbconvert/preprocessors/svg2pdf.py
--- old/nbconvert-7.12.0/nbconvert/preprocessors/svg2pdf.py 2020-02-02 01:00:00.000000000 +0100
+++ new/nbconvert-7.13.1/nbconvert/preprocessors/svg2pdf.py 2020-02-02 01:00:00.000000000 +0100
@@ -145,7 +145,7 @@
# For backwards compatibility with specifying strings
# Okay-ish, since the string is trusted
full_cmd = self.command.format(*template_vars)
- subprocess.call(full_cmd, shell=isinstance(full_cmd, str)) # noqa
+ subprocess.call(full_cmd, shell=isinstance(full_cmd, str)) # noqa: S603
# Read output from drive
# return value expects a filename
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbconvert-7.12.0/nbconvert/utils/_contextlib_chdir.py new/nbconvert-7.13.1/nbconvert/utils/_contextlib_chdir.py
--- old/nbconvert-7.12.0/nbconvert/utils/_contextlib_chdir.py 2020-02-02 01:00:00.000000000 +0100
+++ new/nbconvert-7.13.1/nbconvert/utils/_contextlib_chdir.py 2020-02-02 01:00:00.000000000 +0100
@@ -5,7 +5,7 @@
from contextlib import AbstractContextManager
-class chdir(AbstractContextManager): # type:ignore[type-arg] # noqa
+class chdir(AbstractContextManager): # type:ignore[type-arg]
"""Non thread-safe context manager to change the current working directory."""
def __init__(self, path):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbconvert-7.12.0/nbconvert/utils/exceptions.py new/nbconvert-7.13.1/nbconvert/utils/exceptions.py
--- old/nbconvert-7.12.0/nbconvert/utils/exceptions.py 2020-02-02 01:00:00.000000000 +0100
+++ new/nbconvert-7.13.1/nbconvert/utils/exceptions.py 2020-02-02 01:00:00.000000000 +0100
@@ -12,7 +12,5 @@
# -----------------------------------------------------------------------------
-class ConversionException(Exception): # noqa
+class ConversionException(Exception):
"""An exception raised by the conversion process."""
-
- pass
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbconvert-7.12.0/nbconvert/utils/io.py new/nbconvert-7.13.1/nbconvert/utils/io.py
--- old/nbconvert-7.12.0/nbconvert/utils/io.py 2020-02-02 01:00:00.000000000 +0100
+++ new/nbconvert-7.13.1/nbconvert/utils/io.py 2020-02-02 01:00:00.000000000 +0100
@@ -22,7 +22,7 @@
unicode_std_stream().write(u'ł@e¶ŧ←')
"""
- assert stream in ("stdout", "stderr") # noqa
+ assert stream in ("stdout", "stderr")
stream = getattr(sys, stream)
try:
@@ -104,7 +104,7 @@
# anyway, we get duplicate files - see http://bugs.python.org/issue21876
return
- new_dst = dst + f"-temp-{random.randint(1, 16**4):04X}" # noqa
+ new_dst = dst + f"-temp-{random.randint(1, 16**4):04X}" # noqa: S311
try:
link_or_copy(src, new_dst)
except BaseException:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbconvert-7.12.0/nbconvert/utils/lexers.py new/nbconvert-7.13.1/nbconvert/utils/lexers.py
--- old/nbconvert-7.12.0/nbconvert/utils/lexers.py 2020-02-02 01:00:00.000000000 +0100
+++ new/nbconvert-7.13.1/nbconvert/utils/lexers.py 2020-02-02 01:00:00.000000000 +0100
@@ -3,4 +3,4 @@
warn("nbconvert.utils.lexers is deprecated as of 5.0. Use IPython.lib.lexers", stacklevel=2)
-from IPython.lib.lexers import * # noqa
+from IPython.lib.lexers import * # noqa: F403, E402
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbconvert-7.12.0/nbconvert/utils/pandoc.py new/nbconvert-7.13.1/nbconvert/utils/pandoc.py
--- old/nbconvert-7.12.0/nbconvert/utils/pandoc.py 2020-02-02 01:00:00.000000000 +0100
+++ new/nbconvert-7.13.1/nbconvert/utils/pandoc.py 2020-02-02 01:00:00.000000000 +0100
@@ -51,7 +51,7 @@
check_pandoc_version()
# we can safely continue
- p = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE) # noqa
+ p = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE) # noqa: S603
out, _ = p.communicate(source.encode())
out_str = TextIOWrapper(BytesIO(out), encoding, "replace").read()
return out_str.rstrip("\n")
@@ -69,13 +69,13 @@
PandocMissing
If pandoc is unavailable.
"""
- global __version # noqa
+ global __version # noqa: PLW0603
if __version is None:
if not shutil.which("pandoc"):
raise PandocMissing()
- out = subprocess.check_output(["pandoc", "-v"]) # noqa
+ out = subprocess.check_output(["pandoc", "-v"]) # noqa: S607, S603
out_lines = out.splitlines()
version_pattern = re.compile(r"^\d+(\.\d+){1,}$")
for tok in out_lines[0].decode("ascii", "replace").split():
@@ -144,7 +144,7 @@
# -----------------------------------------------------------------------------
def clean_cache():
"""Clean the internal cache."""
- global __version # noqa
+ global __version # noqa: PLW0603
__version = None
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbconvert-7.12.0/nbconvert/utils/text.py new/nbconvert-7.13.1/nbconvert/utils/text.py
--- old/nbconvert-7.12.0/nbconvert/utils/text.py 2020-02-02 01:00:00.000000000 +0100
+++ new/nbconvert-7.13.1/nbconvert/utils/text.py 2020-02-02 01:00:00.000000000 +0100
@@ -29,11 +29,10 @@
"""
if instr is None:
- return
+ return None
ind = "\t" * ntabs + " " * nspaces
pat = re.compile("^\\s*", re.MULTILINE) if flatten else re.compile("^", re.MULTILINE)
outstr = re.sub(pat, ind, instr)
if outstr.endswith(os.linesep + ind):
return outstr[: -len(ind)]
- else:
- return outstr
+ return outstr
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbconvert-7.12.0/nbconvert/writers/debug.py new/nbconvert-7.13.1/nbconvert/writers/debug.py
--- old/nbconvert-7.12.0/nbconvert/writers/debug.py 2020-02-02 01:00:00.000000000 +0100
+++ new/nbconvert-7.13.1/nbconvert/writers/debug.py 2020-02-02 01:00:00.000000000 +0100
@@ -39,7 +39,7 @@
if isinstance(resources["outputs"], dict):
print("outputs extracted from %s" % notebook_name)
print("-" * 80)
- pprint(resources["outputs"], indent=2, width=70) # noqa
+ pprint(resources["outputs"], indent=2, width=70) # noqa: T203
else:
print("no outputs extracted from %s" % notebook_name)
print("=" * 80)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbconvert-7.12.0/nbconvert/writers/stdout.py new/nbconvert-7.13.1/nbconvert/writers/stdout.py
--- old/nbconvert-7.12.0/nbconvert/writers/stdout.py 2020-02-02 01:00:00.000000000 +0100
+++ new/nbconvert-7.13.1/nbconvert/writers/stdout.py 2020-02-02 01:00:00.000000000 +0100
@@ -20,4 +20,5 @@
See base for more...
"""
- io.unicode_std_stream().write(output)
+ stream = io.unicode_std_stream()
+ stream.write(output)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbconvert-7.12.0/pyproject.toml new/nbconvert-7.13.1/pyproject.toml
--- old/nbconvert-7.12.0/pyproject.toml 2020-02-02 01:00:00.000000000 +0100
+++ new/nbconvert-7.13.1/pyproject.toml 2020-02-02 01:00:00.000000000 +0100
@@ -62,7 +62,7 @@
test = [
"pytest",
"ipykernel",
- "ipywidgets>=7",
+ "ipywidgets>=7.5",
"flaky",
]
serve = ["tornado>=6.1"]
@@ -179,7 +179,6 @@
files = "nbconvert"
python_version = "3.8"
strict = true
-show_error_codes = true
enable_error_code = ["ignore-without-code", "redundant-expr", "truthy-bool"]
disable_error_code = ["no-untyped-def", "no-untyped-call"]
warn_unreachable = true
@@ -192,41 +191,51 @@
exclude = [".*notebook1.ipynb$"]
[tool.ruff.lint]
-select = [
- "A", "B", "C", "DTZ", "E", "EM", "F", "FBT", "I", "ICN", "N",
- "PLC", "PLE", "PLR", "PLW", "Q", "RUF", "S", "SIM", "T", "TID", "UP",
- "W", "YTT",
+extend-select = [
+ "B", # flake8-bugbear
+ "I", # isort
+ "C4", # flake8-comprehensions
+ "EM", # flake8-errmsg
+ "ICN", # flake8-import-conventions
+ "G", # flake8-logging-format
+ "PGH", # pygrep-hooks
+ "PIE", # flake8-pie
+ "PL", # pylint
+ #"PTH", # flake8-use-pathlib
+ "PT", # flake8-pytest-style
+ "RET", # flake8-return
+ "RUF", # Ruff-specific
+ "SIM", # flake8-simplify
+ "T20", # flake8-print
+ "UP", # pyupgrade
+ "YTT", # flake8-2020
+ "EXE", # flake8-executable
+ "PYI", # flake8-pyi
+ "S", # flake8-bandit
]
ignore = [
- # Q000 Single quotes found but double quotes preferred
- "Q000",
- # FBT001 Boolean positional arg in function definition
- "FBT001", "FBT002", "FBT003",
- # E501 Line too long (158 > 100 characters)
- "E501",
- # SIM105 Use `contextlib.suppress(...)`
- "SIM105",
- # T201 `print` found
- "T201",
- # N802 Function name `CreateWellKnownSid` should be lowercase
- "N802", "N803",
- # RUF012 Mutable class attributes should be annotated with `typing.ClassVar`
- "RUF012",
+ "PLR", # Design related pylint codes
+ "S101", # Use of `assert` detected
+ "SIM105", # Use `contextlib.suppress(...)`
+ "T201", # `print` found
+ "RUF012", # Mutable class attributes should be annotated
]
unfixable = [
- # Don't touch print statements
- "T201",
- # Don't touch noqa lines
- "RUF100",
+ "T201", # Don't touch print statements
+ "RUF100", # Don't touch noqa lines
+ "F401", # Unused imports
]
[tool.ruff.lint.per-file-ignores]
- # B011: Do not call assert False since python -O removes these calls
# F841 local variable 'foo' is assigned to but never used
# S101 Use of `assert` detected
# TID252 Relative imports from parent modules are banned
-# PLR2004 Magic value used in comparison
-"tests/*" = ["B011", "F841", "S101", "TID252", "PLR2004"]
+# PT009 Use a regular `assert` instead of unittest-style
+# PGH003 Use specific rule codes when ignoring type issues
+# PT027 Use `pytest.raises` instead of unittest-style
+# PGH004 Use specific rule codes when using `noqa`
+"tests/*" = ["F841", "S101", "TID252", "PT009", "PTH", "PGH003", "PT027",
+ "PGH004"]
"tests/*/*.ipynb" = [
"EM", "B018", "E402", "F405", "SIM", "F403", "F821",
"RUF100", "ICN001", "S605", "S607"
@@ -250,7 +259,7 @@
exclude = ["tests", "docs"]
[tool.repo-review]
-ignore = ["PY007", "GH102"]
+ignore = ["GH102"]
[tool.codespell]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbconvert-7.12.0/tests/base.py new/nbconvert-7.13.1/tests/base.py
--- old/nbconvert-7.12.0/tests/base.py 2020-02-02 01:00:00.000000000 +0100
+++ new/nbconvert-7.13.1/tests/base.py 2020-02-02 01:00:00.000000000 +0100
@@ -22,7 +22,7 @@
"""Base tests class. Contains useful fuzzy comparison and nbconvert
functions."""
- def fuzzy_compare( # noqa
+ def fuzzy_compare(
self,
a,
b,
@@ -184,7 +184,7 @@
raise AssertionError(
"Length doesn't match (%i > %i). Extra text:\n%r" % (len(a), len(b), a[len(b) :])
)
- elif len(a) < len(b):
+ if len(a) < len(b):
raise AssertionError(
"Length doesn't match (%i < %i). Extra text:\n%r" % (len(a), len(b), a[len(b) :])
)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbconvert-7.12.0/tests/exporters/test_templateexporter.py new/nbconvert-7.13.1/tests/exporters/test_templateexporter.py
--- old/nbconvert-7.12.0/tests/exporters/test_templateexporter.py 2020-02-02 01:00:00.000000000 +0100
+++ new/nbconvert-7.13.1/tests/exporters/test_templateexporter.py 2020-02-02 01:00:00.000000000 +0100
@@ -657,5 +657,4 @@
assert "(100,)" not in nb
def _make_exporter(self, config=None):
- exporter = SampleExporter(config=config)
- return exporter
+ return SampleExporter(config=config)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbconvert-7.12.0/tests/exporters/test_webpdf.py new/nbconvert-7.13.1/tests/exporters/test_webpdf.py
--- old/nbconvert-7.12.0/tests/exporters/test_webpdf.py 2020-02-02 01:00:00.000000000 +0100
+++ new/nbconvert-7.13.1/tests/exporters/test_webpdf.py 2020-02-02 01:00:00.000000000 +0100
@@ -33,7 +33,7 @@
exporter_class = WebPDFExporter # type:ignore
- @pytest.mark.network
+ @pytest.mark.network()
def test_export(self):
"""
Can a TemplateExporter export something?
@@ -56,7 +56,7 @@
"""
Generate PDFs if playwright not installed?
"""
- with pytest.raises(RuntimeError):
+ with pytest.raises(RuntimeError): # noqa
base_exporter = Exporter()
exporter = WebPDFExporter()
with open(self._get_notebook(), encoding="utf-8") as f:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbconvert-7.12.0/tests/filters/test_citation.py new/nbconvert-7.13.1/tests/filters/test_citation.py
--- old/nbconvert-7.12.0/tests/filters/test_citation.py 2020-02-02 01:00:00.000000000 +0100
+++ new/nbconvert-7.13.1/tests/filters/test_citation.py 2020-02-02 01:00:00.000000000 +0100
@@ -112,7 +112,7 @@
}
-@pytest.mark.parametrize(["in_arg", "out_arg"], list(test_md.items()))
+@pytest.mark.parametrize(["in_arg", "out_arg"], list(test_md.items())) # noqa
def test_citation2latex(in_arg, out_arg):
"""Are citations parsed properly?"""
assert citation2latex(in_arg) == out_arg
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbconvert-7.12.0/tests/filters/test_markdown.py new/nbconvert-7.13.1/tests/filters/test_markdown.py
--- old/nbconvert-7.12.0/tests/filters/test_markdown.py 2020-02-02 01:00:00.000000000 +0100
+++ new/nbconvert-7.13.1/tests/filters/test_markdown.py 2020-02-02 01:00:00.000000000 +0100
@@ -68,7 +68,7 @@
# sometimes pandoc uses $math$, sometimes it uses \(math\)
expected = re.compile(r"(\$|\\\()\\alpha(\$|\\\)) latex math")
- assertRegex = self.assertRegex # noqa
+ assertRegex = self.assertRegex
assertRegex(convert_pandoc(s, "markdown_strict+tex_math_dollars", "latex"), expected)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbconvert-7.12.0/tests/test_nbconvertapp.py new/nbconvert-7.13.1/tests/test_nbconvertapp.py
--- old/nbconvert-7.12.0/tests/test_nbconvertapp.py 2020-02-02 01:00:00.000000000 +0100
+++ new/nbconvert-7.13.1/tests/test_nbconvertapp.py 2020-02-02 01:00:00.000000000 +0100
@@ -150,7 +150,7 @@
assert os.path.isfile("notebook with spaces.pdf")
@flaky
- @pytest.mark.network
+ @pytest.mark.network()
@pytest.mark.skipif(not PLAYWRIGHT_INSTALLED, reason="Playwright not installed")
def test_webpdf_with_chromium(self):
"""
@@ -419,7 +419,7 @@
assert "42" in output3
# Executing the notebook should raise an exception if --allow-errors is not specified
- with pytest.raises(OSError):
+ with pytest.raises(OSError): # noqa
self.nbconvert("--execute --to markdown --stdout notebook3*.ipynb")
def test_errors_print_traceback(self):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/nbconvert-7.12.0/tests/utils/test_io.py new/nbconvert-7.13.1/tests/utils/test_io.py
--- old/nbconvert-7.12.0/tests/utils/test_io.py 2020-02-02 01:00:00.000000000 +0100
+++ new/nbconvert-7.13.1/tests/utils/test_io.py 2020-02-02 01:00:00.000000000 +0100
@@ -19,7 +19,8 @@
sys.stdout = stdout
try:
sample = "@łe¶ŧ←"
- unicode_std_stream().write(sample)
+ stream = unicode_std_stream()
+ stream.write(sample)
output = stdoutb.getvalue().decode("utf-8")
assert output == sample
participants (1)
-
Source-Sync