Skip to content

Commit

Permalink
Add error code to typing_extensions suggestion (#14881)
Browse files Browse the repository at this point in the history
Fixes #14871

Note that this doesn't affect the exit code; it's just about what
non-fatal notes get printed during successful runs
  • Loading branch information
hauntsaninja authored Mar 11, 2023
1 parent fddd5c5 commit 3098574
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion mypy/semanal.py
Original file line number Diff line number Diff line change
Expand Up @@ -2618,11 +2618,14 @@ def report_missing_module_attribute(
typing_extensions = self.modules.get("typing_extensions")
if typing_extensions and source_id in typing_extensions.names:
self.msg.note(
f"Use `from typing_extensions import {source_id}` instead", context
f"Use `from typing_extensions import {source_id}` instead",
context,
code=codes.ATTR_DEFINED,
)
self.msg.note(
"See https://mypy.readthedocs.io/en/stable/runtime_troubles.html#using-new-additions-to-the-typing-module",
context,
code=codes.ATTR_DEFINED,
)

def process_import_over_existing_name(
Expand Down

0 comments on commit 3098574

Please sign in to comment.