Skip to content

Commit

Permalink
Merge a1cedde into fbbc9e8
Browse files Browse the repository at this point in the history
  • Loading branch information
dependabot[bot] committed Nov 14, 2022
2 parents fbbc9e8 + a1cedde commit 8c0a178
Show file tree
Hide file tree
Showing 17 changed files with 19 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ repos:
files: ^(doc/(.*/)*.*\.rst)
additional_dependencies: [Sphinx==5.0.1]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.982
rev: v0.990
hooks:
- id: mypy
name: mypy
Expand Down
2 changes: 1 addition & 1 deletion pylint/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def run_epylint(argv: Sequence[str] | None = None) -> NoReturn:
EpylintRun(argv)


def run_pyreverse(argv: Sequence[str] | None = None) -> NoReturn: # type: ignore[misc]
def run_pyreverse(argv: Sequence[str] | None = None) -> NoReturn:
"""Run pyreverse.
argv can be a sequence of strings normally supplied as arguments on the command line
Expand Down
2 changes: 1 addition & 1 deletion pylint/checkers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def table_lines_from_stats(
)
new_str = f"{new_value:.3f}" if isinstance(new_value, float) else str(new_value)
old_str = f"{old_value:.3f}" if isinstance(old_value, float) else str(old_value)
lines.extend((value[0].replace("_", " "), new_str, old_str, diff_str))
lines.extend((value[0].replace("_", " "), new_str, old_str, diff_str)) # type: ignore[arg-type]
return lines


Expand Down
2 changes: 1 addition & 1 deletion pylint/checkers/similar.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ def append_stream(
self.namespace.ignore_docstrings,
self.namespace.ignore_imports,
self.namespace.ignore_signatures,
line_enabled_callback=self.linter._is_one_message_enabled # type: ignore[attr-defined]
line_enabled_callback=self.linter._is_one_message_enabled
if hasattr(self, "linter")
else None,
)
Expand Down
2 changes: 1 addition & 1 deletion pylint/checkers/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ def is_builtin_object(node: nodes.NodeNG) -> bool:

def is_builtin(name: str) -> bool:
"""Return true if <name> could be considered as a builtin defined by python."""
return name in builtins or name in SPECIAL_BUILTINS # type: ignore[attr-defined]
return name in builtins or name in SPECIAL_BUILTINS # type: ignore[operator]


def is_defined_in_scope(
Expand Down
4 changes: 2 additions & 2 deletions pylint/config/argument.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,9 +365,9 @@ def __init__(
) -> None:
# The extend action is included in the stdlib from 3.8+
if PY38_PLUS:
action_class = argparse._ExtendAction # type: ignore[attr-defined]
action_class = argparse._ExtendAction
else:
action_class = _ExtendAction
action_class = _ExtendAction # type: ignore[assignment]

self.dest = dest
"""The destination of the argument."""
Expand Down
2 changes: 1 addition & 1 deletion pylint/config/option.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ def __init__(self, *opts: Any, **attrs: Any) -> None:
stacklevel=2,
)
super().__init__(*opts, **attrs)
if hasattr(self, "hide") and self.hide: # type: ignore[attr-defined]
if hasattr(self, "hide") and self.hide:
self.help = optparse.SUPPRESS_HELP

def _check_choice(self) -> None:
Expand Down
2 changes: 1 addition & 1 deletion pylint/lint/pylinter.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ def load_plugin_configuration(self) -> None:
"bad-plugin-value", args=(modname, module_or_error), line=0
)
elif hasattr(module_or_error, "load_configuration"):
module_or_error.load_configuration(self) # type: ignore[union-attr]
module_or_error.load_configuration(self)

# We re-set all the dictionary values to True here to make sure the dict
# is pickle-able. This is only a problem in multiprocessing/parallel mode.
Expand Down
3 changes: 1 addition & 2 deletions pylint/pyreverse/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,7 @@ class Run(_ArgumentsManager, _ArgumentsProvider):
options = OPTIONS
name = "pyreverse"

# For mypy issue, see https://github.com/python/mypy/issues/10342
def __init__(self, args: Sequence[str]) -> NoReturn: # type: ignore[misc]
def __init__(self, args: Sequence[str]) -> NoReturn:
_ArgumentsManager.__init__(self, prog="pyreverse", description=__doc__)
_ArgumentsProvider.__init__(self, self)

Expand Down
2 changes: 1 addition & 1 deletion pylint/testutils/_primer/primer_run_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def _lint_package(
try:
Run(arguments, reporter=reporter)
except SystemExit as e:
pylint_exit_code = int(e.code)
pylint_exit_code = int(e.code) # type: ignore[arg-type]
readable_messages: str = output.getvalue()
messages: list[OldJsonExport] = json.loads(readable_messages)
fatal_msgs: list[Message] = []
Expand Down
3 changes: 1 addition & 2 deletions pylint/typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,7 @@ class ExtraMessageOptions(TypedDict, total=False):
Tuple[str, str, str],
Tuple[str, str, str, ExtraMessageOptions],
]
# Mypy doesn't support recursive types (yet), see https://github.com/python/mypy/issues/731
DirectoryNamespaceDict = Dict[Path, Tuple[argparse.Namespace, "DirectoryNamespaceDict"]] # type: ignore[misc]
DirectoryNamespaceDict = Dict[Path, Tuple[argparse.Namespace, "DirectoryNamespaceDict"]]


class GetProjectCallable(Protocol):
Expand Down
2 changes: 1 addition & 1 deletion pylint/utils/ast_walker.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def __init__(self, linter: PyLinter) -> None:
def _is_method_enabled(self, method: AstCallback) -> bool:
if not hasattr(method, "checks_msgs"):
return True
return any(self.linter.is_message_enabled(m) for m in method.checks_msgs) # type: ignore[attr-defined]
return any(self.linter.is_message_enabled(m) for m in method.checks_msgs)

def add_checker(self, checker: BaseChecker) -> None:
"""Walk to the checker's dir and collect visit and leave methods."""
Expand Down
2 changes: 1 addition & 1 deletion requirements_test_pre_commit.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ flake8==5.0.4
flake8-bugbear==22.10.27
flake8-typing-imports==1.14.0
isort==5.10.1
mypy==0.982
mypy==0.990
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def tests_directory() -> Path:
@pytest.fixture
def linter(
checker: type[BaseChecker] | None,
register: Callable[[PyLinter], None],
register: Callable[[PyLinter], None] | None,
enable: str | None,
disable: str | None,
reporter: type[BaseReporter],
Expand Down
2 changes: 1 addition & 1 deletion tests/primer/test_primer_stdlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,4 @@ def test_primer_stdlib_no_crash(
assert not out
msg = f"Encountered {{}} during primer stlib test for {test_module_name}"
assert ex.code != 32, msg.format("a crash")
assert ex.code % 2 == 0, msg.format("a message of category 'fatal'")
assert ex.code % 2 == 0, msg.format("a message of category 'fatal'") # type: ignore[operator]
4 changes: 2 additions & 2 deletions tests/pyreverse/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ def test_graphviz_unsupported_image_format(capsys: CaptureFixture) -> None:
@mock.patch("pylint.pyreverse.main.sys.exit", new=mock.MagicMock())
def test_command_line_arguments_defaults(arg: str, expected_default: Any) -> None:
"""Test that the default arguments of all options are correct."""
run = main.Run([TEST_DATA_DIR])
run = main.Run([TEST_DATA_DIR]) # type: ignore[var-annotated]
assert getattr(run.config, arg) == expected_default


Expand All @@ -178,7 +178,7 @@ def test_class_command(
Make sure that we append multiple --class arguments to one option destination.
"""
runner = main.Run(
runner = main.Run( # type: ignore[var-annotated]
[
"--class",
"data.clientmodule_test.Ancestor",
Expand Down
2 changes: 1 addition & 1 deletion tests/test_self.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def _display(self, layout: Section) -> None:
def out(self) -> TextIO: # type: ignore[override]
return self._reporters[0].out

@property # type: ignore[override]
@property
def linter(self) -> PyLinter:
return self._linter

Expand Down

0 comments on commit 8c0a178

Please sign in to comment.