Conversation
Merging this PR will not alter performance
Comparing Footnotes
|
…ype ignore comments
mugulmd
force-pushed
the
typing-neighbors
branch
from
September 17, 2026 12:51
786fc52 to
e8e8c96
Compare
mugulmd
marked this pull request as ready for review
September 17, 2026 16:10
MaxHalford
reviewed
Sep 17, 2026
| if len(self) == self.maxlen: | ||
| neighbors, dists = self._search(node.item, self.graph_k, exclude={node.uuid}) | ||
| # neighbors, dists = self._search(node.item, self.graph_k, exclude={node.uuid}) | ||
| neighbors, dists = self._search(node.item, self.graph_k) |
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.
Description
Related to #1944
Implement strict typing for the
river.neighborspackage as it only depends on already strictly typed packages.Notes
In
SWINNthe_datafield was typed as sequence ofVertex | Nonehowever theNonevalue was only used to handle the "vertex replacement" occurring when adding a new vertex on a full sliding window. Using thisNoneintermediate value does not bring anything to the table, since the vertex being replaced is being isolated first.Therefore, in order to simplify the typing of the
SWINNclass and make the code more readable we made the_datafield a sequence ofVertexonly.Next steps
Currently all items considered for nearest neighbors queries are simply typed as
Any, which makes things simple considering the potential variety of item types to handle. However using generics instead would provide much more precise typing information. This would mean changing quite a lot in the package's interface, so it is left for later.