There seems to be one instance in our code that triggers a reformat in Black which is not approved by flake8. Given the line
yield lst[i:i + n]
Black will reformat this to
yield lst[i : i + n]
This will trigger an error in flake8 however:
E203 whitespace before ':'
This is with black version 19.10b0 and flake 3.8.1 on Python 3.6.10
This is intentional:
(And a duplicate: https://github.com/psf/black/issues?q=is%3Aissue+sort%3Aupdated-desc+is%3Aclosed+E203 :)
note that the above link is no longer valid, I believe this is the new url: https://black.readthedocs.io/en/stable/the_black_code_style.html#slices
Slices
PEP 8 recommends to treat : in slices as a binary operator with the lowest priority, and to leave an equal amount of space on either side, except if a parameter is omitted (e.g. ham[1 + 1 :]). It also states that for extended slices, both : operators have to have the same amount of spacing, except if a parameter is omitted (ham[1 + 1 ::]). Black enforces these rules consistently.
This behaviour may raise E203 whitespace before ':' warnings in style guide enforcement tools like Flake8. Since E203 is not PEP 8 compliant, you should tell Flake8 to ignore these warnings.
Most helpful comment
This is intentional:
(And a duplicate: https://github.com/psf/black/issues?q=is%3Aissue+sort%3Aupdated-desc+is%3Aclosed+E203 :)