-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
possible_forgotten_f_prefix.py
25 lines (19 loc) · 1.13 KB
/
possible_forgotten_f_prefix.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# pylint: disable=missing-docstring, invalid-name, line-too-long, multiple-statements
var = "string"
var_two = "extra string"
x = f"This is a {var} which should be a f-string"
x = "This is a {var} used twice, see {var}"
x = "This is a {var} which should be a f-string" # [possible-forgotten-f-prefix]
x = "This is a {var} and {var_two} which should be a f-string" # [possible-forgotten-f-prefix, possible-forgotten-f-prefix]
x1, x2, x3 = (1, 2, "This is a {var} which should be a f-string") # [possible-forgotten-f-prefix]
y = "This is a {var} used for formatting later" # [possible-forgotten-f-prefix]
z = y.format(var="string")
g = "This is a {another_var} used for formatting later" # [possible-forgotten-f-prefix]
h = g.format(another_var="string")
i = "This is {invalid /// python /// inside}"
j = "This is {not */ valid python.}"
k = "This is {def function(): return 42} valid python but not an expression"
def function(): return 42
examples = [var, var_two]
x = f"This is an example with a list: {''.join(examples) + 'well...' }"
x = "This is an example with a list: {''.join(examples) + 'well...' }" # [possible-forgotten-f-prefix]