-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
format: different behavior with black for hug_parens_with_braces_and_square_brackets
and generators
#11375
Comments
I think this is related; psf/black#3964 (comment) |
title of this issue is not very accurate and I don't know how black call this feature... |
I think it is called |
thanks |
It seems like we don't consider generator to be huggable:
I'm not sure if it's intentional or not but Micha might be able to provide more context on this once he's back from his PTO. Although it does seem that a tuple expression is huggable, so I'd say that the generator should probably be as well. |
hug_parens_with_braces_and_square_brackets
and generators
We don't track differences for preview styles because both Black's and Ruff's preview styles are in flux, making it difficult to track the differences over time.
I don't think this is intentional. The only thing we need to be mindful of is that generator parentheses in call expressions are optional. Meaning, we should only hug if the generator already has parentheses (the logic must be in sync with the parentheses logic in |
This comment was marked as off-topic.
This comment was marked as off-topic.
@trim21 I suspect your example is https://docs.astral.sh/ruff/formatter/black/#call-expressions-with-a-single-multiline-string-argument although I don't fully understand what's the input |
oh, thanks i miss this |
I'm using ruff format with
--preview
enable, and it generate different output in this case.ruff:
black:
This is not listed in "Known Deviations from Black", is this unexpected behavoir?
pyproject.toml
The text was updated successfully, but these errors were encountered: