22
33## Code style
44
5- _ Black_ reformats entire files in place. Style configuration options are deliberately
6- limited and rarely added. It doesn't take previous formatting into account, except for
7- the magic trailing comma and preserving newlines. It doesn't reformat blocks that start
8- with ` # fmt: off ` and end with ` # fmt: on ` , or lines that ends with ` # fmt: skip ` .
5+ _ Black_ aims for consistency, generality, readability and reducing git diffs. Similar
6+ language constructs are formatted with similar rules. Style configuration options are
7+ deliberately limited and rarely added. Previous formatting is taken into account as
8+ little as possible, with rare exceptions like the magic trailing comma. The coding style
9+ used by _ Black_ can be viewed as a strict subset of PEP 8.
10+
11+ _ Black_ reformats entire files in place. It doesn't reformat blocks that start with
12+ ` # fmt: off ` and end with ` # fmt: on ` , or lines that ends with ` # fmt: skip ` .
913` # fmt: on/off ` have to be on the same level of indentation. It also recognizes
1014[ YAPF] ( https://github.com/google/yapf ) 's block comments to the same effect, as a
1115courtesy for straddling code.
@@ -18,8 +22,7 @@ running `black --preview`.
1822
1923_ Black_ ignores previous formatting and applies uniform horizontal and vertical
2024whitespace to your code. The rules for horizontal whitespace can be summarized as: do
21- whatever makes ` pycodestyle ` happy. The coding style used by _ Black_ can be viewed as a
22- strict subset of PEP 8.
25+ whatever makes ` pycodestyle ` happy.
2326
2427As for vertical whitespace, _ Black_ tries to render one full expression or simple
2528statement per line. If this fits the allotted line length, great.
0 commit comments