Repository navigation
Fix type-safety diagnostics in validate_implementations.py - #118
Merged
Merged
Conversation
run_fortran_amica returns None on several paths but was typed -> Dict; os/original_dir were possibly-unbound in except blocks since they were only assigned inside the try; load_eeglab_data's dtype default didn't match its own annotation.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #118 +/- ##
==========================================
+ Coverage 79.75% 79.76% +0.01%
==========================================
Files 14 14
Lines 2010 2011 +1
Branches 339 339
==========================================
+ Hits 1603 1604 +1
Misses 301 301
Partials 106 106
🚀 New features to boost your workflow:
|
Merged
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.
Closes #117.
run_fortran_amicareturnsNoneon several early-exit paths but was typed-> Dict; retyped-> Optional[Dict]to match reality (callers alreadyhandle
Optional[Dict]viacompare_results).os/original_dirwere only assigned inside thetry:block but read inthe
except:branches (possibly-unbound); hoistedimport osto thetop-level imports and
original_dir = os.getcwd()before thetry:.load_eeglab_data'sdtype: np.dtype = np.float32default didn't match itsown annotation (
np.float32is a scalar type, not annp.dtypeinstance);widened to
npt.DTypeLike.Verified false positives, left as-is: the
torch/scipy.optimize"could notbe resolved" diagnostics are a Pyright/IDE environment issue -- both resolve
and import fine at runtime (
uv run python -c "import torch, scipy").Test plan
uv run ty check validate_implementations.py pyAMICA/torch_impl/utils.pypassesuv run ruff check/ruff format --checkpassuv run pytest pyAMICA/tests/test_fortran_adapter.py pyAMICA/tests/torch_tests/test_ng_utils.pypasses (20 passed, 3 skipped)