From aeb19cde6ed4e8a95a6d59352b463108d08b407d Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Sun, 1 Oct 2023 13:05:33 -0500 Subject: [PATCH 1/2] fixup typings --- nbconvert/nbconvertapp.py | 8 ++++---- nbconvert/preprocessors/sanitize.py | 2 +- pyproject.toml | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/nbconvert/nbconvertapp.py b/nbconvert/nbconvertapp.py index 40600300e..0c082bdd2 100755 --- a/nbconvert/nbconvertapp.py +++ b/nbconvert/nbconvertapp.py @@ -189,8 +189,8 @@ class NbConvertApp(JupyterApp): version = __version__ name = "jupyter-nbconvert" - aliases = nbconvert_aliases - flags = nbconvert_flags + aliases = nbconvert_aliases # type:ignore[assignment] + flags = nbconvert_flags # type:ignore[assignment] @default("log_level") def _log_level_default(self): @@ -597,7 +597,7 @@ def document_flag_help(self): Return a string containing descriptions of all the flags. """ flags = "The following flags are defined:\n\n" - for flag, (cfg, fhelp) in self.flags.items(): + for flag, (cfg, fhelp) in self.flags.items(): # type:ignore[has-type] flags += f"{flag}\n" flags += indent(fill(fhelp, 80)) + "\n\n" flags += indent(fill("Long Form: " + str(cfg), 80)) + "\n\n" @@ -607,7 +607,7 @@ def document_alias_help(self): """Return a string containing all of the aliases""" aliases = "The following aliases are defined:\n\n" - for alias, longname in self.aliases.items(): + for alias, longname in self.aliases.items(): # type:ignore[has-type] aliases += f"\t**{alias}** ({longname})\n\n" return aliases diff --git a/nbconvert/preprocessors/sanitize.py b/nbconvert/preprocessors/sanitize.py index db7b235c0..a9e9f20c1 100644 --- a/nbconvert/preprocessors/sanitize.py +++ b/nbconvert/preprocessors/sanitize.py @@ -49,7 +49,7 @@ class SanitizeHTML(Preprocessor): """A preprocessor to sanitize html.""" # Bleach config. - attributes = Any( # type:ignore[call-overload] + attributes = Any( config=True, default_value=ALLOWED_ATTRIBUTES, help="Allowed HTML tag attributes", diff --git a/pyproject.toml b/pyproject.toml index 770f88f75..6834c03c5 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.10"] +dependencies = ["mypy>=1.5.1", "traitlets>=5.10.1", "jupyter_core>=5.3.2"] [tool.hatch.envs.typing.scripts] test = "mypy --install-types --non-interactive {args}" From a89b9b695082b62783a5a615d55df2415a35e06c Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Sun, 1 Oct 2023 13:15:36 -0500 Subject: [PATCH 2/2] mark test as flaky --- tests/exporters/test_qtpng.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/exporters/test_qtpng.py b/tests/exporters/test_qtpng.py index 6e46a25ba..89e66920e 100644 --- a/tests/exporters/test_qtpng.py +++ b/tests/exporters/test_qtpng.py @@ -6,6 +6,7 @@ import os import pytest +from flaky import flaky from nbconvert.exporters.qt_screenshot import QT_INSTALLED from nbconvert.exporters.qtpng import QtPNGExporter @@ -19,6 +20,7 @@ class TestQtPNGExporter(ExportersTestsBase): exporter_class = QtPNGExporter # type:ignore + @flaky def test_export(self): """ Can a TemplateExporter export something?