Add initial suppressions for pyrefly (#164177)

Adds suppressions to pyrefly will typecheck clean: https://github.com/pytorch/pytorch/issues/163283

Test plan:
`python3 scripts/lintrunner.py`
`pyrefly check`

---

Pyrefly check before: https://gist.github.com/maggiemoss/3a0aa0b6cdda0e449cd5743d5fce2c60
After:

```
 INFO Checking project configured at `/Users/maggiemoss/python_projects/pytorch/pyrefly.toml`
 INFO 0 errors (1,063 ignored)
```

Pull Request resolved: https://github.com/pytorch/pytorch/pull/164177
Approved by: https://github.com/Lucaskabela
This commit is contained in:
Maggie Moss
2025-10-02 20:57:37 +00:00
committed by PyTorch MergeBot
parent 6b7970192f
commit 5f18f240de
38 changed files with 170 additions and 75 deletions

View File

@ -406,7 +406,7 @@ class ViewBufferFromNested(torch.autograd.Function):
# Not actually a view!
class ViewNestedFromBuffer(torch.autograd.Function):
@staticmethod
def forward(
def forward( # pyrefly: ignore # bad-override
ctx,
values: torch.Tensor,
offsets: torch.Tensor,

View File

@ -46,11 +46,14 @@ def _outer_to_inner_dim(ndim, dim, ragged_dim, canonicalize=False):
if canonicalize:
dim = canonicalize_dims(ndim, dim)
assert dim >= 0 and dim < ndim
assert dim >= 0 and dim < ndim # pyrefly: ignore # unsupported-operation
# Map dim=0 (AKA batch dim) -> packed dim i.e. outer ragged dim - 1.
# For other dims, subtract 1 to convert to inner space.
return ragged_dim - 1 if dim == 0 else dim - 1
return (
# pyrefly: ignore # unsupported-operation
ragged_dim - 1 if dim == 0 else dim - 1
)
def _wrap_jagged_dim(
@ -2005,6 +2008,7 @@ def index_put_(func, *args, **kwargs):
else:
lengths = inp.lengths()
torch._assert_async(
# pyrefly: ignore # no-matching-overload
torch.all(indices[inp._ragged_idx] < lengths),
"Some indices in the ragged dimension are out of bounds!",
)