Uh oh!
There was an error while loading. Please reload this page.
Refactor scale offset into dedicated helper functions. - #8449
Open
Jens Hedegaard Nielsen (jenshnielsen) wants to merge 2 commits into
Open
Refactor scale offset into dedicated helper functions.#8449Jens Hedegaard Nielsen (jenshnielsen) wants to merge 2 commits into
Jens Hedegaard Nielsen (jenshnielsen) wants to merge 2 commits into
Conversation
The scale and offset conversions assume a numeric data type and rely on catching TypeError, which does not fit the generic parameter data type. They were expressed inline, so the working variable was repeatedly narrowed to whatever the last branch assigned, and each step needed a suppression. Move them into four module level helpers that take and return Any. This keeps the arithmetic out of the generic class, deduplicates the iterable and scalar branches, and drops the suppressions in this file from 15 to 3. Also stop routing issuperset through __contains__, which ty cannot resolve on Self when the class type parameter has a bound.
Jens Hedegaard Nielsen (jenshnielsen)
requested a review
from a team
as a code ownerAugust 26, 2026 09:05
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@## main #8449 +/- ##
==========================================
+ Coverage 71.12% 71.14% +0.01%
==========================================
Files 305 305 Lines 31952 31960 +8 ==========================================
+ Hits 22725 22737 +12 + Misses 9227 9223 -4 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Cover the iterable branches of the set path helpers, the TypeError fallbacks and re-raise of the get path helpers, and add direct unit tests for the four module level helpers. Also add the missing tests for ParameterSet.issubset/issuperset. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: e8c5964a-6418-4d35-b69c-bb44dd727a3c
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 freeto 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.
The scale and offset conversions assume a numeric data type and rely on catching TypeError, which does not fit the generic parameter data type. They were expressed inline, so the working variable was repeatedly narrowed to whatever the last branch assigned, and each step needed a suppression.
Move them into four module level helpers that take and return Any. This keeps the arithmetic out of the generic class, deduplicates the iterable and scalar branches, and drops the suppressions in this file from 15 to 3.
Also stop routing issuperset through contains, which ty cannot resolve on Self when the class type parameter has a bound.
lifted from #8441