Summary
https://docs.astral.sh/ruff/rules/too-many-statements-in-try-clause/
Sometimes, it is easier to write try-finally clauses instead of context managers. Especially if the object is not a context manager, or we need to do other clean-up steps than session.close(). Anyway, this rule should not be triggered on a try-finally clause
session = ...
try:
print()
print()
print()
print()
print()
print()
finally:
session.close()
Playground
Version
0.15.14
Summary
https://docs.astral.sh/ruff/rules/too-many-statements-in-try-clause/
Sometimes, it is easier to write
try-finallyclauses instead of context managers. Especially if the object is not a context manager, or we need to do other clean-up steps thansession.close(). Anyway, this rule should not be triggered on a try-finally clausePlayground
Version
0.15.14