Skip to content

Commit

Permalink
Move hug_parens_with_braces_and_square_brackets into the unstable style
Browse files Browse the repository at this point in the history
Primarily because of psf#4036 (a crash) but also because of the feedback
in psf#4098 and psf#4099.
  • Loading branch information
JelleZijlstra committed Jan 31, 2024
1 parent d6e11ca commit 89541d8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGES.md
Expand Up @@ -14,6 +14,9 @@

<!-- Changes that affect Black's preview style -->

- Move the `hug_parens_with_braces_and_square_brackets` feature to the unstable style
due to an outstanding crash and proposed formatting tweaks (#4198)

### Configuration

<!-- Changes to how Black can be configured -->
Expand Down
4 changes: 2 additions & 2 deletions docs/the_black_code_style/future_style.md
Expand Up @@ -22,8 +22,6 @@ Currently, the following features are included in the preview style:
strings
- `unify_docstring_detection`: fix inconsistencies in whether certain strings are
detected as docstrings
- `hug_parens_with_braces_and_square_brackets`: more compact formatting of nested
brackets ([see below](labels/hug-parens))
- `no_normalize_fmt_skip_whitespace`: whitespace before `# fmt: skip` comments is no
longer normalized
- `typed_params_trailing_comma`: consistently add trailing commas to typed function
Expand All @@ -39,6 +37,8 @@ The unstable style additionally includes the following features:
([see below](labels/wrap-long-dict-values))
- `multiline_string_handling`: more compact formatting of expressions involving
multiline strings ([see below](labels/multiline-string-handling))
- `hug_parens_with_braces_and_square_brackets`: more compact formatting of nested
brackets ([see below](labels/hug-parens))

(labels/hug-parens)=

Expand Down
4 changes: 4 additions & 0 deletions src/black/mode.py
Expand Up @@ -179,13 +179,17 @@ class Preview(Enum):
typed_params_trailing_comma = auto()


# See https://github.com/psf/black/issues?q=is%3Aissue+is%3Aopen+label%3A%22C%3A+preview+style%22
# for all open issues with the preview and unstable style.
UNSTABLE_FEATURES: Set[Preview] = {
# Many issues, see summary in https://github.com/psf/black/issues/4042
Preview.string_processing,
# See issues #3452 and #4158
Preview.wrap_long_dict_values_in_parens,
# See issue #4159
Preview.multiline_string_handling,
# See issue #4036 (crash), #4098, #4099 (proposed tweaks)
Preview.hug_parens_with_braces_and_square_brackets,
}


Expand Down

0 comments on commit 89541d8

Please sign in to comment.