You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I created this minimal demo to illustrate my problem.
The variable "entity" is only decalred its type in AA.py, but not in AA.pyi, so when I hover over AA.A.entity in other files, Pylance only assigned "Any" to it.
What I want to do is when Pylance can't infer the type of a certain variable, it can automatically fall back to .py file to infer the type. In this case, "float" as declared in AA.py.
Or is there another way for me to do this? I already tried to import AA in AA.pyi and make class A inherit from AA.A, assuming this will take me from AA.pyi to AA.py, but nothing seems to happen.
The reason why I have this problem is that, I'm currently working on a giant project with absolute no typing in it. I want to generate stub files only for some variables that is tricky for pylance to infer. And for those conventional ones, I want pylance to infer from the py file, so I don't have to generate all variables in the stub file.
The text was updated successfully, but these errors were encountered:
I believe what you're asking for isn't possible. Pylance defaults to using the pyi file if it exists. It's on a per module basis. If module A.pyi exists, it will be used in place of A.py to find types.
I created this minimal demo to illustrate my problem.
The variable "entity" is only decalred its type in AA.py, but not in AA.pyi, so when I hover over AA.A.entity in other files, Pylance only assigned "Any" to it.
What I want to do is when Pylance can't infer the type of a certain variable, it can automatically fall back to .py file to infer the type. In this case, "float" as declared in AA.py.
Or is there another way for me to do this? I already tried to import AA in AA.pyi and make class A inherit from AA.A, assuming this will take me from AA.pyi to AA.py, but nothing seems to happen.
The reason why I have this problem is that, I'm currently working on a giant project with absolute no typing in it. I want to generate stub files only for some variables that is tricky for pylance to infer. And for those conventional ones, I want pylance to infer from the py file, so I don't have to generate all variables in the stub file.
The text was updated successfully, but these errors were encountered: