Language Server version: 2020.8.2
No error is been shown.
Shows following false error: "PostProcessor(t)" has type "PostProcessor" and is not callable
Code to reproduce issue:
from testa.tooling.post_processing import PostProcessor
class Main(testa.StdMain):
def run(self):
with PostProcessor(t) as p:
p.run()
post_processing/__init__.py
from .PostProcessor_Special import * # maybe this '*' import causes the issue, direct import works
PostProcessor=PostProcessor_Special
post_processing/PostProcessor_Special.py
class PostProcessor_Special:
def __init__(self, t, issue=None):
self.org_t = t
self.issue = issue
With language server set to jedi, all works fine.
Thanks for the bug report. This will be fixed in the next version of Pylance.
In case you're interested in the details...
When you use a statement of the form from .A import B within an __init__.py file, the Python interpreter implicitly creates a symbol A and assigns it to refer to the submodule "A". If you use the form from .A import A or from .A import B as A, the same thing occurs, but the value of symbol A is immediately overwritten with the value that is imported from submodule A. Pylance was handling that case correctly, but it wasn't handling the case where a wildcard import was used (from .A import * where one of the imported symbols was named "A"). That's the edge case you hit in your code.
This issue has been fixed in version 2020.8.3, which we've just released. You can find the changelog here: https://github.com/microsoft/pylance-release/blob/master/CHANGELOG.md#202083-28-august-2020