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

E201 / E202 false positives inside f-strings for Python 3.12 #1260

Closed
vanschelven opened this issue Aug 21, 2024 · 1 comment
Closed

E201 / E202 false positives inside f-strings for Python 3.12 #1260

vanschelven opened this issue Aug 21, 2024 · 1 comment

Comments

@vanschelven
Copy link

vanschelven commented Aug 21, 2024

I have f-strings like so:

f"{ parts.scheme }://{ public_key }@{ parts.hostname }"

On Python 3.11 and below pycodestyle (via flake8) is happy with them. On Python 3.12 I get E201 and E202 (whitespace after '{', whitespace before '}')

This error is surprising to me, and "fixing" it makes the code much harder to read. Thoughts:

Finally, and this is the best part: what if you want whitespace around the equals sign? [..] no problem; whitespace is preserved from the original text inside the curly braces [..] we also explicitly permit, and preserve, whitespace.

Similar discussions (sometimes prematurely marked as resolved):

====

>>> pycodestyle.__version__
'2.12.1'
@asottile
Copy link
Member

you found the duplicates with answers please don't make new duplicates

@PyCQA PyCQA locked as off-topic and limited conversation to collaborators Aug 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants