-
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 type param formatting in funcdef with trailing comma #4255
Conversation
Signed-off-by: RedGuy12 <[email protected]>
Signed-off-by: RedGuy12 <[email protected]>
Signed-off-by: RedGuy12 <[email protected]>
…ype-param-comma # Conflicts: # CHANGES.md
I thought it might be best to just submit a fix for the bug and work on the other changes in a separate PR. |
CHANGES.md
Outdated
@@ -10,6 +10,11 @@ | |||
|
|||
<!-- Changes that affect Black's stable style --> | |||
|
|||
- Don't move comments along with delimiters, which could cause crashes (#4248) | |||
|
|||
- Fixed a bug where lines were split incorrectly for function definitions with type |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be a change to the preview style instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(And to be clear, the bigger ask here is that the style change itself should only be applied in the preview style, not just that the changelog entry be moved.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, so sorry about that, I misunderstood.
Closing this in favor of #4272 |
Description
This change adds additional checks to the decision whether to split a funcdef from the left or right-hand side.
Specifically, this adds the following condition to
should_split_funcdef_with_rhs
:If a funcdef has type parameters and its parameters also have a trailing comma, return
True
, to indicate that the funcdef should not be split from the left first.This fixes the bug described in #4254.
I am currently trying to also fix #3929 and #4071 since they seem related, but that seems to require a little more work. Any suggestions are appreciated.
Checklist - did you ...
CHANGES.md
if necessary?