Repository navigation
Conversation
`SentenceTransformer.encode` is overloaded, and with no conversion arguments pyrefly resolves the call to the overload that returns `Tensor`. The `embedder` wrapper is annotated as returning `np.ndarray`, so `pyrefly check examples/**/*.py` fails with `bad-return`. Pass `convert_to_numpy=True` explicitly. That is already the runtime default, so behaviour is unchanged, and it selects the overload that returns `np.ndarray`.
This branch has not been deployed
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.
The
Test examplesworkflow has failed on every push tomainsince the Concordia Island example was added on 2026-10-06, and it fails on every open PR for the same reason. The failing step is "Typecheck examples":Cause
SentenceTransformer.encodeis overloaded. Called with no conversion arguments, pyrefly resolves it to the first overload, which returnsTensor. At runtime the default isconvert_to_numpy=True, so the function does return annp.ndarray; only the static type is wrong.Fix
Pass
convert_to_numpy=Trueexplicitly. That matches the runtime default, so behaviour does not change, and it selects the overload that returnsnp.ndarray.Validation
Python 3.14 with the versions pinned in
requirements.txt(pyrefly 1.2.0, sentence-transformers 5.6.1, torch 2.14.0, numpy 2.4.6):pyrefly check examples/concordia_island/run.py: 1 error onmain, 0 with this change.pyrefly check examples/**/*.py: thebad-returnerror above is gone. I could not get a fully clean local run of the whole glob because my environment did not have every example dependency installed, so the CI run on this PR is the real check.pylint --errors-only examples/concordia_island/run.py: clean.