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

Use optional parentheses for tuples in return statements #6875

Merged
merged 3 commits into from
Aug 29, 2023

Conversation

MichaReiser
Copy link
Member

@MichaReiser MichaReiser commented Aug 25, 2023

Summary

This PR aligns our tuple formatting in return statements with black.

Black avoids parenthesizing tuples in return statements if breaking by any other parentheses
can make it fit.

The same behavior applies to yield, but implementing it is more involved because yield is an expression (and can be nested). I quickly checked, and implementing it didn't increase similarity for any project. I guess, yielding a tuple isn't as common, so I removed the implementation again.

Test Plan

Added tests

@MichaReiser
Copy link
Member Author

Current dependencies on/for this PR:

This comment was auto-generated by Graphite.

@MichaReiser MichaReiser changed the title Use optional parentheses for tuples in yield/return Use optional parentheses for tuples in return statements Aug 25, 2023
@MichaReiser MichaReiser marked this pull request as ready for review August 25, 2023 16:23
@MichaReiser MichaReiser added the formatter Related to the formatter label Aug 25, 2023
@github-actions

This comment was marked as outdated.

@codspeed-hq
Copy link

codspeed-hq bot commented Aug 27, 2023

CodSpeed Performance Report

Merging #6875 will not alter performance

⚠️ No base runs were found

Falling back to comparing return-tuple-parentheses (19c2c62) with main (f33277a)

Summary

✅ 16 untouched benchmarks

@MichaReiser MichaReiser merged commit adb4869 into main Aug 29, 2023
16 checks passed
@MichaReiser MichaReiser deleted the return-tuple-parentheses branch August 29, 2023 06:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
formatter Related to the formatter
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants