[Python-projects] is class inheritance supposed to be supported in pylint 0.14.0 ?

Tim Black tblack at biamp.com
Fri May 16 20:37:30 CEST 2008


Here is a simplified example that exhibits the problem. 

 

Parent is the parent package to sub-packages A and B.

 

Sub-Package A:

Parent/A/__init__.py  contains "import a"

Parent/A/a.py contains:

 

from __future__ import absolute_import

from ..B import b

class aClass(b.bClass):

    def __init__(self):

        b.bClass.__init__(self) 

    def foo(self):

        print self.x

        print self.y

        print self.z

         

Sub-Package B:

Parent/B/__init__.py  contains "import b"

Parent/B/b.py contains:

 

class bClass:

    def __init__(self): 

        self.x = 0

        self.y = []

        self.z = ''

 

The Parent package is located in my sys.path. The above code runs just
fine:

 

>>> import Parent.A

>>> a = Parent.A.a.aClass(1)

>>> a.foo()

0

[]

 

However, when I run pylint for A/a.py it gives me 

 

F0401:  9: Unable to import 'B.b' (No module named B)

 

and therefore of course the ensuing errors:

 

E1101: 14:aClass.foo: Instance of 'aClass' has no 'x' member

E1101: 15:aClass.foo: Instance of 'aClass' has no 'y' member

E1101: 16:aClass.foo: Instance of 'aClass' has no 'z' member

 

If I change the import syntax in Parent/A/a.py to use "from Parent.B
import b" all errors go away. This seems to indicate a problem with
intra-sub-package relative imports. Any ideas?

 

Thanks,

Tim




BIAMP SYSTEMS EMAIL NOTICE 
The information contained in this email and any attachments is confidential and 
may be subject to copyright or other intellectual property protection. If you 
are not the intended recipient, you are not authorized to use or disclose this 
information, and we request that you notify us by reply mail or telephone and 
delete the original message from your mail system.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.logilab.org/pipermail/python-projects/attachments/20080516/5fdd956a/attachment.htm 


More information about the Python-Projects mailing list