From eed8bb90cb9d8a81994c3eda473c43d3d2251362 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Sat, 14 Oct 2023 19:51:41 -0500 Subject: [PATCH 1/4] update typings and remove dead link --- README.md | 1 - nbconvert/exporters/base.py | 2 +- nbconvert/exporters/qt_screenshot.py | 13 +++++++++---- nbconvert/exporters/script.py | 2 +- nbconvert/exporters/webpdf.py | 2 +- nbconvert/filters/filter_links.py | 2 +- nbconvert/filters/pandoc.py | 2 +- nbconvert/filters/strings.py | 2 +- nbconvert/preprocessors/csshtmlheader.py | 4 ++-- pyproject.toml | 2 +- 10 files changed, 18 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 02ef9843a..a80316202 100644 --- a/README.md +++ b/README.md @@ -71,7 +71,6 @@ py.test --pyargs nbconvert ## Documentation - [Documentation for Jupyter nbconvert](https://nbconvert.readthedocs.io/en/latest/) - \[[PDF](https://media.readthedocs.org/pdf/nbconvert/latest/nbconvert.pdf)\] - [nbconvert examples on GitHub](https://github.com/jupyter/nbconvert-examples) - [Documentation for Project Jupyter](https://jupyter.readthedocs.io/en/latest/index.html) \[[PDF](https://media.readthedocs.org/pdf/jupyter/latest/jupyter.pdf)\] diff --git a/nbconvert/exporters/base.py b/nbconvert/exporters/base.py index 62fc444be..bc19573bc 100644 --- a/nbconvert/exporters/base.py +++ b/nbconvert/exporters/base.py @@ -7,7 +7,7 @@ import sys if sys.version_info < (3, 10): - from importlib_metadata import entry_points # type:ignore[import] + from importlib_metadata import entry_points # type:ignore[import-not-found] else: from importlib.metadata import entry_points from nbformat import NotebookNode diff --git a/nbconvert/exporters/qt_screenshot.py b/nbconvert/exporters/qt_screenshot.py index 739d97994..3263f10b7 100644 --- a/nbconvert/exporters/qt_screenshot.py +++ b/nbconvert/exporters/qt_screenshot.py @@ -2,10 +2,15 @@ import os try: - from PyQt5 import QtCore # type:ignore[import] - from PyQt5.QtGui import QPageLayout, QPageSize # type:ignore[import] - from PyQt5.QtWebEngineWidgets import QWebEngineSettings, QWebEngineView # type:ignore[import] - from PyQt5.QtWidgets import QApplication # type:ignore[import] + from PyQt5 import QtCore # type:ignore[import-not-found] + from PyQt5.QtGui import QPageLayout, QPageSize # type:ignore[import-not-found] + from PyQt5.QtWebEngineWidgets import ( + QWebEngineSettings, + QWebEngineView, + ) + + # type:ignore[import-not-found] + from PyQt5.QtWidgets import QApplication # type:ignore[import-not-found] QT_INSTALLED = True except ModuleNotFoundError: diff --git a/nbconvert/exporters/script.py b/nbconvert/exporters/script.py index c10d7a204..3edb502ab 100644 --- a/nbconvert/exporters/script.py +++ b/nbconvert/exporters/script.py @@ -5,7 +5,7 @@ import sys if sys.version_info < (3, 10): - from importlib_metadata import entry_points # type:ignore[import] + from importlib_metadata import entry_points # type:ignore[import-not-found] else: from importlib.metadata import entry_points from traitlets import Dict, default diff --git a/nbconvert/exporters/webpdf.py b/nbconvert/exporters/webpdf.py index 4f1343368..4fa5dcdc4 100644 --- a/nbconvert/exporters/webpdf.py +++ b/nbconvert/exporters/webpdf.py @@ -75,7 +75,7 @@ async def main(temp_file): """Run main playwright script.""" args = ["--no-sandbox"] if self.disable_sandbox else [] try: - from playwright.async_api import async_playwright # type: ignore[import] + from playwright.async_api import async_playwright # type: ignore[import-not-found] except ModuleNotFoundError as e: msg = ( "Playwright is not installed to support Web PDF conversion. " diff --git a/nbconvert/filters/filter_links.py b/nbconvert/filters/filter_links.py index 1c655fc72..f67698713 100644 --- a/nbconvert/filters/filter_links.py +++ b/nbconvert/filters/filter_links.py @@ -4,7 +4,7 @@ """ import re -from pandocfilters import RawInline, applyJSONFilters, stringify # type:ignore[import] +from pandocfilters import RawInline, applyJSONFilters, stringify # type:ignore[import-untyped] def resolve_references(source): diff --git a/nbconvert/filters/pandoc.py b/nbconvert/filters/pandoc.py index ec84888fd..eb72ca2c0 100644 --- a/nbconvert/filters/pandoc.py +++ b/nbconvert/filters/pandoc.py @@ -4,7 +4,7 @@ """ import os -from pandocfilters import Image, applyJSONFilters # type:ignore[import] +from pandocfilters import Image, applyJSONFilters # type:ignore[import-untyped] from nbconvert.utils.base import NbConvertBase from nbconvert.utils.pandoc import pandoc diff --git a/nbconvert/filters/strings.py b/nbconvert/filters/strings.py index c4165c1d0..ae2c717de 100644 --- a/nbconvert/filters/strings.py +++ b/nbconvert/filters/strings.py @@ -18,7 +18,7 @@ import bleach # defusedxml does safe(r) parsing of untrusted XML data -from defusedxml import ElementTree # type:ignore[import] +from defusedxml import ElementTree # type:ignore[import-untyped] from nbconvert.preprocessors.sanitize import _get_default_css_sanitizer diff --git a/nbconvert/preprocessors/csshtmlheader.py b/nbconvert/preprocessors/csshtmlheader.py index 81bfa917c..90703e6ac 100644 --- a/nbconvert/preprocessors/csshtmlheader.py +++ b/nbconvert/preprocessors/csshtmlheader.py @@ -7,14 +7,14 @@ import hashlib import os -from jupyterlab_pygments import JupyterStyle # type:ignore[import] +from jupyterlab_pygments import JupyterStyle # type:ignore[import-untyped] from pygments.style import Style from traitlets import Type, Unicode, Union from .base import Preprocessor try: - from notebook import DEFAULT_STATIC_FILES_PATH # type:ignore[import] + from notebook import DEFAULT_STATIC_FILES_PATH # type:ignore[import-not-found] except ImportError: DEFAULT_STATIC_FILES_PATH = None diff --git a/pyproject.toml b/pyproject.toml index 771cc1e79..724dda138 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -114,7 +114,7 @@ nowarn = "test -W default {args}" [tool.hatch.envs.typing] features = ["test"] -dependencies = ["mypy>=1.5.1", "traitlets>=5.11.2", "jupyter_core>=5.3.2"] +dependencies = ["mypy~=1.6", "traitlets>=5.11.2", "jupyter_core>=5.3.2"] [tool.hatch.envs.typing.scripts] test = "mypy --install-types --non-interactive {args}" From 55679e680fdd6199168c2d5eaed8c8f2509814fb Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Sat, 14 Oct 2023 19:55:12 -0500 Subject: [PATCH 2/4] fixup --- nbconvert/exporters/qt_screenshot.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/nbconvert/exporters/qt_screenshot.py b/nbconvert/exporters/qt_screenshot.py index 3263f10b7..14e73b054 100644 --- a/nbconvert/exporters/qt_screenshot.py +++ b/nbconvert/exporters/qt_screenshot.py @@ -4,12 +4,10 @@ try: from PyQt5 import QtCore # type:ignore[import-not-found] from PyQt5.QtGui import QPageLayout, QPageSize # type:ignore[import-not-found] - from PyQt5.QtWebEngineWidgets import ( + from PyQt5.QtWebEngineWidgets import ( # type:ignore[import-not-found] QWebEngineSettings, QWebEngineView, ) - - # type:ignore[import-not-found] from PyQt5.QtWidgets import QApplication # type:ignore[import-not-found] QT_INSTALLED = True From dfc832d598e71eda25c089d4175c0c419417c96e Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Sun, 15 Oct 2023 08:23:22 -0500 Subject: [PATCH 3/4] remove dead link --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index a80316202..5f2287c47 100644 --- a/README.md +++ b/README.md @@ -73,7 +73,6 @@ py.test --pyargs nbconvert - [Documentation for Jupyter nbconvert](https://nbconvert.readthedocs.io/en/latest/) - [nbconvert examples on GitHub](https://github.com/jupyter/nbconvert-examples) - [Documentation for Project Jupyter](https://jupyter.readthedocs.io/en/latest/index.html) - \[[PDF](https://media.readthedocs.org/pdf/jupyter/latest/jupyter.pdf)\] ## Technical Support From cd15dcbead987af474e6292044361f7429c875e7 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sun, 15 Oct 2023 13:24:55 +0000 Subject: [PATCH 4/4] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e724af2d6..8201e930b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1331,6 +1331,7 @@ raw template {%- endblock in_prompt -%} """ + exporter_attr = AttrExporter() output_attr, _ = exporter_attr.from_notebook_node(nb) assert "raw template" in output_attr