Skip to content

Commit

Permalink
Update typings for traitlets 5.11 (#366)
Browse files Browse the repository at this point in the history
  • Loading branch information
blink1073 committed Oct 3, 2023
1 parent 269bb70 commit 8284fc3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
10 changes: 4 additions & 6 deletions jupyter_core/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
base_aliases: dict[str, t.Any] = {}
if isinstance(Application.aliases, dict):
# traitlets 5
base_aliases.update(Application.aliases) # type:ignore[arg-type]
base_aliases.update(Application.aliases)
_jupyter_aliases = {
"log-level": "Application.log_level",
"config": "JupyterApp.config_file",
Expand All @@ -47,7 +47,7 @@
base_flags: dict[str, t.Any] = {}
if isinstance(Application.flags, dict):
# traitlets 5
base_flags.update(Application.flags) # type:ignore[arg-type]
base_flags.update(Application.flags)
_jupyter_flags: dict[str, t.Any] = {
"debug": (
{"Application": {"log_level": logging.DEBUG}},
Expand All @@ -72,8 +72,8 @@ class JupyterApp(Application):
name = "jupyter" # override in subclasses
description = "A Jupyter Application"

aliases = base_aliases # type:ignore[assignment]
flags = base_flags # type:ignore[assignment]
aliases = base_aliases
flags = base_flags

def _log_level_default(self) -> int:
return logging.INFO
Expand Down Expand Up @@ -156,8 +156,6 @@ def ask() -> str:
return

config_text = self.generate_config_file()
if isinstance(config_text, bytes):
config_text = config_text.decode("utf8")
print("Writing default config to: %s" % config_file)
ensure_dir_exists(os.path.abspath(os.path.dirname(config_file)), 0o700)
with open(config_file, mode="w", encoding="utf-8") as f:
Expand Down
2 changes: 1 addition & 1 deletion jupyter_core/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ def _evaluate_argcomplete(parser: JupyterParser) -> list[str]:
if cwords and len(cwords) > 1 and not cwords[1].startswith("-"):
# If first completion word looks like a subcommand,
# increment word from which to start handling arguments
increment_argcomplete_index() # type:ignore[no-untyped-call]
increment_argcomplete_index()
return cwords
else:
# Otherwise no subcommand, directly autocomplete and exit
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ nowarn = "test -W default {args}"

[tool.hatch.envs.typing]
features = ["test"]
dependencies = ["mypy>=1.5.1", "traitlets>=5.10.1"]
dependencies = ["mypy>=1.5.1", "traitlets>=5.11.2"]
[tool.hatch.envs.typing.scripts]
test = "mypy --install-types --non-interactive {args}"

Expand Down

0 comments on commit 8284fc3

Please sign in to comment.