Skip to content

Commit 3098574

Browse files
authored
Add error code to typing_extensions suggestion (#14881)
Fixes #14871 Note that this doesn't affect the exit code; it's just about what non-fatal notes get printed during successful runs
1 parent fddd5c5 commit 3098574

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

mypy/semanal.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2618,11 +2618,14 @@ def report_missing_module_attribute(
26182618
typing_extensions = self.modules.get("typing_extensions")
26192619
if typing_extensions and source_id in typing_extensions.names:
26202620
self.msg.note(
2621-
f"Use `from typing_extensions import {source_id}` instead", context
2621+
f"Use `from typing_extensions import {source_id}` instead",
2622+
context,
2623+
code=codes.ATTR_DEFINED,
26222624
)
26232625
self.msg.note(
26242626
"See https://mypy.readthedocs.io/en/stable/runtime_troubles.html#using-new-additions-to-the-typing-module",
26252627
context,
2628+
code=codes.ATTR_DEFINED,
26262629
)
26272630

26282631
def process_import_over_existing_name(

0 commit comments

Comments
 (0)