X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/a497570fcb364b40e0d952d3133e8d4f2d329fea..e912c7ff54c392e92a765c5eff0bd2ca3bb05b47:/src/black/__init__.py diff --git a/src/black/__init__.py b/src/black/__init__.py index 5f0f897..c7c5d72 100644 --- a/src/black/__init__.py +++ b/src/black/__init__.py @@ -3271,7 +3271,8 @@ class StringParenStripper(StringTransformer): Requirements: The line contains a string which is surrounded by parentheses and: - - The target string is NOT the only argument to a function call). + - The target string is NOT the only argument to a function call. + - The target string is NOT a "pointless" string. - If the target string contains a PERCENT, the brackets are not preceeded or followed by an operator with higher precedence than PERCENT. @@ -3295,6 +3296,14 @@ class StringParenStripper(StringTransformer): if leaf.type != token.STRING: continue + # If this is a "pointless" string... + if ( + leaf.parent + and leaf.parent.parent + and leaf.parent.parent.type == syms.simple_stmt + ): + continue + # Should be preceded by a non-empty LPAR... if ( not is_valid_index(idx - 1)