Skip to content

Fix inconsistent formatting of 'with' statements with tuple arguments #4636

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

Closed
wants to merge 3 commits into from

Conversation

dkarishma26
Copy link

This PR fixes the inconsistent formatting of 'with' statements when using tuples.

Previously, Black formatted 'with' conditions inconsistently when they contained bracketes.

Now, the formatting is consistent across different cases.

##Changes:

  • Fixed inconsistent formatting of with statements when they contain brackets (tuples, lists, function calls).
  • Ensured that Black formats with statements consistently, avoiding unnecessary line breaks or misalignment when using brackets.
  • Updated the formatting logic to handle multi-line with statements properly.
  • Added test cases in tests/test_black.py to verify correct formatting behavior.

Fixes #4633

Checklist

  • Tests added/updated
  • Documentation updated (if necessary)
  • All CI checks pass

If it needs any changes or modifications, let me know.

@tusharsadhwani
Copy link
Collaborator

Hi @dkarishma26

This change doesn't fix the linked issue, or add a test for the linked issue. Can you explain the changes?

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

Successfully merging this pull request may close these issues.

Parsing the with statement with tuple argument and type comment failed
2 participants