pytype
pytype copied to clipboard
pytype fails to import attrs.AttrsInstance
In attempting to use AttrsInstance to type a (admittedly very general) interface to a new library, I find that I cannot get pytype to find the type without also importing define.
Reproduction case (Note this is the ONLY thing in the file):
from attrs import AttrsInstance
Oddly, this does not reproduce the problem:
from attrs import define, AttrsInstance
I honestly have no idea why this is happening. Insights welcome :)
I don't think define is related to this issue, it's simply that #1571 was hiding the bug when define was also imported.
$ cat repro.py
from attrs import AttrsInstance, define
$ pytype-single repro.py
File "repro.py", line 1, in <module>: Can't find module 'attrs.AttrsInstance'. [import-error]
For more details, see https://google.github.io/pytype/errors.html#import-error
$ python repro.py
$