Incorrect detection of self-documenting f-strings
See original GitHub issueDescribe the bug
False-positives are returned for self-documenting f-strings.
To Reproduce
$ cat /tmp/test.py
a = 1
print(f"Hello world={a}")
$ vermin /tmp/test.py
Minimum required versions: 3.8
Incompatible versions: 2
Expected behavior
Expected the minimum required version for this code to be 3.6. A self-documenting f-string has the equals sign on the other side of the variable (i.e. {a=}).
Environment (please complete the following information):
- Vermin version 0.9.2
Thanks in advance!
Issue Analytics
- State:
- Created 4 years ago
- Comments:11 (10 by maintainers)
Top Results From Across the Web
consider-using-f-string / C0209 - Pylint
Description: Used when we detect a string that is being formatted with format() or % which could potentially be a f-string. The use...
Read more >Issue 45086: f-string unmatched ']' - Python tracker
I think the error is short for "I found a ']' without a matching '['". msg400930 - (view), Author: Greg Kuhn (Greg Kuhn),...
Read more >What does = (equal) do in f-strings inside the expression curly ...
An f-string such as f'{expr=}' will expand to the text of the expression, an equal sign, then the representation of the evaluated expression....
Read more >Why have I not been using f-strings... : r/Python - Reddit
The problem is that Guido is trying to redefine what pythonic is right in the middle of a major release cycle. That's just...
Read more >PythonTA Checks
This error occurs when we call strip , lstrip , or rstrip , but pass an argument string which contains duplicate characters. The...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

There are still trivial cases tripping this so please re-open. E.g:
Actually there are more cases (tested on Python 3.8 on your patch just now):
Case 1
f'{ a = }'Expected: detected as 3.8+ Actual: detected as 3.6+ Notes: ASCII whitespaces ([ \t\n\r\f\v]) are allowed before and after the=, and are preserved in the output.Case 2
f'{a+b=}',f'{a+1=}'Expected: detected as 3.8+ Actual: detected as 3.6+ Notes: Howeverf'{1+a=}'andf'{1+1=}'are detected correctly.Case 3
f'{(x:=1)}'Expected: detected as 3.8+ Actual: detected as 3.6+ Notes: This is not a “self-documenting f-string”, this is an f-string containing an assignment expression (which is new in 3.8).Unfortunately, “self-documenting f-string” or “f-string debugging” is poorly documented in the official documentation (I can only find it in whatsnew and changelog). The PR introducing this change contains some useful information (especially the test cases), along with its corresponding issue (contains relevant discussion when introducing this feature, might be a bit noisy because some previous proposals mentioned were rejected).