You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
pyflakes does some format specifier checks (#443), but it isn't able to detect invalid format specifiers. For example
f"{x:f.1}""{x:f.1}".format(x=1)
are both wrong (the f is supposed to go after the .1). Also the f-string one is a ValueError and is only checked at runtime.
The format specification mini-language is pretty complicated, so this would be useful, but also maybe not easy to implement. For .format strings you can use https://docs.python.org/3/library/string.html#string.Formatter.parse, but for f-strings, there's nothing in the standard library that can tokenize the f-string components (it would be useful if there were). Libraries like pygments and parso can tokenize them, or maybe the tokenizer added in #443 can be extended to handle them.
The text was updated successfully, but these errors were encountered:
pyflakes does some format specifier checks (#443), but it isn't able to detect invalid format specifiers. For example
are both wrong (the
f
is supposed to go after the.1
). Also the f-string one is a ValueError and is only checked at runtime.The format specification mini-language is pretty complicated, so this would be useful, but also maybe not easy to implement. For
.format
strings you can use https://docs.python.org/3/library/string.html#string.Formatter.parse, but for f-strings, there's nothing in the standard library that can tokenize the f-string components (it would be useful if there were). Libraries like pygments and parso can tokenize them, or maybe the tokenizer added in #443 can be extended to handle them.The text was updated successfully, but these errors were encountered: