From 7d21876435cef9104bce0ab7d039e872613c8587 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 9 Aug 2026 09:15:18 +0000 Subject: [PATCH] Drop type:ignore comments made unused by argcomplete 3.7 argcomplete 3.7 ships inline annotations for split_line(), debug() and CompletionFinder.__call__, so the no-untyped-call ignores around those calls are now reported as unused-ignore and the lint job fails. Remove the stale codes and floor the mypy hook's argcomplete at 3.7 so the check behaves the same locally and in CI. --- .pre-commit-config.yaml | 2 +- traitlets/config/argcomplete_config.py | 6 +++--- traitlets/config/loader.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 21d674a18..da0fd1310 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -59,7 +59,7 @@ repos: files: "^traitlets" stages: [manual] args: ["--install-types", "--non-interactive"] - additional_dependencies: ["argcomplete>=3.1"] + additional_dependencies: ["argcomplete>=3.7"] - repo: https://github.com/pre-commit/pygrep-hooks rev: "v1.10.0" diff --git a/traitlets/config/argcomplete_config.py b/traitlets/config/argcomplete_config.py index 1a411cec5..7444a765f 100644 --- a/traitlets/config/argcomplete_config.py +++ b/traitlets/config/argcomplete_config.py @@ -45,7 +45,7 @@ def get_argcomplete_cwords() -> list[str] | None: _cword_suffix, comp_words, _last_wordbreak_pos, - ) = argcomplete.split_line(comp_line, comp_point) # type:ignore[attr-defined,no-untyped-call] + ) = argcomplete.split_line(comp_line, comp_point) # type:ignore[attr-defined] except ModuleNotFoundError: return None @@ -73,7 +73,7 @@ def increment_argcomplete_index() -> None: os.environ["_ARGCOMPLETE"] = str(int(os.environ["_ARGCOMPLETE"]) + 1) except Exception: try: - argcomplete.debug("Unable to increment $_ARGCOMPLETE", os.environ["_ARGCOMPLETE"]) # type:ignore[attr-defined,no-untyped-call] + argcomplete.debug("Unable to increment $_ARGCOMPLETE", os.environ["_ARGCOMPLETE"]) # type:ignore[attr-defined] except (KeyError, ModuleNotFoundError): pass @@ -194,7 +194,7 @@ def _get_completions(self, comp_words: list[str], cword_prefix: str, *args: t.An # Instead, check if comp_words only consists of the script, # if so check if any subcommands start with cword_prefix. if self.subcommands and len(comp_words) == 1: - argcomplete.debug("Adding subcommands for", cword_prefix) # type:ignore[attr-defined,no-untyped-call] + argcomplete.debug("Adding subcommands for", cword_prefix) # type:ignore[attr-defined] completions.extend(subc for subc in self.subcommands if subc.startswith(cword_prefix)) return completions diff --git a/traitlets/config/loader.py b/traitlets/config/loader.py index 876f1186c..379cd479b 100644 --- a/traitlets/config/loader.py +++ b/traitlets/config/loader.py @@ -1133,7 +1133,7 @@ def _argcomplete(self, classes: list[t.Any], subcommands: SubcommandsDict | None from . import argcomplete_config - finder = argcomplete_config.ExtendedCompletionFinder() # type:ignore[no-untyped-call] + finder = argcomplete_config.ExtendedCompletionFinder() finder.config_classes = classes finder.subcommands = list(subcommands or []) # for ease of testing, pass through self._argcomplete_kwargs if set