问题
I would like to introduce partial type annotation to my project. For example for overloading. I found that pep561 introduce partial stub file support.
I develop my project with PyCharm and I add corresponding *.pyi
file. And got expected information, but PyCharm reports that cannot find reference in pyi file.
It is possible to force PyCharm to look to orginal py file when there is no entry in pyi file? Or maybe it is also doable with partial entry for class?
I create sample project to show problem (orginal is to big):
├── main.py
└── pep561_test
├── __init__.py
└── __init__.pyi
main.py
from pep561_test import AA, BB, CC
AA().test1(1)
AA().test1(True)
AA().test1('a')
AA().test2(1)
BB().test1(1)
BB().test2(1)
__init__.py
class AA:
def test1(self, a):
pass
def test2(self, a):
pass
class BB:
def test1(self, a):
pass
def test2(self, a):
pass
class CC:
def test1(self, a):
pass
def test2(self, a):
pass
__init__.pyi
class AA:
def test1(self, a: int) -> int: ...
def test1(self, a: bool) -> str: ...
def test2(self, a):
pass
class BB:
def test1(self, a):
pass
来源:https://stackoverflow.com/questions/55160797/partial-stub-in-pycharm