Skip to content

Commit 2e0c41f

Browse files
[pre-commit.ci] pre-commit autoupdate, mypy fixes for v1.12.1 (#10039)
updates: - [github.com/astral-sh/ruff-pre-commit: v0.6.9 → v0.7.0](astral-sh/ruff-pre-commit@v0.6.9...v0.7.0) - [github.com/pre-commit/mirrors-mypy: v1.11.2 → v1.12.1](pre-commit/mirrors-mypy@v1.11.2...v1.12.1) * [mypy] Fix useless noqa for 'incorrect typing in typeshed' * [mypy] Clearer flow for mypy and human alike * [mypy] Broker().list_dicts() is now typed in enchant Co-authored-by: Pierre Sassoulas <[email protected]>
1 parent 5feface commit 2e0c41f

File tree

4 files changed

+13
-12
lines changed

4 files changed

+13
-12
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ repos:
2020
doc/data/messages/m/missing-final-newline/bad/crlf.py
2121
)$
2222
- repo: https://github.com/astral-sh/ruff-pre-commit
23-
rev: "v0.6.9"
23+
rev: "v0.7.0"
2424
hooks:
2525
- id: ruff
2626
args: ["--fix"]
@@ -125,7 +125,7 @@ repos:
125125
files: ^(doc/(.*/)*.*\.rst)
126126
additional_dependencies: [Sphinx==7.4.3]
127127
- repo: https://github.com/pre-commit/mirrors-mypy
128-
rev: v1.11.2
128+
rev: v1.12.1
129129
hooks:
130130
- id: mypy
131131
name: mypy

pylint/checkers/deprecated.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,12 @@ def visit_decorators(self, node: nodes.Decorators) -> None:
133133
if not children:
134134
return
135135
if isinstance(children[0], nodes.Call):
136-
inf = safe_infer(children[0].func)
136+
inferred = safe_infer(children[0].func)
137137
else:
138-
inf = safe_infer(children[0])
139-
qname = inf.qname() if inf else None
138+
inferred = safe_infer(children[0])
139+
if not inferred:
140+
return
141+
qname = inferred.qname()
140142
if qname in self.deprecated_decorators():
141143
self.add_message("deprecated-decorator", node=node, args=qname)
142144

pylint/checkers/spelling.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,7 @@ def get_tokenizer(
6060

6161

6262
def _get_enchant_dicts() -> list[tuple[Any, enchant.ProviderDesc]]:
63-
# Broker().list_dicts() is not typed in enchant, but it does return tuples
64-
return enchant.Broker().list_dicts() if PYENCHANT_AVAILABLE else [] # type: ignore[no-any-return]
63+
return enchant.Broker().list_dicts() if PYENCHANT_AVAILABLE else []
6564

6665

6766
def _get_enchant_dict_choices(

pylint/config/arguments_manager.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ def _add_parser_option(
133133
*argument.flags,
134134
action=argument.action,
135135
default=argument.default,
136-
type=argument.type, # type: ignore[arg-type] # incorrect typing in typeshed
136+
type=argument.type,
137137
help=argument.help,
138138
metavar=argument.metavar,
139139
choices=argument.choices,
@@ -144,7 +144,7 @@ def _add_parser_option(
144144
**argument.kwargs,
145145
action=argument.action,
146146
default=argument.default,
147-
type=argument.type, # type: ignore[arg-type] # incorrect typing in typeshed
147+
type=argument.type,
148148
help=argument.help,
149149
metavar=argument.metavar,
150150
choices=argument.choices,
@@ -157,7 +157,7 @@ def _add_parser_option(
157157
f"--{old_name}",
158158
action="store",
159159
default=argument.default,
160-
type=argument.type, # type: ignore[arg-type] # incorrect typing in typeshed
160+
type=argument.type,
161161
help=argparse.SUPPRESS,
162162
metavar=argument.metavar,
163163
choices=argument.choices,
@@ -168,7 +168,7 @@ def _add_parser_option(
168168
**argument.kwargs,
169169
action=argument.action,
170170
default=argument.default,
171-
type=argument.type, # type: ignore[arg-type] # incorrect typing in typeshed
171+
type=argument.type,
172172
help=argument.help,
173173
metavar=argument.metavar,
174174
choices=argument.choices,
@@ -193,7 +193,7 @@ def _add_parser_option(
193193
*argument.flags,
194194
action=argument.action,
195195
default=argument.default,
196-
type=argument.type, # type: ignore[arg-type] # incorrect typing in typeshed
196+
type=argument.type,
197197
help=argument.help,
198198
metavar=argument.metavar,
199199
choices=argument.choices,

0 commit comments

Comments
 (0)