Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update typing for traitlets 5.11 #2050

Merged
merged 2 commits into from
Oct 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading