-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Syntax error when RUF010
autofixes f"{str({})}"
#5530
Comments
RUF010
autofixes 'f"{str({})}"'
RUF010
autofixes f"{str({})}"
Oh boy. Did this trigger on a real project? Just curious how common it is. |
Yes, on https://github.com/mlflow/mlflow.
I think it's uncommon :) |
Haha we should still fix it definitely, was just looking for examples :) |
The original code looked like this: "foo bar baz {}".format(str({})) I first applied f"foo bar baz {str({})}" Then, applied |
>>> f"{{}}"
'{}'
>>> f"{{}!s}"
File "<stdin>", line 1
SyntaxError: f-string: single '}' is not allowed |
Hmm yeah but they have different meanings, in the first case it's being interpreted as the literal braces whereas in the second it's an expression. E.g. consider if the original example was: |
Reproduction
The text was updated successfully, but these errors were encountered: