-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
fix indentation of line breaks in long type hints by adding parens #3899
Conversation
…es, and remove unnecessary parentheses
Thanks. This looks generally good, but we'll want to make the change only in the preview style for now. Look for existing code like |
diff-shades results comparing this PR (391a413) to main (e974fc3). The full diff is available in the logs under the "Generate HTML diff report" step.
|
Thanks, fixed! |
Looking at the diff-shades output, all changes seem like improvements: https://github.com/psf/black/actions/runs/6275527706/job/17044773640#step:10:1 |
Description
The simple way of resolving #2316
I would personally prefer to resolve it by formatting it without added parentheses (i.e. option 3 in #2316) to save two unnecessary lines, but that will likely require a bunch of messing around in
_maybe_split_omitting_optional_parens
and could also impact some other cases - so I think I'll hold off on that one for the moment.I had to extend
maybe_make_parens_invisible_in_atom
to also allow expressions, I was quite afraid this would have side effects elsewhere in the code - but it seems to be fine? I could be defensive and add a parameter that enables checkingsyms.expr
, and only set it when called fromvisit_tname
.There's minor changes to two existing test cases, but they both seem fine to me.
Checklist - did you ...
CHANGES.md
if necessary? [TODO]