Repository navigation
Infer NumPy Generator.integers result shapes - #5652
AlessandroRuggiero wants to merge 1 commit into
Conversation
stroxler
left a comment
There was a problem hiding this comment.
Would you mind rebasing?
After the rename to pyrefly-org/pyrefly on Friday, our auto-import jobs paused; they seem to be working again so a rebase should get imported and I should be able to review/merge quicker.
AI review also flagged that some of these overloads may benefit from our IntTupleOrList[Shape] which can allow us to bind shapes from list literals (an actual list inevitably results in a gradual shape, that's harder to change).
|
✅ This PR meets all requirements from our pull request checklist. Optional recommendations:
Note: this comment updates automatically after changes to the PR. Updates may take up to half an hour. |
dae2324 to
3327090
Compare
|
@stroxler done |
|
This pull request has been imported. If you are a Meta employee, you can view this in D132604672. (Because this pull request was imported automatically, there will not be any future comments.) |
|
This pull request has been merged in 90f0548. |
Same pattern as #5619:
rng.integersnow returnssize's shape, or withoutsizethe broadcast shape of arraylow/high. The dtype is kept (int64by default, or e.g.np.int32/np.bool_), using a TypeVar default so one set of overloads covers both.Test Plan
Added tests to
tensor-shapes/pyrefly-numpy-stubs/test/test_random.pycovering scalar results, int, tuple, list and symbolicsize, explicit dtypes, array bounds with and withoutsize, and mismatched bounds.Ran:
python3 tensor-shapes/pyrefly-numpy-stubs/run_pyrefly.py"$TENSOR_SHAPES_VENV/bin/python" tensor-shapes/pyrefly-numpy-stubs/run_runtime_tests.py./test.py --no-test --no-tensor-shapes --no-conformance --no-jsonschema --no-extension(formatting and lint)