-
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
black adds unnecessary lines around triple-quoted blocks #462
Labels
R: duplicate
This issue or pull request already exists
Comments
To make a code block use triple backticks ```python
print('like this!')
``` |
JelleZijlstra
changed the title
rpy2 usage becomes weird
black adds unnecessary lines around triple-quoted blocks
Aug 22, 2018
I have run into this with the similar textwrap.dedent("""\
Hello, I am
a multiline string used with
a common idiom
""") black will convert this to: textwrap.dedent(
"""\
Hello, I am
a multiline string used with
a common idiom
"""
) This is particularly bad in the case of another containing function: sqlalchemy.text(textwrap.dedent("""\
SELECT
*
FROM
sometable
""")) becomes: sqlalchemy.text(
textwrap.dedent(
"""\
SELECT
*
FROM
sometable
"""
)
) |
I think this boils down to the same cause as #256 |
I'll close this as a duplicate and we'll handle this use case as part of #256, too. |
ambv
added
R: duplicate
This issue or pull request already exists
and removed
T: style
What do we want Blackened code to look like?
labels
Sep 26, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Using the rpy2 library to embed R code in a Python project, a common idiom is this:
Appying
black -S
to it, the code becomes:This might be an issue with other language embeddings as well.
My suggestion is that black does not change this idiom, i.e., the opening and closing parenthesis should be coalesced with the triple (single) quotes.
Operating system:
Python version: 3.6.5
Black version: 18.6b4
Does also happen on master: yes
EDIT: earlier versions did not show the whitespace correctly.
The text was updated successfully, but these errors were encountered: