From 5af080a3f6be787ad794db25720410c7fddd1b05 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Tue, 3 Oct 2023 19:37:35 -0500 Subject: [PATCH 1/2] Update typing for traitlets 5.11 --- nbconvert/nbconvertapp.py | 17 +++++++++-------- pyproject.toml | 2 +- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/nbconvert/nbconvertapp.py b/nbconvert/nbconvertapp.py index 0c082bdd2..dc712c101 100755 --- a/nbconvert/nbconvertapp.py +++ b/nbconvert/nbconvertapp.py @@ -189,8 +189,8 @@ class NbConvertApp(JupyterApp): version = __version__ name = "jupyter-nbconvert" - aliases = nbconvert_aliases # type:ignore[assignment] - flags = nbconvert_flags # type:ignore[assignment] + aliases = nbconvert_aliases + flags = nbconvert_flags @default("log_level") def _log_level_default(self): @@ -395,15 +395,16 @@ def init_notebooks(self): def init_writer(self): """Initialize the writer (which is stateless)""" self._writer_class_changed({"new": self.writer_class}) - self.writer = self.writer_factory(parent=self) # type:ignore[operator] - if hasattr(self.writer, "build_directory") and self.writer.build_directory != "": - self.use_output_suffix = False + if self.writer_factory: + self.writer = self.writer_factory(parent=self) + if hasattr(self.writer, "build_directory") and self.writer.build_directory != "": + self.use_output_suffix = False def init_postprocessor(self): """Initialize the postprocessor (which is stateless)""" self._postprocessor_class_changed({"new": self.postprocessor_class}) if self.postprocessor_factory: - self.postprocessor = self.postprocessor_factory(parent=self) # type:ignore[operator] + self.postprocessor = self.postprocessor_factory(parent=self) def start(self): """Run start after initialization process has completed""" @@ -597,7 +598,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(): # type:ignore[has-type] + for flag, (cfg, fhelp) in self.flags.items(): flags += f"{flag}\n" flags += indent(fill(fhelp, 80)) + "\n\n" flags += indent(fill("Long Form: " + str(cfg), 80)) + "\n\n" @@ -607,7 +608,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(): # type:ignore[has-type] + for alias, longname in self.aliases.items(): aliases += f"\t**{alias}** ({longname})\n\n" return aliases diff --git a/pyproject.toml b/pyproject.toml index 6834c03c5..8eac35deb 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.1", "jupyter_core>=5.3.2"] +dependencies = ["mypy>=1.5.1", "traitlets>=5.11.2", "jupyter_core>=5.3.2"] [tool.hatch.envs.typing.scripts] test = "mypy --install-types --non-interactive {args}" From 8faa7780ac77a3444dee06bafb78dabbaac03f54 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 4 Oct 2023 00:38:00 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- tests/filters/test_citation.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/filters/test_citation.py b/tests/filters/test_citation.py index 515bf7792..a07535161 100644 --- a/tests/filters/test_citation.py +++ b/tests/filters/test_citation.py @@ -112,9 +112,7 @@ } -@pytest.mark.parametrize( - ["in_arg", "out_arg"], list(test_md.items()) -) +@pytest.mark.parametrize(["in_arg", "out_arg"], list(test_md.items())) def test_citation2latex(in_arg, out_arg): """Are citations parsed properly?""" assert citation2latex(in_arg) == out_arg