-
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
Long string in return annotation does not get split if there's parameters #3926
Comments
hey i am new to open source contribution coming from hacktoberfest , can you help me/assign me this issue so that i could gain some experience |
Learning to navigate the different transforms made to the code and what got changed were was a bit tricky for me, but with enough breakpoint debugging and added prints I managed to get a decent handle on it . For this issue you've got the I'd suggest you just get started on trying to modify shit and see if you manage to make any type of progress, and if so just open a PR where reviewers can give more concrete feedback if your solution has any problems. I'm not going to work on this and suspect it's relatively low priority, so you probably don't need to worry about duplicating work or anything like that. Make sure you read https://github.com/psf/black#contributing and that also has a link to the Python discord which among other things has a #black channel, you can maybe find more help there if needed. You can also read other PRs that have been merged recently and try to understand them. Good luck! |
Thank you very much for your guidance.
…On Sat, 7 Oct 2023, 5:33 pm John Litborn, ***@***.***> wrote:
Learning to navigate the different transforms made to the code and what
got changed were was a bit tricky for me, but with enough breakpoint
debugging and added prints I managed to get a decent handle on it . For
this issue you've got the StringSplitter class in src/black/trans.py
which is called from transform_line in src/black/linegen.py, which is
otherwise responsible for splitting standalone strings. And then there's
left_hand_split also in linegen.py which is responsible for splitting
function bodies, and in #3916 <#3916> I
added should_split_funcdef_with_rhs to improve return type parsing.
One idea I had would be to expand the logic in StringSplitter to not just
trigger on bare strings, but also the case where it's the return value
(i.e. following an RARROW). There might definitely be better ways of going
about it though.
I'd suggest you just get started on trying to modify shit and see if you
manage to make any type of progress, and if so just open a PR where
reviewers can give more concrete feedback if your solution has any
problems. I'm not going to work on this and suspect it's relatively low
priority, so you probably don't need to worry about duplicating work or
anything like that.
Make sure you read https://github.com/psf/black#contributing and that
also has a link to the Python discord which among other things has a #black
channel, you can maybe find more help there if needed.
Good luck!
—
Reply to this email directly, view it on GitHub
<#3926 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AXH2OE3HLEJDMPMEECBTPDDX6FAKPAVCNFSM6AAAAAA5V3XFO2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONJRGY4TIMJXGM>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Describe the bug
This was first reported in #2699, and thought resolved in #2990, except that only solved the specific case of the function having no parameters.
To Reproduce
Run the test
return_annotation_brackets_string
:black/tests/data/preview/return_annotation_brackets_string.py
Lines 1 to 23 in 3a2d76c
The second function should be formatted exactly the same as the first one.
The text was updated successfully, but these errors were encountered: