Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix module names
  • Loading branch information
Ivan Levkivskyi committed Aug 11, 2023
commit 6e20a87d328eefd277e0ed50693db73522e78b0e
17 changes: 9 additions & 8 deletions docs/source/command_line.rst
Original file line number Diff line number Diff line change
Expand Up @@ -355,21 +355,22 @@ definitions or calls.
This flag allows to selectively disable :option:`--disallow-untyped-calls`
for functions and methods defined in specific packages, modules, or classes.
Note that each exception entry acts as a prefix. For example (assuming there
are no type annotations for ``numpy`` available):
are no type annotations for ``third_party_lib`` available):

.. code-block:: python

# mypy --disallow-untyped-calls
# --untyped-call-exception=numpy.random
# --untyped-call-exception=third_party_lib.module_a
# --untyped-call-exception=foo.A
import numpy as np
from foo import A, B
from third_party_lib.module_a import some_func
from third_party_lib.module_b import other_func
import foo

np.random.gamma(1.0) # OK, function comes from package `numpy.random`
np.fft.fft([1, 2, 3]) # E: Call to untyped function "fft" in typed context
some_func() # OK, function comes from module `third_party_lib.module_a`
other_func() # E: Call to untyped function "other_func" in typed context

A().meth() # OK, method was defined in class `bar.A`
B().meth() # E: Call to untyped function "meth" in typed context
foo.A().meth() # OK, method was defined in class `foo.A`
foo.B().meth() # E: Call to untyped function "meth" in typed context

# file foo.py
class A:
Expand Down