Skip to content

Upgrade mypy 1.17 - #479

Merged
alifbe merged 1 commit into
mainfrom
upgrade-mypy-1.17
Jul 16, 2025
Merged

Upgrade mypy 1.17#479
alifbe merged 1 commit into
mainfrom
upgrade-mypy-1.17

Conversation

@alifbe

@alifbe alifbe commented Jul 16, 2025

Copy link
Copy Markdown
Collaborator

mypy 1.17 failed to infer pyscal_obj type when the type is stored as variable.

@codecov-commenter

codecov-commenter commented Jul 16, 2025

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.75%. Comparing base (2a01b1c) to head (07e1193).
⚠️ Report is 37 commits behind head on main.

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.
📢 Have feedback on the report? Share it here.

@alifbe
alifbe marked this pull request as ready for review July 16, 2025 07:24
@alifbe
alifbe requested review from a team and Copilot July 16, 2025 07:24

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_OBJECTS list constant.
  • Replaced tuple(PYSCAL_OBJECTS) with an inline tuple of classes in the append method.
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 PyscalObjects type alias and the isinstance check to avoid duplication and keep checks in sync.
    getLogger_pyscal,

Comment thread src/pyscal/pyscallist.py Outdated
if not isinstance(pyscal_obj, tuple(PYSCAL_OBJECTS)):
if not isinstance(
pyscal_obj,
tuple([WaterOil, GasOil, GasWater, WaterOilGas, SCALrecommendation]),

Copilot AI Jul 16, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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),

Copilot uses AI. Check for mistakes.
@alifbe
alifbe force-pushed the upgrade-mypy-1.17 branch from f4d10da to 07e1193 Compare July 16, 2025 07:53
@alifbe
alifbe merged commit dfeb5aa into main Jul 16, 2025
8 checks passed
@alifbe
alifbe deleted the upgrade-mypy-1.17 branch July 16, 2025 09:34
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.

4 participants