This is a bug report. There was a regression recently that caused mypy to start raising error where it did not in the past.
Example:
Save the following code at pathlib.py.
import pathlib
p = pathlib.Path(".")
print(p)
With the latest mypy, this fails.
$ mypy --version
mypy 0.761
$ mypy pathlib.py
pathlib.py:3: error: Module has no attribute "Path"
Found 1 error in 1 file (checked 1 source file)
However, it used to work:
$ mypy --version
mypy 0.720
$ mypy pathlib.py
$
Note: This code won't run, but I was having trouble making a simple example to reproduce the issue I was seeing. The actually case where this happened does work and was a sub-module within a project that was named the same as a 3rd part module it was wrapping.
This is a bug report. There was a regression recently that caused
mypyto start raising error where it did not in the past.Example:
Save the following code at
pathlib.py.With the latest
mypy, this fails.However, it used to work:
Note: This code won't run, but I was having trouble making a simple example to reproduce the issue I was seeing. The actually case where this happened does work and was a sub-module within a project that was named the same as a 3rd part module it was wrapping.