Document new import error codes (#15840)
See https://github.com/python/mypy/pull/14740
My PR was pretty old and predates the nice check to ensure error codes
are documented.
diff --git a/docs/source/error_code_list.rst b/docs/source/error_code_list.rst
index f935e02..f7f702a 100644
--- a/docs/source/error_code_list.rst
+++ b/docs/source/error_code_list.rst
@@ -648,8 +648,18 @@
.. _code-import:
-Check that import target can be found [import]
-----------------------------------------------
+Check for an issue with imports [import]
+----------------------------------------
+
+Mypy generates an error if it can't resolve an `import` statement.
+This is a parent error code of `import-not-found` and `import-untyped`
+
+See :ref:`ignore-missing-imports` for how to work around these errors.
+
+.. _code-import-not-found:
+
+Check that import target can be found [import-not-found]
+--------------------------------------------------------
Mypy generates an error if it can't find the source code or a stub file
for an imported module.
@@ -658,11 +668,31 @@
.. code-block:: python
- # Error: Cannot find implementation or library stub for module named 'acme' [import]
- import acme
+ # Error: Cannot find implementation or library stub for module named "m0dule_with_typo" [import-not-found]
+ import m0dule_with_typo
See :ref:`ignore-missing-imports` for how to work around these errors.
+.. _code-import-untyped:
+
+Check that import target can be found [import-untyped]
+--------------------------------------------------------
+
+Mypy generates an error if it can find the source code for an imported module,
+but that module does not provide type annotations (via :ref:`PEP 561 <installed-packages>`).
+
+Example:
+
+.. code-block:: python
+
+ # Error: Library stubs not installed for "bs4" [import-untyped]
+ import bs4
+ # Error: Skipping analyzing "no_py_typed": module is installed, but missing library stubs or py.typed marker [import-untyped]
+ import no_py_typed
+
+In some cases, these errors can be fixed by installing an appropriate
+stub package. See :ref:`ignore-missing-imports` for more details.
+
.. _code-no-redef:
Check that each name is defined once [no-redef]