![]() Adds parentheses around implicit string concatenations when it's inside a list, set, or tuple. Except when it's only element and there's no trailing comma. Looking at the order of the transformers here, we need to "wrap in parens" before string_split runs. So my solution is to introduce a "collaboration" between StringSplitter and StringParenWrapper where the splitter "skips" the split until the wrapper adds the parens (and then the line after the paren is split by StringSplitter) in another pass. I have also considered an alternative approach, where I tried to add a different "string paren wrapper" class, and it runs before string_split. Then I found out it requires a different do_transform implementation than StringParenWrapper.do_transform, since the later assumes it runs after the delimiter_split transform. So I stopped researching that route. Originally function calls were also included in this change, but given missing commas should usually result in a runtime error and the scary amount of changes this cause on downstream code, they were removed in later revisions. |
||
---|---|---|
.. | ||
data | ||
__init__.py | ||
conftest.py | ||
empty.toml | ||
optional.py | ||
test_black.py | ||
test_blackd.py | ||
test_format.py | ||
test_ipynb.py | ||
test_no_ipynb.py | ||
test_trans.py | ||
test.toml | ||
util.py |