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

@ -60,7 +60,23 @@ class Variant(Enum):
DEFAULT_KERNEL_NAMESPACE = "at::native"
# NOTE: Keep the list in sync with `DispatchKey` in c10/core/DispatchKey.h
BACKEND_COMPONENTS = "CPU CUDA HIP XLA MTIA MPS IPU XPU HPU VE Lazy Meta PrivateUse1 PrivateUse2 PrivateUse3".split()
BACKEND_COMPONENTS = [
"CPU",
"CUDA",
"HIP",
"XLA",
"MTIA",
"MPS",
"IPU",
"XPU",
"HPU",
"VE",
"Lazy",
"Meta",
"PrivateUse1",
"PrivateUse2",
"PrivateUse3",
]
FUNCTIONALITY_KEYS = [
"",
"Quantized",