Can PyCharm understand name shadowing in __init__.py?
I'm working with a big legacy code base and it presents something like this in lots of places: packages have a __init__.py file with this kind of imports:
from SomeThing import SomeThing
and the file structure is something like this:
somelib/
__init__.py
SomeThing.py
with a SomeThing class defined inside SomeThing.py.
So, I have client code doing:
The code works, of course, because SomeThing is a class. Yet, PyCharm is resolving SomeThing to the module (SomeThing.py) instead. So there's no navigation, there are warnings about SomeThing not being callable, etc.
Is there anything I can do to have PyCharm see this a Python does?
from SomeThing import SomeThing
and the file structure is something like this:
somelib/
__init__.py
SomeThing.py
with a SomeThing class defined inside SomeThing.py.
So, I have client code doing:
import somelib something = somelib.SomeThing() something.foo()
The code works, of course, because SomeThing is a class. Yet, PyCharm is resolving SomeThing to the module (SomeThing.py) instead. So there's no navigation, there are warnings about SomeThing not being callable, etc.
Is there anything I can do to have PyCharm see this a Python does?
Please sign in to leave a comment.
http://blog.jetbrains.com/pycharm/2012/08/pycharm-2-6-early-access-preview/