[2/N] Simplify "in" operation for containers of a single item (#164323)

These issues are detected by ruff [FURB171](https://docs.astral.sh/ruff/rules/single-item-membership-test/#single-item-membership-test-furb171).

Pull Request resolved: https://github.com/pytorch/pytorch/pull/164323
Approved by: https://github.com/justinchuby, https://github.com/Skylion007
This commit is contained in:
Yuanyuan Chen
2025-10-01 05:39:11 +00:00
committed by PyTorch MergeBot
parent 96c3b9e275
commit cc8b14d09a
20 changed files with 50 additions and 42 deletions

View File

@ -3623,7 +3623,7 @@ class CheckFunctionManager:
# Leave out the builtins dict key, as we will special handle
# it later because the guarded code rarely use the entire
# builtin dict in the common case.
if name not in (builtins_dict_name,):
if name != builtins_dict_name:
used_global_vars.add(name)
elif name := get_local_source_name(source):
assert isinstance(name, str)