(self, daemon: bool)
| 87 | APPROVED_STUBS_NOT_INSTALLED = 3 |
| 88 | |
| 89 | def error_message_templates(self, daemon: bool) -> tuple[str, list[str]]: |
| 90 | doc_link = "See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports" |
| 91 | if self is ModuleNotFoundReason.NOT_FOUND: |
| 92 | msg = 'Cannot find implementation or library stub for module named "{module}"' |
| 93 | notes = [doc_link] |
| 94 | elif self is ModuleNotFoundReason.WRONG_WORKING_DIRECTORY: |
| 95 | msg = 'Cannot find implementation or library stub for module named "{module}"' |
| 96 | notes = [ |
| 97 | "You may be running mypy in a subpackage, mypy should be run on the package root" |
| 98 | ] |
| 99 | elif self is ModuleNotFoundReason.FOUND_WITHOUT_TYPE_HINTS: |
| 100 | msg = ( |
| 101 | 'Skipping analyzing "{module}": module is installed, but missing library stubs ' |
| 102 | "or py.typed marker" |
| 103 | ) |
| 104 | notes = [doc_link] |
| 105 | elif self is ModuleNotFoundReason.APPROVED_STUBS_NOT_INSTALLED: |
| 106 | msg = 'Library stubs not installed for "{module}"' |
| 107 | notes = ['Hint: "python3 -m pip install {stub_dist}"'] |
| 108 | if not daemon: |
| 109 | notes.append( |
| 110 | '(or run "mypy --install-types" to install all missing stub packages)' |
| 111 | ) |
| 112 | notes.append(doc_link) |
| 113 | else: |
| 114 | assert False |
| 115 | return msg, notes |
| 116 | |
| 117 | |
| 118 | # If we found the module, returns the path to the module as a str. |
no test coverage detected