pylint-bot / pylint-unofficial

UNOFFICIAL playground for pylint github migration
0 stars 0 forks source link

PyQt4 still triggers no-member errors, pygtk2 as well #430

Open pylint-bot opened 9 years ago

pylint-bot commented 9 years ago

Originally reported by: Yann Dirson (BitBucket: ydirson, GitHub: @ydirson?)


The testcase provided in 2009 for a fix to support PyQt4 (https://lists.logilab.org/pipermail/python-projects/2009-July/001978.html) still causes simiar issues, with pylint 1.3.1 as well as current tip (both using astroid-1.2.1):

************* Module test_pyqt4
E:  4,17: Module 'PyQt4.QtGui' has no 'QLineEdit' member (no-member)
E:  7,17: Module 'PyQt4.QtGui' has no 'QDialog' member (no-member)
E:  9, 8: Module 'PyQt4.QtGui' has no 'QDialog' member (no-member)
E: 14,24: Module 'PyQt4.QtGui' has no 'QGroupBox' member (no-member)
E: 15,22: Module 'PyQt4.QtGui' has no 'QRadioButton' member (no-member)
E: 16,22: Module 'PyQt4.QtGui' has no 'QRadioButton' member (no-member)
E: 17,22: Module 'PyQt4.QtGui' has no 'QRadioButton' member (no-member)
E: 20,15: Module 'PyQt4.QtGui' has no 'QVBoxLayout' member (no-member)
E: 28,15: Module 'PyQt4.QtGui' has no 'QVBoxLayout' member (no-member)
E: 31, 8: Instance of 'TextWidget' has no 'setEnabled' member (no-member)
E: 35,23: Module 'PyQt4.QtGui' has no 'QPushButton' member (no-member)
E: 38, 8: Instance of 'MainWindow' has no 'setLayout' member (no-member)
E: 41, 8: Instance of 'MainWindow' has no 'done' member (no-member)
E: 44,10: Module 'PyQt4.QtGui' has no 'QApplication' member (no-member)
E: 46, 4: Instance of 'MainWindow' has no 'exec_' member (no-member)

It may or may not be related, but pygtk shows similar false positives:

 ************* Module Omaha.Toolkits.Gtk
E: 31,21: Module 'cairo' has no 'ImageSurface' member (no-member)
E: 31,40: Module 'cairo' has no 'FORMAT_ARGB32' member (no-member)
E: 44,24: Module 'pangocairo' has no 'CairoContext' member (no-member)
E: 44,48: Module 'cairo' has no 'Context' member (no-member)
E: 72,21: Module 'rsvg' has no 'Handle' member (no-member)
E: 85,14: Module 'cairo' has no 'Context' member (no-member)
E:104,15: Module 'gtk' has no 'Label' member (no-member)
E:110,23: Module 'gtk' has no 'Entry' member (no-member)
E:121,14: Module 'gtk' has no 'Adjustment' member (no-member)
E:122,25: Module 'gtk' has no 'SpinButton' member (no-member)

pylint-bot commented 9 years ago

Original comment by Claudiu Popa (BitBucket: PCManticore, GitHub: @PCManticore):


Have you tried using this with --extension-pkg-whitelist=pygtk or PyQt4?

pylint-bot commented 9 years ago

Original comment by Yann Dirson (BitBucket: ydirson, GitHub: @ydirson?):


I had missed that - using --extension-pkg-whitelist=gtk,pangocairo,rsvg,PyQt4,sip does improve the results a lot, thanks. However, in my code it still barfs on some valid statements, like:

E:346, 8: Class 'vbox' has no 'pack_start' member (no-member)
E:347, 8: Class 'vbox' has no 'show_all' member (no-member)

on :

#!python

    def notify(self, title, text):
        dlg = gtk.Dialog("omaha - " + title,
                         buttons=(gtk.STOCK_OK, gtk.RESPONSE_ACCEPT))
        dlg.vbox.pack_start(gtk.Label(text))
        dlg.vbox.show_all()
        dlg.run()
        dlg.destroy()