Skip to content

Commit 9728b8e

Browse files
Move hug_parens_with_braces_and_square_brackets into the unstable style (psf#4198)
Primarily because of psf#4036 (a crash) but also because of the feedback in psf#4098 and psf#4099.
1 parent 2623269 commit 9728b8e

File tree

5 files changed

+9
-4
lines changed

5 files changed

+9
-4
lines changed

CHANGES.md

+3
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414

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

17+
- Move the `hug_parens_with_braces_and_square_brackets` feature to the unstable style
18+
due to an outstanding crash and proposed formatting tweaks (#4198)
19+
1720
### Configuration
1821

1922
- _Black_ now ignores `pyproject.toml` that is missing a `tool.black` section when

docs/the_black_code_style/future_style.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ Currently, the following features are included in the preview style:
2424
strings
2525
- `unify_docstring_detection`: fix inconsistencies in whether certain strings are
2626
detected as docstrings
27-
- `hug_parens_with_braces_and_square_brackets`: more compact formatting of nested
28-
brackets ([see below](labels/hug-parens))
2927
- `no_normalize_fmt_skip_whitespace`: whitespace before `# fmt: skip` comments is no
3028
longer normalized
3129
- `typed_params_trailing_comma`: consistently add trailing commas to typed function
@@ -41,6 +39,8 @@ The unstable style additionally includes the following features:
4139
([see below](labels/wrap-long-dict-values))
4240
- `multiline_string_handling`: more compact formatting of expressions involving
4341
multiline strings ([see below](labels/multiline-string-handling))
42+
- `hug_parens_with_braces_and_square_brackets`: more compact formatting of nested
43+
brackets ([see below](labels/hug-parens))
4444

4545
(labels/hug-parens)=
4646

src/black/mode.py

+2
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,8 @@ class Preview(Enum):
186186
Preview.wrap_long_dict_values_in_parens,
187187
# See issue #4159
188188
Preview.multiline_string_handling,
189+
# See issue #4036 (crash), #4098, #4099 (proposed tweaks)
190+
Preview.hug_parens_with_braces_and_square_brackets,
189191
}
190192

191193

tests/data/cases/preview_hug_parens_with_braces_and_square_brackets.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# flags: --preview
1+
# flags: --unstable
22
def foo_brackets(request):
33
return JsonResponse(
44
{

tests/data/cases/preview_hug_parens_with_braces_and_square_brackets_no_ll1.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# flags: --preview --no-preview-line-length-1
1+
# flags: --unstable --no-preview-line-length-1
22
# split out from preview_hug_parens_with_brackes_and_square_brackets, as it produces
33
# different code on the second pass with line-length 1 in many cases.
44
# Seems to be about whether the last string in a sequence gets wrapped in parens or not.

0 commit comments

Comments
 (0)