File tree 2 files changed +17
-14
lines changed
2 files changed +17
-14
lines changed Original file line number Diff line number Diff line change @@ -8,18 +8,9 @@ deliberately limited and rarely added. Previous formatting is taken into account
8
8
little as possible, with rare exceptions like the magic trailing comma. The coding style
9
9
used by _ Black_ can be viewed as a strict subset of PEP 8.
10
10
11
- _ Black_ reformats entire files in place. It doesn't reformat lines that contain
12
- ` # fmt: skip ` or blocks that start with ` # fmt: off ` and end with ` # fmt: on ` .
13
- ` # fmt: skip ` can be mixed with other pragmas/comments either with multiple comments
14
- (e.g. ` # fmt: skip # pylint # noqa ` ) or as a semicolon separated list (e.g.
15
- ` # fmt: skip; pylint; noqa ` ). ` # fmt: on/off ` must be on the same level of indentation
16
- and in the same block, meaning no unindents beyond the initial indentation level between
17
- them. It also recognizes [ YAPF] ( https://github.com/google/yapf ) 's block comments to the
18
- same effect, as a courtesy for straddling code.
19
-
20
- The rest of this document describes the current formatting style. If you're interested
21
- in trying out where the style is heading, see [ future style] ( ./future_style.md ) and try
22
- running ` black --preview ` .
11
+ This document describes the current formatting style. If you're interested in trying out
12
+ where the style is heading, see [ future style] ( ./future_style.md ) and try running
13
+ ` black --preview ` .
23
14
24
15
### How _ Black_ wraps lines
25
16
Original file line number Diff line number Diff line change @@ -12,7 +12,8 @@ _Black_ is a well-behaved Unix-style command-line tool:
12
12
13
13
## Usage
14
14
15
- To get started right away with sensible defaults:
15
+ _ Black_ will reformat entire files in place. To get started right away with sensible
16
+ defaults:
16
17
17
18
``` sh
18
19
black {source_file_or_directory}
@@ -24,6 +25,17 @@ You can run _Black_ as a package if running it as a script doesn't work:
24
25
python -m black {source_file_or_directory}
25
26
```
26
27
28
+ ### Ignoring sections
29
+
30
+ Black will not reformat lines that contain ` # fmt: skip ` or blocks that start with
31
+ ` # fmt: off ` and end with ` # fmt: on ` . ` # fmt: skip ` can be mixed with other
32
+ pragmas/comments either with multiple comments (e.g. ` # fmt: skip # pylint # noqa ` ) or
33
+ as a semicolon separated list (e.g. ` # fmt: skip; pylint; noqa ` ). ` # fmt: on/off ` must
34
+ be on the same level of indentation and in the same block, meaning no unindents beyond
35
+ the initial indentation level between them. Black also recognizes
36
+ [ YAPF] ( https://github.com/google/yapf ) 's block comments to the same effect, as a
37
+ courtesy for straddling code.
38
+
27
39
### Command line options
28
40
29
41
The CLI options of _ Black_ can be displayed by running ` black --help ` . All options are
@@ -191,7 +203,7 @@ All done! ✨ 🍰 ✨
191
203
192
204
Show (or do not show) colored diff. Only applies when ` --diff ` is given.
193
205
194
- ### ` --line-ranges `
206
+ #### ` --line-ranges `
195
207
196
208
When specified, _ Black_ will try its best to only format these lines.
197
209
You can’t perform that action at this time.
0 commit comments