add bracket check in split_line (#1315)
This commit is contained in:
parent
68a3c75eb2
commit
92c611cfdf
1
black.py
1
black.py
@ -2544,6 +2544,7 @@ def init_st(ST: Type[StringTransformer]) -> StringTransformer:
|
|||||||
is_line_short_enough(line, line_length=line_length, line_str=line_str)
|
is_line_short_enough(line, line_length=line_length, line_str=line_str)
|
||||||
or line.contains_unsplittable_type_ignore()
|
or line.contains_unsplittable_type_ignore()
|
||||||
)
|
)
|
||||||
|
and not (line.contains_standalone_comments() and line.inside_brackets)
|
||||||
):
|
):
|
||||||
# Only apply basic string preprocessing, since lines shouldn't be split here.
|
# Only apply basic string preprocessing, since lines shouldn't be split here.
|
||||||
transformers = [string_merge, string_paren_strip]
|
transformers = [string_merge, string_paren_strip]
|
||||||
|
@ -22,6 +22,11 @@
|
|||||||
|
|
||||||
|
|
||||||
# Some comment before a function.
|
# Some comment before a function.
|
||||||
|
y = 1
|
||||||
|
(
|
||||||
|
# some strings
|
||||||
|
y # type: ignore
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def function(default=None):
|
def function(default=None):
|
||||||
|
Loading…
Reference in New Issue
Block a user