Skip to content

Commit

Permalink
dont wrap simple assignments
Browse files Browse the repository at this point in the history
Signed-off-by: cobalt <61329810+cobaltt7@users.noreply.github.com>
  • Loading branch information
cobaltt7 committed Dec 16, 2024
1 parent 6890753 commit 7e80b09
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
4 changes: 1 addition & 3 deletions src/black/const.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
DEFAULT_LINE_LENGTH = 88
DEFAULT_EXCLUDES = (
r"/(\.direnv|\.eggs|\.git|\.hg|\.ipynb_checkpoints|\.mypy_cache|\.nox|\.pytest_cache|\.ruff_cache|\.tox|\.svn|\.venv|\.vscode|__pypackages__|_build|buck-out|build|dist|venv)/" # noqa: B950
)
DEFAULT_EXCLUDES = r"/(\.direnv|\.eggs|\.git|\.hg|\.ipynb_checkpoints|\.mypy_cache|\.nox|\.pytest_cache|\.ruff_cache|\.tox|\.svn|\.venv|\.vscode|__pypackages__|_build|buck-out|build|dist|venv)/" # noqa: B950
DEFAULT_INCLUDES = r"(\.pyi?|\.ipynb)$"
STDIN_PLACEHOLDER = "__BLACK_STDIN_FILENAME__"
18 changes: 12 additions & 6 deletions src/black/linegen.py
Original file line number Diff line number Diff line change
Expand Up @@ -982,12 +982,18 @@ def _maybe_split_omitting_optional_parens(
if line.is_chained_assignment:
pass

# elif not can_be_split(rhs.body) and not is_line_short_enough(
# rhs.body, mode=mode
# ):
# raise CannotSplit(
# "Splitting failed, body is still too long and can't be split."
# ) from e
elif (
not can_be_split(rhs.body)
and not is_line_short_enough(rhs.body, mode=mode)
and not (
rhs.opening_bracket.parent
and rhs.opening_bracket.parent.parent
and rhs.opening_bracket.parent.parent.type == syms.dictsetmaker
)
):
raise CannotSplit(
"Splitting failed, body is still too long and can't be split."
) from e

elif (
rhs.head.contains_multiline_strings()
Expand Down

0 comments on commit 7e80b09

Please sign in to comment.