OSGeo / grass

GRASS GIS - free and open-source geospatial processing engine
https://grass.osgeo.org
Other
791 stars 288 forks source link

style: Fixes literal-membership (PLR6201) for other code #3954

Closed echoix closed 2 days ago

echoix commented 2 days ago

Concerns Pylint rule "use-set-for-membership / R6201"

Using ruff check --output-format=concise --select PLR6201 --preview --unsafe-fixes --fix, but reverting some changes where it wasn't clear if it was safe.

Part of the effort to introduce Pylint 3.x for https://github.com/OSGeo/grass/issues/3921

Uses the fixes provided for ruff rule literal-membership (PLR6201) to fix part of Pylint's "use-set-for-membership / R6201".

I reverted some changes when I wasn't completely sure if the preconditions for this refactor were met, as described in the docs of the rule. One of these is that the objects must be hashable to be in a set. If there are any that you are unsure, I'll simply remove it from the PR, as it isn't exhaustive yet. It still helps to have less linter ignores comments to add afterwards (to have Pylint 3.x not fail).

The changes excludes the files already submitted in different PRs to limit the review scope.