Skip to content

Commit

Permalink
Document new import error codes (#15840)
Browse files Browse the repository at this point in the history
See #14740

My PR was pretty old and predates the nice check to ensure error codes
are documented.
  • Loading branch information
hauntsaninja committed Aug 10, 2023
1 parent 78339b9 commit eab5b50
Showing 1 changed file with 34 additions and 4 deletions.
38 changes: 34 additions & 4 deletions docs/source/error_code_list.rst
Original file line number Diff line number Diff line change
Expand Up @@ -648,8 +648,18 @@ the issue:
.. _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.
Expand All @@ -658,11 +668,31 @@ Example:

.. 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]
Expand Down

0 comments on commit eab5b50

Please sign in to comment.