-
-
Notifications
You must be signed in to change notification settings - Fork 276
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
qt brain: Make slot argument optional for disconnect() #1550
Conversation
Discussed here: #1531 (comment) PyQt supports calling .disconnect() without any arguments in order to disconnect all slots: https://www.riverbankcomputing.com/static/Docs/PyQt6/signals_slots.html#disconnect Strictly speaking, slot=None is a wrong call, as actually passing None does not work: python-qt-tools/PyQt5-stubs#103 However, pylint/astroid does not support overloads needed to properly express this: pylint-dev/pylint#5264 So, while this is "wrong", it's less wrong than before - without this change, pylint expects a mandatory argument, thus raising a false-positive here: from PyQt5.QtCore import QTimer t = QTimer() t.timeout.connect(lambda: None) t.timeout.disconnect() despite running fine, pylint complains: test.py:4:0: E1120: No value for argument 'slot' in method call (no-value-for-parameter) while with this change, things work fine.
Pull Request Test Coverage Report for Build 2311757594
💛 - Coveralls |
Check
Let's put it on the main, then we can decide if this need to be backported to the maintenance branche or not :) |
I've seen that file and tried to write a test inspired by As for the fix itself: One thing we could do to avoid implying that
How does the changelog entry work? Do I add it to the earlier version here in the main branch? |
See pylint-dev/astroid#1550 for the signal disconnect. Not reporting the gen_classes() one, as we have another ignore for that, and doing something a bit unorthodox there anyways.
Yes in the 2.11.6 section |
Thanks for the fix!
You should be able to follow that test to extract the node for the |
Updated with a test and changelog now. Not too happy with the test since it basically 1:1 checks what the implementation is, but I guess there is not much more we can do if the test should live here and not in pylint. |
Don't mind the failing test, it's due to #1551 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
* qt brain: Make slot argument optional for disconnect() Discussed here: #1531 (comment) PyQt supports calling .disconnect() without any arguments in order to disconnect all slots: https://www.riverbankcomputing.com/static/Docs/PyQt6/signals_slots.html#disconnect Strictly speaking, slot=None is a wrong call, as actually passing None does not work: python-qt-tools/PyQt5-stubs#103 However, pylint/astroid does not support overloads needed to properly express this: pylint-dev/pylint#5264 So, while this is "wrong", it's less wrong than before - without this change, pylint expects a mandatory argument, thus raising a false-positive here: from PyQt5.QtCore import QTimer t = QTimer() t.timeout.connect(lambda: None) t.timeout.disconnect() despite running fine, pylint complains: test.py:4:0: E1120: No value for argument 'slot' in method call (no-value-for-parameter) while with this change, things work fine.
* qt brain: Make slot argument optional for disconnect() Discussed here: #1531 (comment) PyQt supports calling .disconnect() without any arguments in order to disconnect all slots: https://www.riverbankcomputing.com/static/Docs/PyQt6/signals_slots.html#disconnect Strictly speaking, slot=None is a wrong call, as actually passing None does not work: python-qt-tools/PyQt5-stubs#103 However, pylint/astroid does not support overloads needed to properly express this: pylint-dev/pylint#5264 So, while this is "wrong", it's less wrong than before - without this change, pylint expects a mandatory argument, thus raising a false-positive here: from PyQt5.QtCore import QTimer t = QTimer() t.timeout.connect(lambda: None) t.timeout.disconnect() despite running fine, pylint complains: test.py:4:0: E1120: No value for argument 'slot' in method call (no-value-for-parameter) while with this change, things work fine.
Steps
If this is an acceptable fix, I'll write a changelog- two more questions:main
or to a maintenance branchDescription
Discussed here:
#1531 (comment)
PyQt supports calling .disconnect() without any arguments in order to
disconnect all slots:
https://www.riverbankcomputing.com/static/Docs/PyQt6/signals_slots.html#disconnect
Strictly speaking, slot=None is a wrong call, as actually passing None
does not work:
python-qt-tools/PyQt5-stubs#103
However, pylint/astroid does not support overloads needed to properly
express this: pylint-dev/pylint#5264
So, while this is "wrong", it's less wrong than before - without this
change, pylint expects a mandatory argument, thus raising a
false-positive here:
despite running fine, pylint complains:
while with this change, things work fine.
Type of Changes