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:

import somelib

something = somelib.SomeThing()
something.foo()
prettyPrint();

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?
1 comment
Comment actions Permalink
This is a bug in PyCharm 2.5.2 which is fixed in PyCharm 2.6 Early Access Preview:
http://blog.jetbrains.com/pycharm/2012/08/pycharm-2-6-early-access-preview/
0

Please sign in to leave a comment.