[Python-projects] Pylint fails to understand inheritance

Sylvain Thénault sylvain.thenault at logilab.fr
Thu Nov 16 10:05:24 CET 2006


On Wednesday 15 November à 16:00, Skip Montanaro wrote:
> FWIW, I've seen this problem for quite awhile and reported it
> previously.  Any class which inherits from gobject.GObject seems to be
> affected.  My guess is that since GObject is implemented in C pylint
> can't tell it inherits from object, since there's no ast information
> about such classes.

in such a case astng will build an ast containing all the information
guessable from "living" object, and that's usually enough for the pylint
job. You can also notice that there is a non regression test about a
similar gtk problem (maybe it was yours originaly) in
test/regrtest_data/pygtk_import.py. Does python regrtest.py in pylint's
test directory work for you ?

I've tested the posted sample of code without any problem:

syt:~$ cat gtktest.py
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)
syt:~$ pylint -rn gtktest.py
No config file found, using default configuration
************* Module gtktest
C:  1: Missing docstring
C:  2:View: Missing docstring
R:  2:View: Too many public methods (256/20)

hint: if gtk analysis work correctly, there is a little time during the
first Convention message and the other, that's the time where the astng
representation for gtk is built...

-- 
Sylvain Thénault                               LOGILAB, Paris (France)
Formations Python, Zope, Plone, Debian:  http://www.logilab.fr/formations
Développement logiciel sur mesure:       http://www.logilab.fr/services
Python et calcul scientifique:           http://www.logilab.fr/science



More information about the Python-Projects mailing list