Skip to content

Commit

Permalink
Update typing for traitlets 5.11 (#2050)
Browse files Browse the repository at this point in the history
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
blink1073 and pre-commit-ci[bot] authored Oct 4, 2023
1 parent c0b0e2c commit a2bc991
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
17 changes: 9 additions & 8 deletions nbconvert/nbconvertapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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"""
Expand Down Expand Up @@ -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"
Expand All @@ -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

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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}"

Expand Down
4 changes: 1 addition & 3 deletions tests/filters/test_citation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit a2bc991

Please sign in to comment.