File size: 587 Bytes
36652ef
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import re

def find_problematic_fstrings(file_path):
    with open(file_path, 'r', encoding='utf-8') as file:
        lines = file.readlines()
    
    for i, line in enumerate(lines):
        # Look for f-strings with backslashes
        if 'f"' in line or "f'" in line:
            # Check if there's a backslash in the f-string
            match = re.search(r'f["\'].*?\\.*?["\']', line)
            if match:
                print(f"Potential problematic f-string at line {i+1}: {line.strip()}")

if __name__ == "__main__":
    find_problematic_fstrings("backend.py")