[Python-projects] Pylint fails to understand inheritance

Osmo Salomaa otsaloma at cc.hut.fi
Wed Nov 15 21:48:16 CET 2006


ke, 2006-11-15 kello 19:49 +0100, Sylvain Thénault kirjoitti:
> On Friday 03 November à 02:08, Osmo Salomaa wrote:
> > Hello,
> > 
> > I'm using pylint 0.12.1, python 2.5 and pygtk 2.10. When checking any
> > gtk widget code, pylint fails to understand inheritance thinking that
> > the widget inherits from logilab.astng.Yes.
> > 
> > Here's a minimal gtk widget with two valid method calls:
> > 
> > import gtk
> > class View(gtk.TreeView):
> >     def __init__(self, model=None):
> >         gtk.TreeView.__init__(self, model)
> >         self.set_headers_visible(True)
> >         self.set_rules_hint(True)
> > 
> > Here are the error messages from pylint (with default configuration):
> > 
> > C:  1: Missing docstring
> > C:  2:View: Missing docstring
> > W:  4:View.__init__: __init__ method from a non direct base class
> > <logilab.astng.Yes object at 0xb7b66e2c> is called
> > E:  5:View.__init__: Instance of 'View' has no 'set_headers_visible'
> > member
> > E:  6:View.__init__: Instance of 'View' has no 'set_rules_hint' member
> > R:  2:View: To few public methods (0/2)
> 
> which astng version are you using ? A current problem which may make
> pylint missing inherited attributes/methods is that the module where the
> parent class is not importable. You should be able to import gtk in your
> case using the same (shell) environment as you're using to launch
> pylint.

$ pylint --version
No config file found, using default configuration
pylint 0.12.1,
astng 0.16.1, common 0.19.3
Python 2.5 (release25-maint, Oct 29 2006, 12:44:11)
[GCC 4.1.2 20061026 (prerelease) (Debian 4.1.1-18)]

There should be no problems with the importability of gtk.

-- 
Osmo Salomaa




More information about the Python-Projects mailing list