@@ -50,27 +50,71 @@ limit. Line continuation backslashes are converted into parenthesized strings.
5050Unnecessary parentheses are stripped. The stability and status of this feature is
5151tracked in [ this issue] ( https://github.com/psf/black/issues/2188 ) .
5252
53- ### Removing trailing newlines after code block open
53+ ### Removing newlines in the beginning of code blocks
5454
55- _ Black_ will remove trailing newlines after code block openings. That means that the
56- following code :
55+ _ Black_ will remove newlines in the beginning of new code blocks, i.e. when the
56+ indentation level is increased. For example :
5757
5858``` python
5959def my_func ():
6060
6161 print (" The line above me will be deleted!" )
62-
63- print (" But the line above me won't!" )
6462```
6563
66- Will be changed to:
64+ will be changed to:
6765
6866``` python
6967def my_func ():
7068 print (" The line above me will be deleted!" )
71-
72- print (" But the line above me won't!" )
7369```
7470
7571This new feature will be applied to ** all code blocks** : ` def ` , ` class ` , ` if ` , ` for ` ,
7672` while ` , ` with ` , ` case ` and ` match ` .
73+
74+ ### Improved parentheses management
75+
76+ _ Black_ will format parentheses around return annotations similarly to other sets of
77+ parentheses. For example:
78+
79+ ``` python
80+ def foo () -> (int ):
81+ ...
82+
83+ def foo () -> looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong:
84+ ...
85+ ```
86+
87+ will be changed to:
88+
89+ ``` python
90+ def foo () -> int :
91+ ...
92+
93+
94+ def foo () -> (
95+ looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong
96+ ):
97+ ...
98+ ```
99+
100+ And, extra parentheses in ` await ` expressions and ` with ` statements are removed. For
101+ example:
102+
103+ ``` python
104+ with ((open (" bla.txt" )) as f, open (" x" )):
105+ ...
106+
107+ async def main ():
108+ await (asyncio.sleep(1 ))
109+ ```
110+
111+ will be changed to:
112+
113+ ``` python
114+ with open (" bla.txt" ) as f, open (" x" ):
115+ ...
116+
117+
118+ async def main ():
119+ await asyncio.sleep(1 )
120+ ```
0 commit comments