[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

@ -815,9 +815,10 @@ def _is_fp(value) -> bool:
def _is_bool(value) -> bool:
return _type_utils.JitScalarType.from_value(
value, _type_utils.JitScalarType.UNDEFINED
) in {_type_utils.JitScalarType.BOOL}
return (
_type_utils.JitScalarType.from_value(value, _type_utils.JitScalarType.UNDEFINED)
== _type_utils.JitScalarType.BOOL
)
def _generate_wrapped_number(g: jit_utils.GraphContext, scalar):