Skip to content

v1.1.0: rule CS008: context managers

Choose a tag to compare

@mytestopia mytestopia released this 20 Mar 06:27
· 3 commits to main since this release
03eac16

New rule CS008: nested "with" statements of the same type should be comma-separated

❌ Anti-pattern

with method1(arg) as variable1:
    with method2(arg) as variable2:
        with method3(arg) as variable3:
            do_something(...)

✅ Best practice

with (
    method1(arg) as variable1,
    method2(arg) as variable2,
    method3(arg) as variable3,
):
    do_something(...)

https://github.com/mytestopia/flake8-qa-style/blob/main/rules/CS008.md