black icon indicating copy to clipboard operation
black copied to clipboard

Fix type param formatting in funcdef with trailing comma

Open sumezulike opened this issue 11 months ago • 2 comments

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 ...

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

sumezulike avatar Feb 27 '24 23:02 sumezulike

diff-shades reports zero changes comparing this PR (eb47bf05208ee616e86a515a466d964f68ebc45c) to main (f03ee113c9f3dfeb477f2d4247bfb7de2e5f465c).


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

github-actions[bot] avatar Feb 27 '24 23:02 github-actions[bot]

I thought it might be best to just submit a fix for the bug and work on the other changes in a separate PR. Happy about any feedback!

sumezulike avatar Mar 03 '24 00:03 sumezulike

Closing this in favor of #4272

sumezulike avatar Mar 10 '24 22:03 sumezulike