Debian Codegraph @

docs/configuration/multi_line_output_modes.md

raw
1 # Multi line output modes
2
3 This [config option](./options.md#multi-line-output) defines how from imports wrap when they extend past the line\_length
4 limit and has 12 possible settings:
5
6 ## 0 - Grid
7
8 ```python
9 from third_party import (lib1, lib2, lib3,
10 lib4, lib5, ...)
11 ```
12
13 ## 1 - Vertical
14
15 ```python
16 from third_party import (lib1,
17 lib2,
18 lib3
19 lib4,
20 lib5,
21 ...)
22 ```
23
24 ## 2 - Hanging Indent
25
26 ```python
27 from third_party import \
28 lib1, lib2, lib3, \
29 lib4, lib5, lib6
30 ```
31
32 ## 3 - Vertical Hanging Indent
33
34 ```python
35 from third_party import (
36 lib1,
37 lib2,
38 lib3,
39 lib4
40 )
41 ```
42
43 ## 4 - Hanging Grid
44
45 ```python
46 from third_party import (
47 lib1, lib2, lib3, lib4,
48 lib5, ...)
49 ```
50
51 ## 5 - Hanging Grid Grouped
52
53 ```python
54 from third_party import (
55 lib1, lib2, lib3, lib4,
56 lib5, ...
57 )
58 ```
59
60 ## 6 - Hanging Grid Grouped
61
62 Same as Mode 5. Deprecated.
63
64 ## 7 - NOQA
65
66 ```python
67 from third_party import lib1, lib2, lib3, ... # NOQA
68 ```
69
70 Alternatively, you can set `force_single_line` to `True` (`-sl` on the
71 command line) and every import will appear on its own line:
72
73 ```python
74 from third_party import lib1
75 from third_party import lib2
76 from third_party import lib3
77 ...
78 ```
79
80 ## 8 - Vertical Hanging Indent Bracket
81
82 Same as Mode 3 - _Vertical Hanging Indent_ but the closing parentheses
83 on the last line is indented.
84
85 ```python
86 from third_party import (
87 lib1,
88 lib2,
89 lib3,
90 lib4,
91 )
92 ```
93
94 ## 9 - Vertical Prefix From Module Import
95
96 Starts a new line with the same `from MODULE import` prefix when lines are longer than the line length limit.
97
98 ```python
99 from third_party import lib1, lib2, lib3
100 from third_party import lib4, lib5, lib6
101 ```
102
103 ## 10 - Hanging Indent With Parentheses
104
105 Same as Mode 2 - _Hanging Indent_ but uses parentheses instead of backslash
106 for wrapping long lines.
107
108 ```python
109 from third_party import (
110 lib1, lib2, lib3,
111 lib4, lib5, lib6)
112 ```
113
114 ## 11 - Backslash Grid
115
116 Same as Mode 0 - _Grid_ but uses backslashes instead of parentheses to group imports.
117
118 ```python
119 from third_party import lib1, lib2, lib3, \
120 lib4, lib5
121 ```