Pylint: no-member with Qt signals using PySide2

Created on 7 Nov 2018  路  3Comments  路  Source: PyCQA/pylint

Steps to reproduce

  1. Create signal_test.py containing:
from PySide2 import QtWidgets
app = QtWidgets.QApplication()
app.focusChanged.connect(lambda x: None)
  1. Run
    pylint .\signal_test.py --extension-pkg-whitelist=PySide2

Current behavior

signal_test.py:5:0: E1101: Instance of 'Signal' has no 'connect' member (no-member)

Expected behavior

No errors

pylint --version output

pylint 2.1.1
astroid 2.0.4
Python 3.7.0 | packaged by conda-forge | (default, Oct  9 2018, 13:13:14) [MSC v.1900 64 bit (AMD64)]

Note that this was addressed for PySide in #1633

astroid brain bug

Most helpful comment

This is more or less related to issue #1633

Until new version is release I patch brain_qt.py and the error is not raised.

``` diff
--- brain/brain_qt.py 2019-01-01 12:08:36.921238400 -0500
+++ brain/brain_qt.1.py 2019-01-01 12:21:51.070181400 -0500
@@ -80,3 +80,8 @@
transform_pyside_signal,
lambda node: node.qname() == "PySide.QtCore.Signal",
)
+MANAGER.register_transform(

  • nodes.ClassDef,
  • transform_pyside_signal,
  • lambda node: node.qname() == "PySide2.QtCore.Signal",
    +)

All 3 comments

Thanks for reporting an issue!

This is more or less related to issue #1633

Until new version is release I patch brain_qt.py and the error is not raised.

``` diff
--- brain/brain_qt.py 2019-01-01 12:08:36.921238400 -0500
+++ brain/brain_qt.1.py 2019-01-01 12:21:51.070181400 -0500
@@ -80,3 +80,8 @@
transform_pyside_signal,
lambda node: node.qname() == "PySide.QtCore.Signal",
)
+MANAGER.register_transform(

  • nodes.ClassDef,
  • transform_pyside_signal,
  • lambda node: node.qname() == "PySide2.QtCore.Signal",
    +)

This file is found on the astroid module of your python installation.

``` Python
site-packages/astroid/brain/brain_qt.py

Was this page helpful?
0 / 5 - 0 ratings