-
-
Notifications
You must be signed in to change notification settings - Fork 316
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
style: Fix unnecessary-dunder-call (PLC2801) #4170
Merged
echoix
merged 14 commits into
OSGeo:main
from
echoix:fix-unnecessary-dunder-call-PLC2801
Aug 19, 2024
Merged
style: Fix unnecessary-dunder-call (PLC2801) #4170
echoix
merged 14 commits into
OSGeo:main
from
echoix:fix-unnecessary-dunder-call-PLC2801
Aug 19, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Ruff rule: https://docs.astral.sh/ruff/rules/unnecessary-dunder-call/ 12 instances fixed. Solves some reported issues by Pylint 3.2.6 through unnecessary-dunder-call / C2801
4 instances fixed
6 instances fixed
3 instances fixed
1 instance fixed
github-actions
bot
added
GUI
wxGUI related
Python
Related code is in Python
libraries
tests
Related to Test Suite
labels
Aug 13, 2024
ninsbl
previously approved these changes
Aug 14, 2024
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.
Looks good to me. My two comments are actually more questions, so I better understand...
petrasovaa
approved these changes
Aug 19, 2024
landam
pushed a commit
to landam/grass
that referenced
this pull request
Aug 22, 2024
* style: Fix unnecessary-dunder-call (PLC2801) Ruff rule: https://docs.astral.sh/ruff/rules/unnecessary-dunder-call/ 12 instances fixed. Solves some reported issues by Pylint 3.2.6 through unnecessary-dunder-call / C2801 * style: Fix unnecessary-dunder-call (PLC2801) for __init__ 4 instances fixed * style: Fix unnecessary-dunder-call (PLC2801) using getattr 6 instances fixed * Ignore PLC2801 in test suite file for preserving meaning of test during the change * style: Fix unnecessary-dunder-call (PLC2801) for get and set item 3 instances fixed * style: Fix unnecessary-dunder-call (PLC2801) for repr 1 instance fixed * Ignore PLC2801 for __del__, as there seems to be some differences between both * Update pyproject.toml to remove PLC2801 exclusion * gui.wxpython.mapdisp.main: Remove next(self) from LayerList * grass.pygrass.vector: Remove next(self) from vector class (old Python 2 iterator) * Revert "grass.pygrass.vector: Remove next(self) from vector class (old Python 2 iterator)" This reverts commit f79172c. * Revert "gui.wxpython.mapdisp.main: Remove next(self) from LayerList" This reverts commit 9963dd1.
Mahesh1998
pushed a commit
to Mahesh1998/grass
that referenced
this pull request
Sep 19, 2024
* style: Fix unnecessary-dunder-call (PLC2801) Ruff rule: https://docs.astral.sh/ruff/rules/unnecessary-dunder-call/ 12 instances fixed. Solves some reported issues by Pylint 3.2.6 through unnecessary-dunder-call / C2801 * style: Fix unnecessary-dunder-call (PLC2801) for __init__ 4 instances fixed * style: Fix unnecessary-dunder-call (PLC2801) using getattr 6 instances fixed * Ignore PLC2801 in test suite file for preserving meaning of test during the change * style: Fix unnecessary-dunder-call (PLC2801) for get and set item 3 instances fixed * style: Fix unnecessary-dunder-call (PLC2801) for repr 1 instance fixed * Ignore PLC2801 for __del__, as there seems to be some differences between both * Update pyproject.toml to remove PLC2801 exclusion * gui.wxpython.mapdisp.main: Remove next(self) from LayerList * grass.pygrass.vector: Remove next(self) from vector class (old Python 2 iterator) * Revert "grass.pygrass.vector: Remove next(self) from vector class (old Python 2 iterator)" This reverts commit f79172c. * Revert "gui.wxpython.mapdisp.main: Remove next(self) from LayerList" This reverts commit 9963dd1.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Ruff rule: https://docs.astral.sh/ruff/rules/unnecessary-dunder-call/
Pylint rule: https://pylint.readthedocs.io/en/latest/user_guide/messages/convention/unnecessary-dunder-call.html
Solves some issues reported by Pylint 3.2.6 through unnecessary-dunder-call / C2801.
I left out the cases where it touched
__del__()
as the Python docs explain a difference, and even with static analysis the meaning of the code was worse with a change.I also left out the cases where it changed the test cases, so that they can fail as before if the current changes are wrong (it wouldn't be wise to change the code + the tests at the same time).