Bug
Output of python -c "import pydantic.utils; print(pydantic.utils.version_info())":
pydantic version: 1.6.1
pydantic compiled: False
install path: D:\sand\pydantic-nested\.venv\Lib\site-packages\pydantic
python version: 3.7.6 (tags/v3.7.6:43364a7ae0, Dec 18 2019, 23:46:00) [MSC v.1916 32 bit (Intel)]
platform: Windows-10-10.0.19559-SP0
optional deps. installed: ['typing-extensions']
Additionally, I'm using mypy==0.782 (latest as of today).
# bug.py
import pydantic
class Job(pydantic.BaseModel):
class Model(pydantic.BaseModel):
id: str
md5: str
model: Model
Job.Model # error on this line
# setup.cfg
[mypy]
plugins = pydantic.mypy
$ mypy bug.py
bug.py:10: error: Type variable "Article.Model" cannot be used as an expression
Found 1 error in 1 file (checked 1 source file)
If I rename Model to anything else, the mypy error disappears.
Bug
Output of
python -c "import pydantic.utils; print(pydantic.utils.version_info())":Additionally, I'm using
mypy==0.782(latest as of today).If I rename
Modelto anything else, the mypy error disappears.