Skip to content

chore: refactor _build_expression operator dispatch to match/case - #317

Merged
filak-sap merged 5 commits into
masterfrom
302
Sep 30, 2026
Merged

filak-sap merged 5 commits into
masterfrom
302

Conversation

@phanak-sap

Copy link
Copy Markdown
Contributor

Replace the if/elif chain in _build_expression with a PEP 634 match/case statement, removing the need for pylint suppressions of too-many-return-statements and too-many-branches.

Part of #302.

Replace the if/elif chain in _build_expression with a PEP 634
match/case statement, removing the need for pylint suppressions of
too-many-return-statements and too-many-branches.

Part of #302.
pylint 2.11.0 is the first release bundling astroid 2.9.x, which added
visit_match — required to lint Python 3.10 match/case statements without
crashing.

This is intentionally minimal pylint bump, even that pylint is currently 2 major
versions above - there are too much new failures when trying the latest linter.

Part of #302.
Disable C0209, R1735, R1734, and W0602 globally in .pylintrc, and add
an inline too-many-return-statements suppression to _build_expression
where match/case inherently exceeds the return-count limit.

Fixes for those will be tracked in a follow-up PR.

Part of #302.
pylint 2.11.0 depends on wrapt<1.14 which fails to build on Python 3.11
because inspect.formatargspec was removed. pylint 2.15.0 requires
wrapt>=1.14 which supports Python 3.11.

Part of #302.
Remove obsolete .pylintrc options dropped in pylint 2.14/2.15
(optimize-ast, files-output, no-space-check, *-name-hint keys) and
globally suppress unrecognized-option / useless-option-value.

Remove 32 inline no-self-use suppressions from model.py and service.py
that now trigger R0022 because no-self-use was moved to an optional
extension in pylint 2.14.

Part of #302.
@phanak-sap

phanak-sap commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor Author

This is a "small pain" towards bigger goal.
We cannot jump directly to latest pylint, but refactoring fix for Python 3.10 and wanting to have compatibility builds across major versions, triggered cascade of pylint-related changes.

  • 2.15 is not latest 2.X but it is move forward
  • all that is necessary for the simple change covered in commit b16ca2
  • warnings suppressed by this PR will be handled as separate issue and with follow-up PR
  • overall goal is to reach latest pylint 4.x compatibility in small increments.

@filak-sap
filak-sap merged commit dce7128 into master Sep 30, 2026
46 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants