Upgrade mypy 1.17 - #479
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #479 +/- ##
==========================================
- Coverage 98.75% 98.75% -0.01%
==========================================
Files 17 17
Lines 2724 2723 -1
==========================================
- Hits 2690 2689 -1
Misses 34 34 ☔ View full report in Codecov by Sentry. |
alifbe
marked this pull request as ready for review
July 16, 2025 07:24
There was a problem hiding this comment.
Pull Request Overview
The PR addresses a mypy 1.17 inference issue by inlining the supported pyscal object types directly in the isinstance check instead of using a variable.
- Removed the
PYSCAL_OBJECTSlist constant. - Replaced
tuple(PYSCAL_OBJECTS)with an inline tuple of classes in theappendmethod.
Comments suppressed due to low confidence (1)
src/pyscal/pyscallist.py:15
- Consider defining a module-level tuple constant for supported pyscal object classes and reusing it for both the
PyscalObjectstype alias and theisinstancecheck to avoid duplication and keep checks in sync.
getLogger_pyscal,
| if not isinstance(pyscal_obj, tuple(PYSCAL_OBJECTS)): | ||
| if not isinstance( | ||
| pyscal_obj, | ||
| tuple([WaterOil, GasOil, GasWater, WaterOilGas, SCALrecommendation]), |
There was a problem hiding this comment.
Instead of calling tuple() on a list literal, use a tuple literal directly (WaterOil, GasOil, GasWater, WaterOilGas, SCALrecommendation) for better readability and slightly improved performance.
Suggested change
| tuple([WaterOil, GasOil, GasWater, WaterOilGas, SCALrecommendation]), | |
| (WaterOil, GasOil, GasWater, WaterOilGas, SCALrecommendation), |
mferrera
approved these changes
Jul 16, 2025
alifbe
force-pushed
the
upgrade-mypy-1.17
branch
from
July 16, 2025 07:53
f4d10da to
07e1193
Compare
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.
mypy 1.17 failed to infer
pyscal_objtype when the type is stored as variable.