-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
how to comprehension black split []? #2566
Comments
That is not in fact how Black formats that code normally. Perhaps you have a very long key. Could you provide more details? |
here is detail box["property"] = LineItem(category, key, "table", value.page_index)
box["item"] = project_name
if project_name.value:
span = project_name.value.lines[
-1
]._LocationTextPart__location["spans"]
if span:
uniq_name = "{}_{}_{}".format(
project_name.value._LocationText__str,
project_name.value.lines[
-1
]._LocationTextPart__location["spans"][0]["bbox"][
0
],
project_name.value.lines[
-1
]._LocationTextPart__location["spans"][0]["bbox"][
1
],
) |
This seems like another example of: #2156 |
Indeed, and also related to #571 because of the dotted names, although I couldn't find an issue on the tracker that combines fluent interfaces with subscript access. I'd expect the formatting to be: if 1:
if 1:
if 1:
box["property"] = LineItem(category, key, "table", value.page_index)
box["item"] = project_name
if project_name.value:
span = (
project_name.value.lines[-1]
._LocationTextPart__location["spans"]
)
if span:
uniq_name = "{}_{}_{}".format(
project_name.value._LocationText__str,
(
project_name.value.lines[-1]
._LocationTextPart__location["spans"][0]["bbox"][0]
),
(
project_name.value.lines[-1]
._LocationTextPart__location["spans"][0]["bbox"][1]
),
) Since the last lines in the original example don't fit the line length, this is of course formatted further by exploding the subscripts. Sadly there isn't a fluent interface of subscripts. |
Describe the style change
i found black will split arr[1] to a wired format
Examples in the current Black style
Desired style
Additional context
The text was updated successfully, but these errors were encountered: