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 with (open("bla.txt")):
4 with (open("bla.txt")), (open("bla.txt")):
7 with (open("bla.txt") as f):
10 # Remove brackets within alias expression
11 with (open("bla.txt")) as f:
14 # Remove brackets around one-line context managers
15 with (open("bla.txt") as f, (open("x"))):
18 with ((open("bla.txt")) as f, open("x")):
21 with (CtxManager1() as example1, CtxManager2() as example2):
24 # Brackets remain when using magic comma
25 with (CtxManager1() as example1, CtxManager2() as example2,):
28 # Brackets remain for multi-line context managers
29 with (CtxManager1() as example1, CtxManager2() as example2, CtxManager2() as example2, CtxManager2() as example2, CtxManager2() as example2):
32 # Don't touch assignment expressions
33 with (y := open("./test.py")) as f:
36 # Deeply nested examples
37 # N.B. Multiple brackets are only possible
38 # around the context manager itself.
39 # Only one brackets is allowed around the
40 # alias expression or comma-delimited context managers.
41 with (((open("bla.txt")))):
44 with (((open("bla.txt")))), (((open("bla.txt")))):
47 with (((open("bla.txt")))) as f:
50 with ((((open("bla.txt")))) as f):
53 with ((((CtxManager1()))) as example1, (((CtxManager2()))) as example2):
60 with open("bla.txt"), open("bla.txt"):
63 with open("bla.txt") as f:
66 # Remove brackets within alias expression
67 with open("bla.txt") as f:
70 # Remove brackets around one-line context managers
71 with open("bla.txt") as f, open("x"):
74 with open("bla.txt") as f, open("x"):
77 with CtxManager1() as example1, CtxManager2() as example2:
80 # Brackets remain when using magic comma
82 CtxManager1() as example1,
83 CtxManager2() as example2,
87 # Brackets remain for multi-line context managers
89 CtxManager1() as example1,
90 CtxManager2() as example2,
91 CtxManager2() as example2,
92 CtxManager2() as example2,
93 CtxManager2() as example2,
97 # Don't touch assignment expressions
98 with (y := open("./test.py")) as f:
101 # Deeply nested examples
102 # N.B. Multiple brackets are only possible
103 # around the context manager itself.
104 # Only one brackets is allowed around the
105 # alias expression or comma-delimited context managers.
106 with open("bla.txt"):
109 with open("bla.txt"), open("bla.txt"):
112 with open("bla.txt") as f:
115 with open("bla.txt") as f:
118 with CtxManager1() as example1, CtxManager2() as example2: