Skip to content

Commit

Permalink
Merge pull request #1374 from sztamas/develop
Browse files Browse the repository at this point in the history
Complete documentation for multi line modes.
  • Loading branch information
timothycrosley committed Aug 12, 2020
2 parents 45fdfe5 + 4c3b8b8 commit 2e85489
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 2 deletions.
34 changes: 34 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,40 @@ from third_party import lib3
...
```

**8 - Vertical Hanging Indent Bracket**

Same as Mode 3 - _Vertical Hanging Indent_ but the closing parentheses
on the last line is indented.

```python
from third_party import (
lib1,
lib2,
lib3,
lib4,
)
```

**9 - Vertical Prefix From Module Import**

Starts a new line with the same `from MODULE import ` prefix when lines are longer than the line length limit.

```python
from third_party import lib1, lib2, lib3
from third_party import lib4, lib5, lib6
```

**10 - Hanging Indent With Parentheses**

Same as Mode 2 - _Hanging Indent_ but uses parentheses instead of backslash
for wrapping long lines.

```python
from third_party import (
lib1, lib2, lib3,
lib4, lib5, lib6)
```

Note: to change the how constant indents appear - simply change the
indent property with the following accepted formats:

Expand Down
2 changes: 1 addition & 1 deletion docs/configuration/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ known_airflow = ['airflow']

## Multi Line Output

Multi line output (0-grid, 1-vertical, 2-hanging, 3-vert-hanging, 4-vert-grid, 5-vert-grid-grouped, 6-vert-grid-grouped-no-comma).
Multi line output (0-grid, 1-vertical, 2-hanging, 3-vert-hanging, 4-vert-grid, 5-vert-grid-grouped, 6-vert-grid-grouped-no-comma, 7-noqa, 8-vertical-hanging-indent-bracket, 9-vertical-prefix-from-module-import, 10-hanging-indent-with-parentheses).

**Type:** Wrapmodes
**Default:** `WrapModes.GRID`
Expand Down
4 changes: 3 additions & 1 deletion isort/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,9 @@ def _build_arg_parser() -> argparse.ArgumentParser:
+ [str(mode.value) for mode in WrapModes.__members__.values()],
type=str,
help="Multi line output (0-grid, 1-vertical, 2-hanging, 3-vert-hanging, 4-vert-grid, "
"5-vert-grid-grouped, 6-vert-grid-grouped-no-comma).",
"5-vert-grid-grouped, 6-vert-grid-grouped-no-comma, 7-noqa, "
"8-vertical-hanging-indent-bracket, 9-vertical-prefix-from-module-import, "
"10-hanging-indent-with-parentheses).",
)
parser.add_argument(
"-n",
Expand Down

0 comments on commit 2e85489

Please sign in to comment.