Enable PLC1802 on ruff (#165813)

This PR enables ruff check `PLC1802`, which detects len calls on sequences in a boolean test context.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/165813
Approved by: https://github.com/ezyang
This commit is contained in:
Yuanyuan Chen
2025-10-18 05:44:10 +00:00
committed by PyTorch MergeBot
parent aaac8cb0f5
commit e595136187
17 changed files with 23 additions and 24 deletions

View File

@ -1847,7 +1847,7 @@ class BuiltinVariable(VariableTracker):
polyfills.builtins.iter_
).call_function(tx, [obj, *args], {})
if len(args):
if args:
# iter(obj, sentinel) returns an object that implements
# __iter__ and __next__ methods (UserDefinedObjectVariable)
# Wrap the return value in a IteratorVariable subclass (LazyObjectIteratorVariable)