Add pyrefly suppressions to torch/distributed (7/n) (#165002)

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

One more PR after this one.

Test plan:
dmypy restart && python3 scripts/lintrunner.py -a
pyrefly check

step 1: delete lines in the pyrefly.toml file from the project-excludes field
step 2: run pyrefly check
step 3: add suppressions, clean up unused suppressions
before: https://gist.github.com/maggiemoss/4b3bf2037014e116bc00706a16aef199

after:
INFO 0 errors (6,884 ignored)

Pull Request resolved: https://github.com/pytorch/pytorch/pull/165002
Approved by: https://github.com/oulgen
This commit is contained in:
Maggie Moss
2025-10-09 04:08:21 +00:00
committed by PyTorch MergeBot
parent ab94a0d544
commit 7457d139c5
100 changed files with 354 additions and 24 deletions

View File

@ -93,6 +93,7 @@ def _rendezvous_helper(url: str, rank: int, world_size_opt: Optional[int], **kwa
result = result._replace(
query=f"{'&'.join([f'{k}={v}' for k, v in query_dict.items()])}"
)
# pyrefly: ignore # bad-assignment
url = urlunparse(result)
if result.scheme not in _rendezvous_handlers:
@ -110,6 +111,7 @@ def rendezvous(url: str, rank: int = -1, world_size: int = -1, **kwargs):
if not isinstance(world_size, numbers.Integral):
raise RuntimeError(f"`world_size` must be an integer. {world_size}")
# pyrefly: ignore # bad-argument-type
return _rendezvous_helper(url, rank, world_size, **kwargs)