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

Does not understand how to format double quotation ("") in f-string in Python 3.12 #456

Closed
HiroshiAhsan opened this issue Feb 9, 2024 · 3 comments
Assignees
Labels
info-needed Issue requires more information from poster triage-needed Issue is not triaged.

Comments

@HiroshiAhsan
Copy link

HiroshiAhsan commented Feb 9, 2024

Currently using VSCode 1.86.1 with Black Formatter v2024.0.0.

The Formatter does not understand how to format double quotation ("") in f-string (PEP 701) in Python 3.12.

@github-actions github-actions bot added the triage-needed Issue is not triaged. label Feb 9, 2024
@HiroshiAhsan HiroshiAhsan changed the title Doesn Does not understand double quotation in f-string in Python 3.12 Feb 9, 2024
@HiroshiAhsan HiroshiAhsan changed the title Does not understand double quotation in f-string in Python 3.12 Does not understand double quotation ("") in f-string in Python 3.12 Feb 9, 2024
@HiroshiAhsan HiroshiAhsan changed the title Does not understand double quotation ("") in f-string in Python 3.12 Does not understand how to format double quotation ("") in f-string in Python 3.12 Feb 9, 2024
@karthiknadig
Copy link
Member

@HiroshiAhsan Can you provide an example? Also can you verify if the black itself handles it correctly?

Linux/Mac:

cat yourcode.py | black --stdin-filename yourcode.py -

Windows:

type yourcode.py | black --stdin-filename yourcode.py

@karthiknadig karthiknadig added the info-needed Issue requires more information from poster label Feb 9, 2024
@karthiknadig karthiknadig self-assigned this Feb 9, 2024
@karthiknadig
Copy link
Member

Because we have not heard back with the information we requested, we are closing this issue for now. If you are able to provide the info later on then we will be happy to re-open this issue to pick up where we left off.

@karthiknadig karthiknadig closed this as not planned Won't fix, can't repro, duplicate, stale Mar 29, 2024
@DeveloperAnonymous
Copy link

DeveloperAnonymous commented Mar 31, 2024

Hi @karthiknadig, I just found this and assuming I understand it correctly, I can provide an example in their place:
image

Basically in previous Python versions having double quotes in an f-string like this f"BattleBanana Leaderboard on {details["server_name_clean"]}" was not supported and acted like black does right now. It needed single quotes like this: f"BattleBanana Leaderboard on {details['server_name_clean']}"

However with more research, this seems more on Black than the plugin itself, they didn't implement support for PEP 701 yet: psf/black#3746

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
info-needed Issue requires more information from poster triage-needed Issue is not triaged.
Projects
None yet
Development

No branches or pull requests

3 participants