Skip to content
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

PEP 8: E203 (whitespace before :) violation #1841

Closed
shifqu opened this issue Nov 26, 2020 · 2 comments
Closed

PEP 8: E203 (whitespace before :) violation #1841

shifqu opened this issue Nov 26, 2020 · 2 comments
Labels
R: duplicate This issue or pull request already exists R: not a bug This is deliberate behavior of Black.

Comments

@shifqu
Copy link

shifqu commented Nov 26, 2020

Black violates PEP 8: E203 whitespace before ':' when using a method call as first slicing index

Steps to reproduce the behavior:

Playground Link

# Method call used in subsetting --> Unexpected behaviour
foo = "bar"
foo[foo.find("a") :]  # PEP 8 E203 whitespace before :

# Variable used in subsetting --> Expected behaviour
foo = "bar"
a_index = foo.find("a")
foo[a_index:]

# Value used in subsetting --> Expected behaviour
foo = "bar"
a_index = foo.find("a")
foo[1:]

Expected behavior

foo = "bar"
foo[foo.find("a"):]  # No whitespace after first slicing index

Environment (please complete the following information):

  • Version: stable [version 20.8b1]
  • OS and Python version: MacOs Catalina v10.15.7/Python 3.8.6

Does this bug also happen on master?

Yes, Playground Link

@shifqu shifqu added the T: bug Something isn't working label Nov 26, 2020
@iago-lito
Copy link

iago-lito commented Nov 27, 2020

This is expected behaviour (also I think an issue heavily duplicated in this repo e.g. #280 #354 #373 #565 #889 #940 #1343 #1413).

https://black.readthedocs.io/en/stable/the_black_code_style.html#slices

@shifqu
Copy link
Author

shifqu commented Nov 27, 2020

Oh, did not find this is in the docs. Thanks for the information!

@shifqu shifqu closed this as completed Nov 27, 2020
@ichard26 ichard26 added R: duplicate This issue or pull request already exists R: not a bug This is deliberate behavior of Black. and removed T: bug Something isn't working labels Nov 27, 2020
ryanpetrello added a commit to ryanpetrello/awx that referenced this issue Mar 24, 2021
softwarefactory-project-zuul bot added a commit to ansible/awx that referenced this issue Mar 24, 2021
fix busted pep8 collection tests

see: psf/black#1841

Reviewed-by: Elijah DeLee <kdelee@redhat.com>
Reviewed-by: Matt Clay <None>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
R: duplicate This issue or pull request already exists R: not a bug This is deliberate behavior of Black.
Projects
None yet
Development

No branches or pull requests

3 participants