You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
deffunc1[
T
](a,):
passdeffunc3[
T,
](a,):
passdeffunc3[
T,
](a,) ->R[
X,
Y,
]:
pass
The type parameters are split instead of the function parameters.
Expected behavior
I would expect this result.
deffunc1[T](
a,
):
passdeffunc2[
T,
](
a,
):
passdeffunc3[
T,
](
a,
) ->R[
X,
Y,
]:
pass
Environment
$ black --version
black, 24.2.0 (compiled: yes)
Python (CPython) 3.12.1
Additional context
I am currently drafting a PR to fix this bug.
My current approach is to rework should_split_funcdef_with_rhs to also check for the position of the trailing comma in type and function parameters.
If I am overlooking something with that approach or if you have a better idea on how to fix this, please feel free to let me know.
The text was updated successfully, but these errors were encountered:
Describe the bug
A function with type parameters gets formatted incorrectly if the function parameters have a magic trailing comma.
To Reproduce
For example, take this code:
And run it with these arguments:
The resulting code is:
The type parameters are split instead of the function parameters.
Expected behavior
I would expect this result.
Environment
$ black --version
black, 24.2.0 (compiled: yes)
Python (CPython) 3.12.1
Additional context
I am currently drafting a PR to fix this bug.
My current approach is to rework
should_split_funcdef_with_rhs
to also check for the position of the trailing comma in type and function parameters.If I am overlooking something with that approach or if you have a better idea on how to fix this, please feel free to let me know.
The text was updated successfully, but these errors were encountered: