Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Hug parens also with multiline unpacking #3992

Merged
merged 12 commits into from
Oct 30, 2023

Conversation

henriholopainen
Copy link
Contributor

@henriholopainen henriholopainen commented Oct 27, 2023

Description

As noted by @Avasam here, hugging parens with brackets on multiline dictionaries and lists as sole function parameters didn't take into account list/dict unpacking. This PR fixes that shortcoming.

Checklist - did you ...

  • Add an entry in CHANGES.md if necessary?
  • Add / update tests if necessary?
  • Add new / update outdated documentation?

@Avasam
Copy link

Avasam commented Oct 27, 2023

I only gave list/args as an example. But there's dict/kwargs unpacking too:

def foo(**kwargs):
    print(kwargs)


other = {"d": 4}

foo(**{
    "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa": 1,
    "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb": 2,
    "ccccccccccccccccccccccccccccccccc": 3,
    **other,
})

@github-actions
Copy link

github-actions bot commented Oct 27, 2023

diff-shades results comparing this PR (79b8eca) to main (5edd993). The full diff is available in the logs under the "Generate HTML diff report" step.

╭──────────────────────── Summary ─────────────────────────╮
│ 6 projects & 85 files changed / 1725 changes [+738/-987] │
│                                                          │
│ ... out of 2 505 704 lines, 11 779 files & 23 projects   │
╰──────────────────────────────────────────────────────────╯

Differences found.

What is this? | Workflow run | diff-shades documentation

@henriholopainen
Copy link
Contributor Author

henriholopainen commented Oct 28, 2023

Hmm, the linting is failing. Should we format Black with the --preview style? If so, shouldn't that be caught with tox -e run_self?

edit: To answer my own question, the CI runs with pyproject.toml where --preview is set. I had disabled that locally, so run_self behaved differently. Fixed the failures and all is good now.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants