Cleanup/Ruff: Use identity comparison for type/class checks (E721, E712) - #3802
Open
ThomasLecocq wants to merge 1 commit into
Open
Cleanup/Ruff: Use identity comparison for type/class checks (E721, E712)#3802ThomasLecocq wants to merge 1 commit into
ThomasLecocq wants to merge 1 commit into
Conversation
Replace `==`/`!=` comparisons against type and class objects with `is`/`is not` across source and tests, and drop the redundant `True ==` in two SEGY roundtrip assertions. The left operand in every case is already a type or class object (param_type, convert_to, quantity_type, parsed WADL parameter types, warning `.category` classes), so identity comparison is behaviour- preserving for these singletons while clearing ruff E721/E712. No isinstance() conversion is used: it would change semantics by accepting subclasses, which none of these sites intend.
ThomasLecocq
requested review from
crotwell,
d-chambers,
jkmacc-LANL,
johnrudge and
trichter
as code owners
September 1, 2026 13:19
ThomasLecocq
removed request for
crotwell,
d-chambers,
jkmacc-LANL,
johnrudge and
trichter
September 1, 2026 13:19
This file contains hidden or 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
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.
Replace
==/!=comparisons against type and class objects withis/is notacross source and tests, and drop the redundantTrue ==in two SEGY roundtrip assertions.The left operand in every case is already a type or class object (param_type, convert_to, quantity_type, parsed WADL parameter types, warning
.categoryclasses), so identity comparison is behaviour- preserving for these singletons while clearing ruff E721/E712.No isinstance() conversion is used: it would change semantics by accepting subclasses, which none of these sites intend.
AI used?
DJ Claude
PR Checklist
masterfor new features,maintenance_?.?.xfor bug fixesready for reviewlabel when you the PR is ready to be reviewed