Skip to content
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

Long dict key with operators are oddly broken into multiple lines #3442

Open
yilei opened this issue Dec 15, 2022 · 2 comments
Open

Long dict key with operators are oddly broken into multiple lines #3442

yilei opened this issue Dec 15, 2022 · 2 comments
Labels
F: linebreak How should we split up lines? S: accepted The changes in this design / enhancement issue have been accepted and can be implemented T: style What do we want Blackened code to look like?

Comments

@yilei
Copy link
Contributor

yilei commented Dec 15, 2022

Describe the style change

Examples in the current Black style

tests = [
    (
        BusinessHour(),
        {
            Timestamp("2014-07-04 15:00")
            + Nano(5): this_is_a_very_long_function("2014-07-04 16:00"),
            Timestamp("2014-07-04 16:00")
            + Nano(5): this_is_a_very_long_function("2014-07-04 16:00"),
            Timestamp("2014-07-04 16:00")
            - Nano(5): this_is_a_very_long_function("2014-07-04 16:00"),
        },
    ),
]

Desired style

tests = [
    (
        BusinessHour(),
        {
            Timestamp("2014-07-04 15:00") + Nano(5): (
                this_is_a_very_long_function("2014-07-04 16:00")
            ),
            Timestamp("2014-07-04 16:00") + Nano(5): (
                this_is_a_very_long_function("2014-07-04 16:00"),
            ),
            Timestamp("2014-07-04 16:00") - Nano(5): (
                this_is_a_very_long_function("2014-07-04 16:00")
            ),
        },
    ),
]

Additional context

This is an example found in #3440 while working on the dict value. I think the issue is that we don't treat : as a delimiter thus the "operators" are broken instead of :.

@yilei yilei added the T: style What do we want Blackened code to look like? label Dec 15, 2022
@felix-hilden
Copy link
Collaborator

You got my vote 👍

@ichard26 ichard26 added S: accepted The changes in this design / enhancement issue have been accepted and can be implemented F: linebreak How should we split up lines? labels Feb 3, 2023
@ichard26
Copy link
Collaborator

ichard26 commented Feb 3, 2023

Go ahead! The current style is awful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F: linebreak How should we split up lines? S: accepted The changes in this design / enhancement issue have been accepted and can be implemented T: style What do we want Blackened code to look like?
Projects
None yet
Development

No branches or pull requests

3 participants