Repository navigation
Annotate every function in the package and its tests - #68
Merged
Merged
Conversation
Thirteen functions in the package had none: the bodies of the clipping kernel that `build()` compiles for each target, the three CUDA kernels, the host's `_jit()`, and a few return types (`sign()`, `index_in_bounds()`, `ndarray_linear_interpolation()`, `_calc_and_save_weights()`, and `fill()`'s `**kwargs`). Device arrays are annotated as `Any`, as they already are where they are passed in, since `numba` ships no type for them. In the tests, every test function now returns `-> None`, and the helpers and the parameters of parametrized tests are annotated. The tests are still excluded from the type check, but with a configuration that includes them these annotations add no errors and remove 46 of the 127 already there. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GqceVSp8s2msxj1Dr9MrGU
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #68 +/- ##
=======================================
Coverage 99.62% 99.62%
=======================================
Files 55 55
Lines 3188 3192 +4
=======================================
+ Hits 3176 3180 +4
Misses 12 12
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Adds type annotations to every function in the package and its tests that was missing them. There are no behavior changes.
Package (13 functions)
area_signed,num_pairandclip_cell, whichbuild()compiles for each target. They now match the module-level helpers beside them, which were already annotated._fill,_scatter,count_cellsandclip_cells. Device arrays are annotated asAny, as they already are where the host passes them in, because numba ships no type forDeviceNDArray._jit()in the clipping kernel.**kwargs:sign() -> int,index_in_bounds() -> bool,ndarray_linear_interpolation() -> np.ndarray,_calc_and_save_weights() -> None, andfill(**kwargs: Any).Numba ignores annotations, so the compiled kernels are unchanged.
Tests (154 functions)
-> None: added to every test function (133, done mechanically)._grids,_lattice,_flat,_triple,dense,totals, ...) are annotated by hand.dtype,func,unit).Checks
regridding/without full annotations.pyproject.toml, and pyright skips an excluded file even when it is named on the command line. I therefore checked them with a temporary config that includes them:main: 127 errors.astropyunit expressions and keyword arguments collected withdict(...)and splatted.convolve_weights()to fold a point-spread function into a set of weights #67 is clean, and the merged tree is fully annotated with its tests passing.🤖 Generated with Claude Code
https://claude.ai/code/session_01GqceVSp8s2msxj1Dr9MrGU