Skip to content

Commit

Permalink
mypy: set disallow_incomplete_defs=true
Browse files Browse the repository at this point in the history
  • Loading branch information
kislyuk committed Jun 16, 2024
1 parent 7816191 commit 8f7cf01
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ test_deps:
lint:
for dir in $$(dirname */__init__.py); do ruff $$dir; done
for script in scripts/*[^cmd]; do if grep -q python $$script; then ruff $$script; fi; done
mypy --install-types --non-interactive --check-untyped-defs argcomplete
mypy --install-types --non-interactive argcomplete

test:
coverage run --source=argcomplete --omit=argcomplete/packages/_shlex.py ./test/test.py -v
Expand Down
2 changes: 1 addition & 1 deletion argcomplete/completers.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class BaseCompleter:

def __call__(
self, *, prefix: str, action: argparse.Action, parser: argparse.ArgumentParser, parsed_args: argparse.Namespace
):
) -> None:
raise NotImplementedError("This method should be implemented by a subclass.")


Expand Down
12 changes: 7 additions & 5 deletions argcomplete/finders.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
import os
import sys
from collections.abc import Mapping
from typing import Callable, Dict, List, Optional, Sequence, Union
from typing import Callable, Dict, List, Optional, Sequence, Union, TextIO

from . import io as _io
from .completers import ChoicesCompleter, FilesCompleter, SuppressCompleter
from .completers import BaseCompleter, ChoicesCompleter, FilesCompleter, SuppressCompleter
from .io import debug, mute_stderr
from .lexers import split_line
from .packages._argparse import IntrospectiveArgumentParser, action_is_greedy, action_is_open, action_is_satisfied
Expand Down Expand Up @@ -66,13 +66,13 @@ def __call__(
argument_parser: argparse.ArgumentParser,
always_complete_options: Union[bool, str] = True,
exit_method: Callable = os._exit,
output_stream=None,
output_stream: Optional[TextIO] = None,
exclude: Optional[Sequence[str]] = None,
validator: Optional[Callable] = None,
print_suppressed: bool = False,
append_space: Optional[bool] = None,
default_completer=FilesCompleter(),
):
default_completer: BaseCompleter = FilesCompleter(),
) -> None:
"""
:param argument_parser: The argument parser to autocomplete on
:param always_complete_options:
Expand Down Expand Up @@ -132,6 +132,8 @@ def __call__(
debug("Unable to open fd 8 for writing, quitting")
exit_method(1)

assert output_stream is not None

ifs = os.environ.get("_ARGCOMPLETE_IFS", "\013")
if len(ifs) != 1:
debug("Invalid value for IFS, quitting [{v}]".format(v=ifs))
Expand Down
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ quote-style = "preserve"
files = [
"argcomplete"
]
check_untyped_defs = true
disallow_incomplete_defs = true

[[tool.mypy.overrides]]
module = "importlib.*"
Expand Down

0 comments on commit 8f7cf01

Please sign in to comment.