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

Preview: handle more huggable immediately nested parens/brackets #4011

Closed
yilei opened this issue Oct 31, 2023 · 2 comments · Fixed by #4012
Closed

Preview: handle more huggable immediately nested parens/brackets #4011

yilei opened this issue Oct 31, 2023 · 2 comments · Fixed by #4012
Labels
T: style What do we want Blackened code to look like?

Comments

@yilei
Copy link
Contributor

yilei commented Oct 31, 2023

Describe the style change

#3964 handled the most common case from #1811, and I'd like the following cases to be handled too:

foo(
    (
        1,
        2,
        3,
    )
)

foo([
    [
        1,
        2,
        3,
    ]
])

See playgroud.

Desired style

foo((
    1,
    2,
    3,
))

foo([[
    1,
    2,
    3,
]])

Additional context

I'll send a PR if this proposal looks good.

@yilei yilei added the T: style What do we want Blackened code to look like? label Oct 31, 2023
@JelleZijlstra
Copy link
Collaborator

Sounds good, thanks!

@yilei
Copy link
Contributor Author

yilei commented Nov 1, 2023

Add two more cases that aren't function calls:

Before:

nested_mapping = {
    "key": [
        {
            "a very long key 1": "with a very long value",
            "a very long key 2": "with a very long value",
        }
    ]
}

nested_array = [
    [
        1,
        2,
        3,
    ]
]

After:

nested_mapping = {
    "key": [{
        "a very long key 1": "with a very long value",
        "a very long key 2": "with a very long value",
    }]
}

nested_array = [[
    1,
    2,
    3,
]]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T: style What do we want Blackened code to look like?
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants