-
Notifications
You must be signed in to change notification settings - Fork 95
🔧 mypy
type check wsicore
#935
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #935 +/- ##
========================================
Coverage 99.69% 99.69%
========================================
Files 71 71
Lines 8934 8939 +5
Branches 1171 1170 -1
========================================
+ Hits 8907 8912 +5
Misses 23 23
Partials 4 4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Pin tifffile <=v2025.5.10 |
for more information, see https://pre-commit.ci
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Enable strict mypy
type checking in the tiatoolbox/wsicore
package by refining type hints, default values, and adding missing tests.
- Refined
wsimeta.py
with explicit imports, default fallbacks, and enforced return types - Enhanced
metadata/ngff.py
by adding__iter__
toMultiscales
and tighteningWindow
field types - Added tests for non-tiled TIFF detection and
Multiscales
iteration; updated CI to include new files in mypy checks
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
tiatoolbox/wsicore/wsimeta.py | Added cast , defaulted level_downsamples , explicit returns, and refactored scale logic for typing |
tiatoolbox/wsicore/metadata/ngff.py | Implemented __iter__ on Multiscales , changed Window fields to int |
tests/test_wsireader.py | New test_is_not_tiled_tiff to cover non-tiled TIFF cases |
tests/test_meta_ngff_dataclasses.py | New test for Multiscales iteration order |
.github/workflows/mypy-type-check.yml | Included wsicore files and directories in mypy job |
Comments suppressed due to low confidence (2)
tiatoolbox/wsicore/wsimeta.py:124
- A default list of [1.0] is used when
level_downsamples
is None, but there are no tests verifying this fallback. Consider adding tests for this scenario.
else [1.0]
tiatoolbox/wsicore/wsimeta.py:275
- The name 'Resolution' is not imported or defined, causing a NameError. Consider importing or defining the 'Resolution' type alias.
def np_pair(x: Resolution) -> np.ndarray:
# Conflicts: # .github/workflows/mypy-type-check.yml
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
for more information, see https://pre-commit.ci
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @Jiaqi-Lv
Fix typing for files in
tiatoolbox/wsicore/
tiatoolbox/wsicore/__init__.py
tiatoolbox/wsicore/wsimeta.py
tiatoolbox/wsicore/metadata/
Will work on
tiatoolbox/wsicore/wsireader.py
after #825