Skip to content

Commit 8bc9eab

Browse files
authored
Add confidence value to typing extension messages (#5892)
1 parent 6d30e12 commit 8bc9eab

7 files changed

+109
-106
lines changed

pylint/extensions/typing.py

+3
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ def _check_for_alternative_union_syntax(
247247
"consider-alternative-union-syntax",
248248
node=node,
249249
args=(name, self._msg_postponed_eval_hint(node)),
250+
confidence=INFERENCE,
250251
)
251252

252253
def _check_for_typing_alias(
@@ -318,6 +319,7 @@ def leave_module(self, node: nodes.Module) -> None:
318319
"deprecated-typing-alias",
319320
node=msg.node,
320321
args=(msg.qname, msg.alias),
322+
confidence=INFERENCE,
321323
)
322324

323325
elif self._py37_plus:
@@ -333,6 +335,7 @@ def leave_module(self, node: nodes.Module) -> None:
333335
msg.alias,
334336
msg_future_import if msg.parent_subscript else "",
335337
),
338+
confidence=INFERENCE,
336339
)
337340

338341
# Clear all module cache variables
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
consider-using-alias:16:6:16:17::'typing.Dict' will be deprecated with PY39, consider using 'dict' instead:UNDEFINED
2-
consider-using-alias:17:6:17:10::'typing.List' will be deprecated with PY39, consider using 'list' instead:UNDEFINED
3-
consider-using-alias:19:6:19:24::'typing.OrderedDict' will be deprecated with PY39, consider using 'collections.OrderedDict' instead:UNDEFINED
4-
consider-using-alias:20:6:20:22::'typing.Awaitable' will be deprecated with PY39, consider using 'collections.abc.Awaitable' instead:UNDEFINED
5-
consider-using-alias:21:6:21:21::'typing.Iterable' will be deprecated with PY39, consider using 'collections.abc.Iterable' instead:UNDEFINED
6-
consider-using-alias:22:6:22:21::'typing.Hashable' will be deprecated with PY39, consider using 'collections.abc.Hashable' instead:UNDEFINED
7-
consider-using-alias:23:6:23:27::'typing.ContextManager' will be deprecated with PY39, consider using 'contextlib.AbstractContextManager' instead:UNDEFINED
8-
consider-using-alias:24:6:24:20::'typing.Pattern' will be deprecated with PY39, consider using 're.Pattern' instead:UNDEFINED
9-
consider-using-alias:25:7:25:22::'typing.Match' will be deprecated with PY39, consider using 're.Match' instead:UNDEFINED
10-
consider-using-alias:34:9:34:13::'typing.List' will be deprecated with PY39, consider using 'list' instead:UNDEFINED
11-
consider-using-alias:36:7:36:11::'typing.Type' will be deprecated with PY39, consider using 'type' instead:UNDEFINED
12-
consider-using-alias:37:7:37:12::'typing.Tuple' will be deprecated with PY39, consider using 'tuple' instead:UNDEFINED
13-
consider-using-alias:38:7:38:15::'typing.Callable' will be deprecated with PY39, consider using 'collections.abc.Callable' instead:UNDEFINED
14-
consider-using-alias:44:74:44:78:func1:'typing.Dict' will be deprecated with PY39, consider using 'dict' instead:UNDEFINED
15-
consider-using-alias:44:16:44:20:func1:'typing.List' will be deprecated with PY39, consider using 'list' instead:UNDEFINED
16-
consider-using-alias:44:37:44:41:func1:'typing.List' will be deprecated with PY39, consider using 'list' instead:UNDEFINED
17-
consider-using-alias:44:93:44:105:func1:'typing.Tuple' will be deprecated with PY39, consider using 'tuple' instead:UNDEFINED
18-
consider-using-alias:60:12:60:16:CustomNamedTuple:'typing.List' will be deprecated with PY39, consider using 'list' instead:UNDEFINED
19-
consider-using-alias:65:12:65:16:CustomTypedDict2:'typing.List' will be deprecated with PY39, consider using 'list' instead:UNDEFINED
20-
consider-using-alias:69:12:69:16:CustomDataClass:'typing.List' will be deprecated with PY39, consider using 'list' instead:UNDEFINED
1+
consider-using-alias:16:6:16:17::'typing.Dict' will be deprecated with PY39, consider using 'dict' instead:INFERENCE
2+
consider-using-alias:17:6:17:10::'typing.List' will be deprecated with PY39, consider using 'list' instead:INFERENCE
3+
consider-using-alias:19:6:19:24::'typing.OrderedDict' will be deprecated with PY39, consider using 'collections.OrderedDict' instead:INFERENCE
4+
consider-using-alias:20:6:20:22::'typing.Awaitable' will be deprecated with PY39, consider using 'collections.abc.Awaitable' instead:INFERENCE
5+
consider-using-alias:21:6:21:21::'typing.Iterable' will be deprecated with PY39, consider using 'collections.abc.Iterable' instead:INFERENCE
6+
consider-using-alias:22:6:22:21::'typing.Hashable' will be deprecated with PY39, consider using 'collections.abc.Hashable' instead:INFERENCE
7+
consider-using-alias:23:6:23:27::'typing.ContextManager' will be deprecated with PY39, consider using 'contextlib.AbstractContextManager' instead:INFERENCE
8+
consider-using-alias:24:6:24:20::'typing.Pattern' will be deprecated with PY39, consider using 're.Pattern' instead:INFERENCE
9+
consider-using-alias:25:7:25:22::'typing.Match' will be deprecated with PY39, consider using 're.Match' instead:INFERENCE
10+
consider-using-alias:34:9:34:13::'typing.List' will be deprecated with PY39, consider using 'list' instead:INFERENCE
11+
consider-using-alias:36:7:36:11::'typing.Type' will be deprecated with PY39, consider using 'type' instead:INFERENCE
12+
consider-using-alias:37:7:37:12::'typing.Tuple' will be deprecated with PY39, consider using 'tuple' instead:INFERENCE
13+
consider-using-alias:38:7:38:15::'typing.Callable' will be deprecated with PY39, consider using 'collections.abc.Callable' instead:INFERENCE
14+
consider-using-alias:44:74:44:78:func1:'typing.Dict' will be deprecated with PY39, consider using 'dict' instead:INFERENCE
15+
consider-using-alias:44:16:44:20:func1:'typing.List' will be deprecated with PY39, consider using 'list' instead:INFERENCE
16+
consider-using-alias:44:37:44:41:func1:'typing.List' will be deprecated with PY39, consider using 'list' instead:INFERENCE
17+
consider-using-alias:44:93:44:105:func1:'typing.Tuple' will be deprecated with PY39, consider using 'tuple' instead:INFERENCE
18+
consider-using-alias:60:12:60:16:CustomNamedTuple:'typing.List' will be deprecated with PY39, consider using 'list' instead:INFERENCE
19+
consider-using-alias:65:12:65:16:CustomTypedDict2:'typing.List' will be deprecated with PY39, consider using 'list' instead:INFERENCE
20+
consider-using-alias:69:12:69:16:CustomDataClass:'typing.List' will be deprecated with PY39, consider using 'list' instead:INFERENCE
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
consider-using-alias:13:6:13:17::'typing.Dict' will be deprecated with PY39, consider using 'dict' instead. Add 'from __future__ import annotations' as well:UNDEFINED
2-
consider-using-alias:14:6:14:10::'typing.List' will be deprecated with PY39, consider using 'list' instead. Add 'from __future__ import annotations' as well:UNDEFINED
3-
consider-using-alias:16:6:16:24::'typing.OrderedDict' will be deprecated with PY39, consider using 'collections.OrderedDict' instead. Add 'from __future__ import annotations' as well:UNDEFINED
4-
consider-using-alias:17:6:17:22::'typing.Awaitable' will be deprecated with PY39, consider using 'collections.abc.Awaitable' instead. Add 'from __future__ import annotations' as well:UNDEFINED
5-
consider-using-alias:18:6:18:21::'typing.Iterable' will be deprecated with PY39, consider using 'collections.abc.Iterable' instead. Add 'from __future__ import annotations' as well:UNDEFINED
6-
consider-using-alias:19:6:19:21::'typing.Hashable' will be deprecated with PY39, consider using 'collections.abc.Hashable' instead:UNDEFINED
7-
consider-using-alias:20:6:20:27::'typing.ContextManager' will be deprecated with PY39, consider using 'contextlib.AbstractContextManager' instead. Add 'from __future__ import annotations' as well:UNDEFINED
8-
consider-using-alias:21:6:21:20::'typing.Pattern' will be deprecated with PY39, consider using 're.Pattern' instead. Add 'from __future__ import annotations' as well:UNDEFINED
9-
consider-using-alias:22:7:22:22::'typing.Match' will be deprecated with PY39, consider using 're.Match' instead. Add 'from __future__ import annotations' as well:UNDEFINED
10-
consider-using-alias:31:9:31:13::'typing.List' will be deprecated with PY39, consider using 'list' instead:UNDEFINED
11-
consider-using-alias:33:7:33:11::'typing.Type' will be deprecated with PY39, consider using 'type' instead. Add 'from __future__ import annotations' as well:UNDEFINED
12-
consider-using-alias:34:7:34:12::'typing.Tuple' will be deprecated with PY39, consider using 'tuple' instead. Add 'from __future__ import annotations' as well:UNDEFINED
13-
consider-using-alias:35:7:35:15::'typing.Callable' will be deprecated with PY39, consider using 'collections.abc.Callable' instead. Add 'from __future__ import annotations' as well:UNDEFINED
14-
consider-using-alias:41:74:41:78:func1:'typing.Dict' will be deprecated with PY39, consider using 'dict' instead. Add 'from __future__ import annotations' as well:UNDEFINED
15-
consider-using-alias:41:16:41:20:func1:'typing.List' will be deprecated with PY39, consider using 'list' instead. Add 'from __future__ import annotations' as well:UNDEFINED
16-
consider-using-alias:41:37:41:41:func1:'typing.List' will be deprecated with PY39, consider using 'list' instead. Add 'from __future__ import annotations' as well:UNDEFINED
17-
consider-using-alias:41:93:41:105:func1:'typing.Tuple' will be deprecated with PY39, consider using 'tuple' instead. Add 'from __future__ import annotations' as well:UNDEFINED
18-
consider-using-alias:57:12:57:16:CustomNamedTuple:'typing.List' will be deprecated with PY39, consider using 'list' instead. Add 'from __future__ import annotations' as well:UNDEFINED
19-
consider-using-alias:62:12:62:16:CustomTypedDict2:'typing.List' will be deprecated with PY39, consider using 'list' instead. Add 'from __future__ import annotations' as well:UNDEFINED
20-
consider-using-alias:66:12:66:16:CustomDataClass:'typing.List' will be deprecated with PY39, consider using 'list' instead. Add 'from __future__ import annotations' as well:UNDEFINED
1+
consider-using-alias:13:6:13:17::'typing.Dict' will be deprecated with PY39, consider using 'dict' instead. Add 'from __future__ import annotations' as well:INFERENCE
2+
consider-using-alias:14:6:14:10::'typing.List' will be deprecated with PY39, consider using 'list' instead. Add 'from __future__ import annotations' as well:INFERENCE
3+
consider-using-alias:16:6:16:24::'typing.OrderedDict' will be deprecated with PY39, consider using 'collections.OrderedDict' instead. Add 'from __future__ import annotations' as well:INFERENCE
4+
consider-using-alias:17:6:17:22::'typing.Awaitable' will be deprecated with PY39, consider using 'collections.abc.Awaitable' instead. Add 'from __future__ import annotations' as well:INFERENCE
5+
consider-using-alias:18:6:18:21::'typing.Iterable' will be deprecated with PY39, consider using 'collections.abc.Iterable' instead. Add 'from __future__ import annotations' as well:INFERENCE
6+
consider-using-alias:19:6:19:21::'typing.Hashable' will be deprecated with PY39, consider using 'collections.abc.Hashable' instead:INFERENCE
7+
consider-using-alias:20:6:20:27::'typing.ContextManager' will be deprecated with PY39, consider using 'contextlib.AbstractContextManager' instead. Add 'from __future__ import annotations' as well:INFERENCE
8+
consider-using-alias:21:6:21:20::'typing.Pattern' will be deprecated with PY39, consider using 're.Pattern' instead. Add 'from __future__ import annotations' as well:INFERENCE
9+
consider-using-alias:22:7:22:22::'typing.Match' will be deprecated with PY39, consider using 're.Match' instead. Add 'from __future__ import annotations' as well:INFERENCE
10+
consider-using-alias:31:9:31:13::'typing.List' will be deprecated with PY39, consider using 'list' instead:INFERENCE
11+
consider-using-alias:33:7:33:11::'typing.Type' will be deprecated with PY39, consider using 'type' instead. Add 'from __future__ import annotations' as well:INFERENCE
12+
consider-using-alias:34:7:34:12::'typing.Tuple' will be deprecated with PY39, consider using 'tuple' instead. Add 'from __future__ import annotations' as well:INFERENCE
13+
consider-using-alias:35:7:35:15::'typing.Callable' will be deprecated with PY39, consider using 'collections.abc.Callable' instead. Add 'from __future__ import annotations' as well:INFERENCE
14+
consider-using-alias:41:74:41:78:func1:'typing.Dict' will be deprecated with PY39, consider using 'dict' instead. Add 'from __future__ import annotations' as well:INFERENCE
15+
consider-using-alias:41:16:41:20:func1:'typing.List' will be deprecated with PY39, consider using 'list' instead. Add 'from __future__ import annotations' as well:INFERENCE
16+
consider-using-alias:41:37:41:41:func1:'typing.List' will be deprecated with PY39, consider using 'list' instead. Add 'from __future__ import annotations' as well:INFERENCE
17+
consider-using-alias:41:93:41:105:func1:'typing.Tuple' will be deprecated with PY39, consider using 'tuple' instead. Add 'from __future__ import annotations' as well:INFERENCE
18+
consider-using-alias:57:12:57:16:CustomNamedTuple:'typing.List' will be deprecated with PY39, consider using 'list' instead. Add 'from __future__ import annotations' as well:INFERENCE
19+
consider-using-alias:62:12:62:16:CustomTypedDict2:'typing.List' will be deprecated with PY39, consider using 'list' instead. Add 'from __future__ import annotations' as well:INFERENCE
20+
consider-using-alias:66:12:66:16:CustomDataClass:'typing.List' will be deprecated with PY39, consider using 'list' instead. Add 'from __future__ import annotations' as well:INFERENCE
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
consider-alternative-union-syntax:13:6:13:11::Consider using alternative Union syntax instead of 'Union':UNDEFINED
2-
consider-alternative-union-syntax:14:11:14:16::Consider using alternative Union syntax instead of 'Union':UNDEFINED
3-
consider-alternative-union-syntax:15:16:15:28::Consider using alternative Union syntax instead of 'Union':UNDEFINED
4-
consider-alternative-union-syntax:16:6:16:14::Consider using alternative Union syntax instead of 'Optional':UNDEFINED
5-
consider-alternative-union-syntax:24:10:24:18:func1:Consider using alternative Union syntax instead of 'Optional':UNDEFINED
6-
consider-alternative-union-syntax:25:24:25:29:func1:Consider using alternative Union syntax instead of 'Union':UNDEFINED
7-
consider-alternative-union-syntax:26:5:26:10:func1:Consider using alternative Union syntax instead of 'Union':UNDEFINED
8-
consider-alternative-union-syntax:38:12:38:17:CustomNamedTuple:Consider using alternative Union syntax instead of 'Union':UNDEFINED
9-
consider-alternative-union-syntax:43:27:43:32:CustomTypedDict2:Consider using alternative Union syntax instead of 'Union':UNDEFINED
10-
consider-alternative-union-syntax:47:12:47:20:CustomDataClass:Consider using alternative Union syntax instead of 'Optional':UNDEFINED
1+
consider-alternative-union-syntax:13:6:13:11::Consider using alternative Union syntax instead of 'Union':INFERENCE
2+
consider-alternative-union-syntax:14:11:14:16::Consider using alternative Union syntax instead of 'Union':INFERENCE
3+
consider-alternative-union-syntax:15:16:15:28::Consider using alternative Union syntax instead of 'Union':INFERENCE
4+
consider-alternative-union-syntax:16:6:16:14::Consider using alternative Union syntax instead of 'Optional':INFERENCE
5+
consider-alternative-union-syntax:24:10:24:18:func1:Consider using alternative Union syntax instead of 'Optional':INFERENCE
6+
consider-alternative-union-syntax:25:24:25:29:func1:Consider using alternative Union syntax instead of 'Union':INFERENCE
7+
consider-alternative-union-syntax:26:5:26:10:func1:Consider using alternative Union syntax instead of 'Union':INFERENCE
8+
consider-alternative-union-syntax:38:12:38:17:CustomNamedTuple:Consider using alternative Union syntax instead of 'Union':INFERENCE
9+
consider-alternative-union-syntax:43:27:43:32:CustomTypedDict2:Consider using alternative Union syntax instead of 'Union':INFERENCE
10+
consider-alternative-union-syntax:47:12:47:20:CustomDataClass:Consider using alternative Union syntax instead of 'Optional':INFERENCE
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
consider-alternative-union-syntax:11:6:11:11::Consider using alternative Union syntax instead of 'Union':UNDEFINED
2-
consider-alternative-union-syntax:12:11:12:16::Consider using alternative Union syntax instead of 'Union':UNDEFINED
3-
consider-alternative-union-syntax:13:16:13:28::Consider using alternative Union syntax instead of 'Union':UNDEFINED
4-
consider-alternative-union-syntax:14:6:14:14::Consider using alternative Union syntax instead of 'Optional':UNDEFINED
5-
consider-alternative-union-syntax:16:9:16:14::Consider using alternative Union syntax instead of 'Union':UNDEFINED
6-
consider-alternative-union-syntax:17:14:17:19::Consider using alternative Union syntax instead of 'Union':UNDEFINED
7-
consider-alternative-union-syntax:18:19:18:31::Consider using alternative Union syntax instead of 'Union':UNDEFINED
8-
consider-alternative-union-syntax:19:9:19:17::Consider using alternative Union syntax instead of 'Optional':UNDEFINED
9-
consider-alternative-union-syntax:22:10:22:18:func1:Consider using alternative Union syntax instead of 'Optional':UNDEFINED
10-
consider-alternative-union-syntax:23:24:23:29:func1:Consider using alternative Union syntax instead of 'Union':UNDEFINED
11-
consider-alternative-union-syntax:24:5:24:10:func1:Consider using alternative Union syntax instead of 'Union':UNDEFINED
12-
consider-alternative-union-syntax:27:19:27:24:Custom1:Consider using alternative Union syntax instead of 'Union':UNDEFINED
13-
consider-alternative-union-syntax:31:28:31:33::Consider using alternative Union syntax instead of 'Union':UNDEFINED
14-
consider-alternative-union-syntax:33:14:33:22::Consider using alternative Union syntax instead of 'Optional':UNDEFINED
15-
consider-alternative-union-syntax:36:12:36:17:CustomNamedTuple:Consider using alternative Union syntax instead of 'Union':UNDEFINED
16-
consider-alternative-union-syntax:38:56:38:64::Consider using alternative Union syntax instead of 'Optional':UNDEFINED
17-
consider-alternative-union-syntax:41:27:41:32:CustomTypedDict2:Consider using alternative Union syntax instead of 'Union':UNDEFINED
18-
consider-alternative-union-syntax:45:12:45:20:CustomDataClass:Consider using alternative Union syntax instead of 'Optional':UNDEFINED
1+
consider-alternative-union-syntax:11:6:11:11::Consider using alternative Union syntax instead of 'Union':INFERENCE
2+
consider-alternative-union-syntax:12:11:12:16::Consider using alternative Union syntax instead of 'Union':INFERENCE
3+
consider-alternative-union-syntax:13:16:13:28::Consider using alternative Union syntax instead of 'Union':INFERENCE
4+
consider-alternative-union-syntax:14:6:14:14::Consider using alternative Union syntax instead of 'Optional':INFERENCE
5+
consider-alternative-union-syntax:16:9:16:14::Consider using alternative Union syntax instead of 'Union':INFERENCE
6+
consider-alternative-union-syntax:17:14:17:19::Consider using alternative Union syntax instead of 'Union':INFERENCE
7+
consider-alternative-union-syntax:18:19:18:31::Consider using alternative Union syntax instead of 'Union':INFERENCE
8+
consider-alternative-union-syntax:19:9:19:17::Consider using alternative Union syntax instead of 'Optional':INFERENCE
9+
consider-alternative-union-syntax:22:10:22:18:func1:Consider using alternative Union syntax instead of 'Optional':INFERENCE
10+
consider-alternative-union-syntax:23:24:23:29:func1:Consider using alternative Union syntax instead of 'Union':INFERENCE
11+
consider-alternative-union-syntax:24:5:24:10:func1:Consider using alternative Union syntax instead of 'Union':INFERENCE
12+
consider-alternative-union-syntax:27:19:27:24:Custom1:Consider using alternative Union syntax instead of 'Union':INFERENCE
13+
consider-alternative-union-syntax:31:28:31:33::Consider using alternative Union syntax instead of 'Union':INFERENCE
14+
consider-alternative-union-syntax:33:14:33:22::Consider using alternative Union syntax instead of 'Optional':INFERENCE
15+
consider-alternative-union-syntax:36:12:36:17:CustomNamedTuple:Consider using alternative Union syntax instead of 'Union':INFERENCE
16+
consider-alternative-union-syntax:38:56:38:64::Consider using alternative Union syntax instead of 'Optional':INFERENCE
17+
consider-alternative-union-syntax:41:27:41:32:CustomTypedDict2:Consider using alternative Union syntax instead of 'Union':INFERENCE
18+
consider-alternative-union-syntax:45:12:45:20:CustomDataClass:Consider using alternative Union syntax instead of 'Optional':INFERENCE

0 commit comments

Comments
 (0)