Describe the bug A clear and concise description of what the bug is.
black 20.8b1 formats a line differently than 19.10b0, both of them incorrectly splitting a line that fits into 69 characters into 5 and 3 lines, respectively.
To Reproduce Steps to reproduce the behavior:
parser.add_argument(
"pdf", nargs="+", help="pdf to run inference on",
)
Run _Black_ on it with these [default] arguments
See error
Expected behavior A clear and concise description of what you expected to happen.
Code should be condensed to a single line (<88 characters). Instead, it is split across 5 lines, into
parser.add_argument(
"pdf",
nargs="+",
help="pdf to run inference on",
)
Environment (please complete the following information):
Does this bug also happen on master?
Yes, see in the online formatter
Additional context Add any other context about the problem here.
Oddly, version 19 produced the original code, so this was discovered when code that passed the black pre-commit hook (running 19.10b0) failed in CI (running black 20.8b1) -- but it seems like both versions incorrectly split across multiple lines, just differently from each other.
This is expected behaviour and a somewhat new feature. In 19.10b0 we introduced the "magic trailing comma" in which you can tell Black to always explode collections, function signatures and calls, and more. Then in 20.08b0 and 20.08b1 we fixed it to work properly in most cases. So that's why there is a formatting difference between the versions. There are still some edge cases, but the feature is generally usable. You can read the documentation on it for more information.
Hope that helps!
Thank you!