ruff/crates/ruff_python_formatter/src/statement
Charlie Marsh b1c4c7be69
Add trailing comma for single-element import-from groups (#6583)
## Summary

Unlike other statements, Black always adds a trailing comma if an
import-from statement breaks with a single import member. I believe this
is for compatibility with isort -- see
09f5ee3a19,
https://github.com/psf/black/issues/127, or
66648c528a/src/black/linegen.py (L1452)
for the current version.

## Test Plan

`cargo test`, notice that a big chunk of the compatibility suite is
removed.

Before:

| project      | similarity index |
|--------------|------------------|
| cpython      | 0.75472          |
| django       | 0.99804          |
| transformers | 0.99618          |
| twine        | 0.99876          |
| typeshed     | 0.74233          |
| warehouse    | 0.99601          |
| zulip        | 0.99727          |

After:

| project      | similarity index |
|--------------|------------------|
| cpython      | 0.75472          |
| django       | 0.99804          |
| transformers | 0.99618          |
| twine        | 0.99876          |
| typeshed     | 0.74260          |
| warehouse    | 0.99601          |
| zulip        | 0.99727          |
2023-08-15 07:15:33 -04:00
..
mod.rs Remove Stmt::TryStar (#6566) 2023-08-14 13:39:44 -04:00
stmt_ann_assign.rs Pull in RustPython parser (#6099) 2023-07-27 09:29:11 +00:00
stmt_assert.rs Pull in RustPython parser (#6099) 2023-07-27 09:29:11 +00:00
stmt_assign.rs Avoid omitting optional parentheses for argument-less parentheses (#6484) 2023-08-11 17:58:42 +00:00
stmt_aug_assign.rs Pull in RustPython parser (#6099) 2023-07-27 09:29:11 +00:00
stmt_break.rs Pull in RustPython parser (#6099) 2023-07-27 09:29:11 +00:00
stmt_class_def.rs Refactor and rename skip_trailing_trivia (#6312) 2023-08-04 13:30:53 +00:00
stmt_continue.rs Pull in RustPython parser (#6099) 2023-07-27 09:29:11 +00:00
stmt_delete.rs Pull in RustPython parser (#6099) 2023-07-27 09:29:11 +00:00
stmt_expr.rs Pull in RustPython parser (#6099) 2023-07-27 09:29:11 +00:00
stmt_for.rs Remove async AST node variants for with, for, and def (#6369) 2023-08-07 16:36:02 +00:00
stmt_function_def.rs Allow return type annotations to use their own parentheses (#6436) 2023-08-11 18:19:21 +00:00
stmt_global.rs Break global and nonlocal statements over continuation lines (#6172) 2023-08-02 19:55:00 +00:00
stmt_if.rs Pull in RustPython parser (#6099) 2023-07-27 09:29:11 +00:00
stmt_import.rs Pull in RustPython parser (#6099) 2023-07-27 09:29:11 +00:00
stmt_import_from.rs Add trailing comma for single-element import-from groups (#6583) 2023-08-15 07:15:33 -04:00
stmt_ipy_escape_command.rs fmt: off..on suppression comments (#6477) 2023-08-14 15:57:36 +00:00
stmt_match.rs Add formatting for MatchCase (#6360) 2023-08-11 19:20:25 +05:30
stmt_nonlocal.rs Break global and nonlocal statements over continuation lines (#6172) 2023-08-02 19:55:00 +00:00
stmt_pass.rs Pull in RustPython parser (#6099) 2023-07-27 09:29:11 +00:00
stmt_raise.rs Pull in RustPython parser (#6099) 2023-07-27 09:29:11 +00:00
stmt_return.rs Pull in RustPython parser (#6099) 2023-07-27 09:29:11 +00:00
stmt_try.rs Remove Stmt::TryStar (#6566) 2023-08-14 13:39:44 -04:00
stmt_type_alias.rs Add formatting of type alias statements (#6162) 2023-08-02 20:40:32 +00:00
stmt_while.rs Pull in RustPython parser (#6099) 2023-07-27 09:29:11 +00:00
stmt_with.rs Handle comments on open parentheses in with statements (#6515) 2023-08-14 15:11:03 +00:00
suite.rs Use one line between top-level items if formatting a stub file (#6501) 2023-08-15 09:33:57 +02:00