proximity: add return annotations to allocation and direction#2719
Open
brendancol wants to merge 1 commit into
Open
proximity: add return annotations to allocation and direction#2719brendancol wants to merge 1 commit into
brendancol wants to merge 1 commit into
Conversation
allocation and direction now match proximity's -> xr.DataArray return annotation. Annotation only, no behavior change. Adds a parametrized test asserting the three siblings share the same return annotation.
brendancol
commented
May 29, 2026
Contributor
Author
brendancol
left a comment
There was a problem hiding this comment.
Domain-aware review (API-consistency sweep, proximity module).
Blockers: none.
Suggestions: none blocking. The annotation widens to match proximity's existing -> xr.DataArray, which is the right consistency target. Note that all three are wrapped by @supports_dataset and can return a Dataset, so a stricter xr.DataArray | xr.Dataset would be more precise. Matching the existing proximity annotation is the correct scope here; broadening all three is a separate call and out of scope for this PR.
Nits: none.
Verified:
inspect.signaturereportsxr.DataArrayfor all three functions (the@supports_datasetwrapper preserves the signature via functools.wraps), so the new test exercises the real public surface.- Annotation-only change; no runtime path touched. numpy / cupy / dask+numpy / dask+cupy behavior unchanged.
- New test and the proximity/allocation/direction default-behavior slice pass; flake8 reports no new findings on the changed files.
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 #2717
allocationanddirectionnow carry the same-> xr.DataArrayreturn annotation thatproximityalready has. The three functions share a signature and return type, so their annotations should match.inspect.signature.Backend coverage: unaffected (no runtime code changed). numpy / cupy / dask+numpy / dask+cupy paths are untouched.
Test plan:
pytest xrspatial/tests/test_proximity.py::test_return_annotation_consistency(3 passed)