All patches and comments are welcome. Please squash your changes to logical
commits before using git-format-patch and git-send-email to
patches@git.madduck.net.
If you'd read over the Git project's submission guidelines and adhered to them,
I'd be especially grateful.
1 # flags: --minimum-version=3.9
2 with (open("bla.txt")):
5 with (open("bla.txt")), (open("bla.txt")):
8 with (open("bla.txt") as f):
11 # Remove brackets within alias expression
12 with (open("bla.txt")) as f:
15 # Remove brackets around one-line context managers
16 with (open("bla.txt") as f, (open("x"))):
19 with ((open("bla.txt")) as f, open("x")):
22 with (CtxManager1() as example1, CtxManager2() as example2):
25 # Brackets remain when using magic comma
26 with (CtxManager1() as example1, CtxManager2() as example2,):
29 # Brackets remain for multi-line context managers
30 with (CtxManager1() as example1, CtxManager2() as example2, CtxManager2() as example2, CtxManager2() as example2, CtxManager2() as example2):
33 # Don't touch assignment expressions
34 with (y := open("./test.py")) as f:
37 # Deeply nested examples
38 # N.B. Multiple brackets are only possible
39 # around the context manager itself.
40 # Only one brackets is allowed around the
41 # alias expression or comma-delimited context managers.
42 with (((open("bla.txt")))):
45 with (((open("bla.txt")))), (((open("bla.txt")))):
48 with (((open("bla.txt")))) as f:
51 with ((((open("bla.txt")))) as f):
54 with ((((CtxManager1()))) as example1, (((CtxManager2()))) as example2):
61 with open("bla.txt"), open("bla.txt"):
64 with open("bla.txt") as f:
67 # Remove brackets within alias expression
68 with open("bla.txt") as f:
71 # Remove brackets around one-line context managers
72 with open("bla.txt") as f, open("x"):
75 with open("bla.txt") as f, open("x"):
78 with CtxManager1() as example1, CtxManager2() as example2:
81 # Brackets remain when using magic comma
83 CtxManager1() as example1,
84 CtxManager2() as example2,
88 # Brackets remain for multi-line context managers
90 CtxManager1() as example1,
91 CtxManager2() as example2,
92 CtxManager2() as example2,
93 CtxManager2() as example2,
94 CtxManager2() as example2,
98 # Don't touch assignment expressions
99 with (y := open("./test.py")) as f:
102 # Deeply nested examples
103 # N.B. Multiple brackets are only possible
104 # around the context manager itself.
105 # Only one brackets is allowed around the
106 # alias expression or comma-delimited context managers.
107 with open("bla.txt"):
110 with open("bla.txt"), open("bla.txt"):
113 with open("bla.txt") as f:
116 with open("bla.txt") as f:
119 with CtxManager1() as example1, CtxManager2() as example2: