Summary
from contextlib import contextmanager
@contextmanager
def foo(items: list[int]):
for value in items:
yield # RUF075: Context manager does not catch exceptions
break
[lint]
preview = true
select = [ "RUF075" ]
Playground
as discussed in #15629 (comment) we wanted to avoid false positives when yield is the last statement, but it would be nice if it was also able to detect if there's a break statement right after it when the surrounding for loop is the last statement
Version
0.15.14
Summary
Playground
as discussed in #15629 (comment) we wanted to avoid false positives when
yieldis the last statement, but it would be nice if it was also able to detect if there's abreakstatement right after it when the surroundingforloop is the last statementVersion
0.15.14