More ruff SIM fixes (#164695)

This PR applies ruff `SIM` rules to more files. Most changes are about simplifying `dict.get` because `None` is already the default value.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/164695
Approved by: https://github.com/ezyang
This commit is contained in:
Yuanyuan Chen
2025-10-09 03:24:46 +00:00
committed by PyTorch MergeBot
parent 54ae61c573
commit a029675f6f
49 changed files with 153 additions and 117 deletions

View File

@ -127,7 +127,7 @@ class TestVisibleDeviceParses(TestCase):
_transform_uuid_to_ordinals(["GPU-e4", "GPU-9e8d35e3"], uuids), [2, 1]
)
self.assertEqual(
_transform_uuid_to_ordinals("GPU-9e8d35e3,GPU-1,GPU-47".split(","), uuids),
_transform_uuid_to_ordinals(["GPU-9e8d35e3", "GPU-1", "GPU-47"], uuids),
[1, 7, 5],
)
# First invalid UUID aborts parsing