Skip to content

chore: zero-argument super() and PEP 604 unions in isinstance (#302) - #314

Open
kosesena wants to merge 2 commits into
SAP:masterfrom
kosesena:chore/302-py310-cleanups
Open

kosesena wants to merge 2 commits into
SAP:masterfrom
kosesena:chore/302-py310-cleanups

Conversation

@kosesena

Copy link
Copy Markdown

Part of #302: the two mechanical items from the checklist, now that Python 3.10 is the minimum since #306.

What changes

  • super(ClassName, self)super() at all 41 occurrences in exceptions.py, v2/model.py, v2/service.py and vendor/SAP.py (the issue estimates 46; 41 is what the tree holds today).
  • The two isinstance(x, (A, B)) checks named in the issue (service.py, _build_expression value handling and function_import_handler return type) become isinstance(x, A | B).
  • CHANGELOG: an entry under Unreleased / Changed.

Two commits, one per logical change, as CONTRIBUTING asks. The match/case refactors from the same checklist are deliberately left for separate pull requests: they touch control flow and deserve their own review.

Why no new test

No behaviour changes. Every super() replacement was checked against its enclosing class with an AST pass: in every case the class named in the call was the class being defined, so no call was skipping a level of the MRO. The existing suite covers every touched initializer and both isinstance branches.

Checked locally with the pinned tool versions, on Python 3.10.20

  • flake8 --config=.flake8 pyodata: clean
  • pylint --rcfile=.pylintrc pyodata: 10.00/10
  • pytest: 295 passed (also 295 on Python 3.14.5)
  • bandit -lll -r pyodata: no findings

🤖 Generated with Claude Code

kosesena and others added 2 commits September 13, 2026 18:46
Python 3.10 is the minimum since SAP#306, so the two-argument form of
super() that Python 2 needed is noise in every subclass initializer.
Replace all 41 occurrences in exceptions.py, v2/model.py, v2/service.py
and vendor/SAP.py with the zero-argument form.

Each replacement was checked against the enclosing class: the name
passed to super() was the class being defined in every case, so no call
was deliberately skipping a level of the MRO and behaviour is unchanged.
The one continuation line that no longer lined up with its opening
parenthesis was re-indented. No test is added because no behaviour
changes; the existing suite covers every touched initializer.

Part of SAP#302.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
isinstance() accepts a union type since Python 3.10, which is now the
minimum, so the tuple form at the two places SAP#302 names is replaced with
`tuple | list` and `model.EntityType | model.Collection`. No behaviour
changes; the existing tests cover both branches.

Part of SAP#302.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@cla-assistant

cla-assistant Bot commented Sep 13, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant