---
source: crates/ruff_linter/src/rules/pyupgrade/mod.rs
---
UP031_0.py:4:7: UP031 [*] Use format specifiers instead of percent format
  |
3 | # UP031
4 | print('%s %s' % (a, b))
  |       ^^^^^^^^^^^^^^^^ UP031
5 | 
6 | print('%s%s' % (a, b))
  |
  = help: Replace with format specifiers

ℹ Unsafe fix
1 1 | a, b, x, y = 1, 2, 3, 4
2 2 | 
3 3 | # UP031
4   |-print('%s %s' % (a, b))
  4 |+print('{} {}'.format(a, b))
5 5 | 
6 6 | print('%s%s' % (a, b))
7 7 | 

UP031_0.py:6:7: UP031 [*] Use format specifiers instead of percent format
  |
4 | print('%s %s' % (a, b))
5 | 
6 | print('%s%s' % (a, b))
  |       ^^^^^^^^^^^^^^^ UP031
7 | 
8 | print("trivial" % ())
  |
  = help: Replace with format specifiers

ℹ Unsafe fix
3 3 | # UP031
4 4 | print('%s %s' % (a, b))
5 5 | 
6   |-print('%s%s' % (a, b))
  6 |+print('{}{}'.format(a, b))
7 7 | 
8 8 | print("trivial" % ())
9 9 | 

UP031_0.py:8:7: UP031 [*] Use format specifiers instead of percent format
   |
 6 | print('%s%s' % (a, b))
 7 | 
 8 | print("trivial" % ())
   |       ^^^^^^^^^^^^^^ UP031
 9 | 
10 | print("%s" % ("simple",))
   |
   = help: Replace with format specifiers

ℹ Unsafe fix
5 5 | 
6 6 | print('%s%s' % (a, b))
7 7 | 
8   |-print("trivial" % ())
  8 |+print("trivial".format())
9 9 | 
10 10 | print("%s" % ("simple",))
11 11 | 

UP031_0.py:10:7: UP031 [*] Use format specifiers instead of percent format
   |
 8 | print("trivial" % ())
 9 | 
10 | print("%s" % ("simple",))
   |       ^^^^^^^^^^^^^^^^^^ UP031
11 | 
12 | print("%s" % ("%s" % ("nested",),))
   |
   = help: Replace with format specifiers

ℹ Unsafe fix
7  7  | 
8  8  | print("trivial" % ())
9  9  | 
10    |-print("%s" % ("simple",))
   10 |+print("{}".format("simple"))
11 11 | 
12 12 | print("%s" % ("%s" % ("nested",),))
13 13 | 

UP031_0.py:12:7: UP031 [*] Use format specifiers instead of percent format
   |
10 | print("%s" % ("simple",))
11 | 
12 | print("%s" % ("%s" % ("nested",),))
   |       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP031
13 | 
14 | print("%s%% percent" % (15,))
   |
   = help: Replace with format specifiers

ℹ Unsafe fix
9  9  | 
10 10 | print("%s" % ("simple",))
11 11 | 
12    |-print("%s" % ("%s" % ("nested",),))
   12 |+print("{}".format("%s" % ("nested",)))
13 13 | 
14 14 | print("%s%% percent" % (15,))
15 15 | 

UP031_0.py:12:15: UP031 [*] Use format specifiers instead of percent format
   |
10 | print("%s" % ("simple",))
11 | 
12 | print("%s" % ("%s" % ("nested",),))
   |               ^^^^^^^^^^^^^^^^^^ UP031
13 | 
14 | print("%s%% percent" % (15,))
   |
   = help: Replace with format specifiers

ℹ Unsafe fix
9  9  | 
10 10 | print("%s" % ("simple",))
11 11 | 
12    |-print("%s" % ("%s" % ("nested",),))
   12 |+print("%s" % ("{}".format("nested"),))
13 13 | 
14 14 | print("%s%% percent" % (15,))
15 15 | 

UP031_0.py:14:7: UP031 [*] Use format specifiers instead of percent format
   |
12 | print("%s" % ("%s" % ("nested",),))
13 | 
14 | print("%s%% percent" % (15,))
   |       ^^^^^^^^^^^^^^^^^^^^^^ UP031
15 | 
16 | print("%f" % (15,))
   |
   = help: Replace with format specifiers

ℹ Unsafe fix
11 11 | 
12 12 | print("%s" % ("%s" % ("nested",),))
13 13 | 
14    |-print("%s%% percent" % (15,))
   14 |+print("{}% percent".format(15))
15 15 | 
16 16 | print("%f" % (15,))
17 17 | 

UP031_0.py:16:7: UP031 [*] Use format specifiers instead of percent format
   |
14 | print("%s%% percent" % (15,))
15 | 
16 | print("%f" % (15,))
   |       ^^^^^^^^^^^^ UP031
17 | 
18 | print("%.f" % (15,))
   |
   = help: Replace with format specifiers

ℹ Unsafe fix
13 13 | 
14 14 | print("%s%% percent" % (15,))
15 15 | 
16    |-print("%f" % (15,))
   16 |+print("{:f}".format(15))
17 17 | 
18 18 | print("%.f" % (15,))
19 19 | 

UP031_0.py:18:7: UP031 [*] Use format specifiers instead of percent format
   |
16 | print("%f" % (15,))
17 | 
18 | print("%.f" % (15,))
   |       ^^^^^^^^^^^^^ UP031
19 | 
20 | print("%.3f" % (15,))
   |
   = help: Replace with format specifiers

ℹ Unsafe fix
15 15 | 
16 16 | print("%f" % (15,))
17 17 | 
18    |-print("%.f" % (15,))
   18 |+print("{:.0f}".format(15))
19 19 | 
20 20 | print("%.3f" % (15,))
21 21 | 

UP031_0.py:20:7: UP031 [*] Use format specifiers instead of percent format
   |
18 | print("%.f" % (15,))
19 | 
20 | print("%.3f" % (15,))
   |       ^^^^^^^^^^^^^^ UP031
21 | 
22 | print("%3f" % (15,))
   |
   = help: Replace with format specifiers

ℹ Unsafe fix
17 17 | 
18 18 | print("%.f" % (15,))
19 19 | 
20    |-print("%.3f" % (15,))
   20 |+print("{:.3f}".format(15))
21 21 | 
22 22 | print("%3f" % (15,))
23 23 | 

UP031_0.py:22:7: UP031 [*] Use format specifiers instead of percent format
   |
20 | print("%.3f" % (15,))
21 | 
22 | print("%3f" % (15,))
   |       ^^^^^^^^^^^^^ UP031
23 | 
24 | print("%-5f" % (5,))
   |
   = help: Replace with format specifiers

ℹ Unsafe fix
19 19 | 
20 20 | print("%.3f" % (15,))
21 21 | 
22    |-print("%3f" % (15,))
   22 |+print("{:3f}".format(15))
23 23 | 
24 24 | print("%-5f" % (5,))
25 25 | 

UP031_0.py:24:7: UP031 [*] Use format specifiers instead of percent format
   |
22 | print("%3f" % (15,))
23 | 
24 | print("%-5f" % (5,))
   |       ^^^^^^^^^^^^^ UP031
25 | 
26 | print("%9f" % (5,))
   |
   = help: Replace with format specifiers

ℹ Unsafe fix
21 21 | 
22 22 | print("%3f" % (15,))
23 23 | 
24    |-print("%-5f" % (5,))
   24 |+print("{:<5f}".format(5))
25 25 | 
26 26 | print("%9f" % (5,))
27 27 | 

UP031_0.py:26:7: UP031 [*] Use format specifiers instead of percent format
   |
24 | print("%-5f" % (5,))
25 | 
26 | print("%9f" % (5,))
   |       ^^^^^^^^^^^^ UP031
27 | 
28 | print("%#o" % (123,))
   |
   = help: Replace with format specifiers

ℹ Unsafe fix
23 23 | 
24 24 | print("%-5f" % (5,))
25 25 | 
26    |-print("%9f" % (5,))
   26 |+print("{:9f}".format(5))
27 27 | 
28 28 | print("%#o" % (123,))
29 29 | 

UP031_0.py:28:7: UP031 [*] Use format specifiers instead of percent format
   |
26 | print("%9f" % (5,))
27 | 
28 | print("%#o" % (123,))
   |       ^^^^^^^^^^^^^^ UP031
29 | 
30 | print("brace {} %s" % (1,))
   |
   = help: Replace with format specifiers

ℹ Unsafe fix
25 25 | 
26 26 | print("%9f" % (5,))
27 27 | 
28    |-print("%#o" % (123,))
   28 |+print("{:#o}".format(123))
29 29 | 
30 30 | print("brace {} %s" % (1,))
31 31 | 

UP031_0.py:30:7: UP031 [*] Use format specifiers instead of percent format
   |
28 | print("%#o" % (123,))
29 | 
30 | print("brace {} %s" % (1,))
   |       ^^^^^^^^^^^^^^^^^^^^ UP031
31 | 
32 | print(
   |
   = help: Replace with format specifiers

ℹ Unsafe fix
27 27 | 
28 28 | print("%#o" % (123,))
29 29 | 
30    |-print("brace {} %s" % (1,))
   30 |+print("brace {{}} {}".format(1))
31 31 | 
32 32 | print(
33 33 |   "%s" % (

UP031_0.py:33:3: UP031 [*] Use format specifiers instead of percent format
   |
32 |   print(
33 |     "%s" % (
   |  ___^
34 | |     "trailing comma",
35 | |         )
   | |_________^ UP031
36 |   )
   |
   = help: Replace with format specifiers

ℹ Unsafe fix
30 30 | print("brace {} %s" % (1,))
31 31 | 
32 32 | print(
33    |-  "%s" % (
   33 |+  "{}".format(
34 34 |     "trailing comma",
35 35 |         )
36 36 | )

UP031_0.py:38:7: UP031 [*] Use format specifiers instead of percent format
   |
36 | )
37 | 
38 | print("foo %s " % (x,))
   |       ^^^^^^^^^^^^^^^^ UP031
39 | 
40 | print("%(k)s" % {"k": "v"})
   |
   = help: Replace with format specifiers

ℹ Unsafe fix
35 35 |         )
36 36 | )
37 37 | 
38    |-print("foo %s " % (x,))
   38 |+print("foo {} ".format(x))
39 39 | 
40 40 | print("%(k)s" % {"k": "v"})
41 41 | 

UP031_0.py:40:7: UP031 [*] Use format specifiers instead of percent format
   |
38 | print("foo %s " % (x,))
39 | 
40 | print("%(k)s" % {"k": "v"})
   |       ^^^^^^^^^^^^^^^^^^^^ UP031
41 | 
42 | print("%(k)s" % {
   |
   = help: Replace with format specifiers

ℹ Unsafe fix
37 37 | 
38 38 | print("foo %s " % (x,))
39 39 | 
40    |-print("%(k)s" % {"k": "v"})
   40 |+print("{k}".format(k="v"))
41 41 | 
42 42 | print("%(k)s" % {
43 43 |     "k": "v",

UP031_0.py:42:7: UP031 [*] Use format specifiers instead of percent format
   |
40 |   print("%(k)s" % {"k": "v"})
41 |   
42 |   print("%(k)s" % {
   |  _______^
43 | |     "k": "v",
44 | |     "i": "j"
45 | | })
   | |_^ UP031
46 |   
47 |   print("%(to_list)s" % {"to_list": []})
   |
   = help: Replace with format specifiers

ℹ Unsafe fix
39 39 | 
40 40 | print("%(k)s" % {"k": "v"})
41 41 | 
42    |-print("%(k)s" % {
43    |-    "k": "v",
44    |-    "i": "j"
45    |-})
   42 |+print("{k}".format(
   43 |+    k="v",
   44 |+    i="j",
   45 |+))
46 46 | 
47 47 | print("%(to_list)s" % {"to_list": []})
48 48 | 

UP031_0.py:47:7: UP031 [*] Use format specifiers instead of percent format
   |
45 | })
46 | 
47 | print("%(to_list)s" % {"to_list": []})
   |       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP031
48 | 
49 | print("%(k)s" % {"k": "v", "i": 1, "j": []})
   |
   = help: Replace with format specifiers

ℹ Unsafe fix
44 44 |     "i": "j"
45 45 | })
46 46 | 
47    |-print("%(to_list)s" % {"to_list": []})
   47 |+print("{to_list}".format(to_list=[]))
48 48 | 
49 49 | print("%(k)s" % {"k": "v", "i": 1, "j": []})
50 50 | 

UP031_0.py:49:7: UP031 [*] Use format specifiers instead of percent format
   |
47 | print("%(to_list)s" % {"to_list": []})
48 | 
49 | print("%(k)s" % {"k": "v", "i": 1, "j": []})
   |       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP031
50 | 
51 | print("%(ab)s" % {"a" "b": 1})
   |
   = help: Replace with format specifiers

ℹ Unsafe fix
46 46 | 
47 47 | print("%(to_list)s" % {"to_list": []})
48 48 | 
49    |-print("%(k)s" % {"k": "v", "i": 1, "j": []})
   49 |+print("{k}".format(k="v", i=1, j=[]))
50 50 | 
51 51 | print("%(ab)s" % {"a" "b": 1})
52 52 | 

UP031_0.py:51:7: UP031 [*] Use format specifiers instead of percent format
   |
49 | print("%(k)s" % {"k": "v", "i": 1, "j": []})
50 | 
51 | print("%(ab)s" % {"a" "b": 1})
   |       ^^^^^^^^^^^^^^^^^^^^^^^ UP031
52 | 
53 | print("%(a)s" % {"a"  :  1})
   |
   = help: Replace with format specifiers

ℹ Unsafe fix
48 48 | 
49 49 | print("%(k)s" % {"k": "v", "i": 1, "j": []})
50 50 | 
51    |-print("%(ab)s" % {"a" "b": 1})
   51 |+print("{ab}".format(ab=1))
52 52 | 
53 53 | print("%(a)s" % {"a"  :  1})
54 54 | 

UP031_0.py:53:7: UP031 [*] Use format specifiers instead of percent format
   |
51 | print("%(ab)s" % {"a" "b": 1})
52 | 
53 | print("%(a)s" % {"a"  :  1})
   |       ^^^^^^^^^^^^^^^^^^^^^ UP031
54 | 
55 | print((
   |
   = help: Replace with format specifiers

ℹ Unsafe fix
50 50 | 
51 51 | print("%(ab)s" % {"a" "b": 1})
52 52 | 
53    |-print("%(a)s" % {"a"  :  1})
   53 |+print("{a}".format(a=1))
54 54 | 
55 55 | print((
56 56 |     "foo %s "

UP031_0.py:56:5: UP031 [*] Use format specifiers instead of percent format
   |
55 |   print((
56 |       "foo %s "
   |  _____^
57 | |     "bar %s" % (x, y)
   | |_____________________^ UP031
58 |   ))
   |
   = help: Replace with format specifiers

ℹ Unsafe fix
53 53 | print("%(a)s" % {"a"  :  1})
54 54 | 
55 55 | print((
56    |-    "foo %s "
57    |-    "bar %s" % (x, y)
   56 |+    "foo {} "
   57 |+    "bar {}".format(x, y)
58 58 | ))
59 59 | 
60 60 | print(

UP031_0.py:61:5: UP031 [*] Use format specifiers instead of percent format
   |
60 |   print(
61 |       "foo %(foo)s "
   |  _____^
62 | |     "bar %(bar)s" % {"foo": x, "bar": y}
   | |________________________________________^ UP031
63 |   )
   |
   = help: Replace with format specifiers

ℹ Unsafe fix
58 58 | ))
59 59 | 
60 60 | print(
61    |-    "foo %(foo)s "
62    |-    "bar %(bar)s" % {"foo": x, "bar": y}
   61 |+    "foo {foo} "
   62 |+    "bar {bar}".format(foo=x, bar=y)
63 63 | )
64 64 | 
65 65 | bar = {"bar": y}

UP031_0.py:67:5: UP031 [*] Use format specifiers instead of percent format
   |
65 |   bar = {"bar": y}
66 |   print(
67 |       "foo %(foo)s "
   |  _____^
68 | |     "bar %(bar)s" % {"foo": x, **bar}
   | |_____________________________________^ UP031
69 |   )
   |
   = help: Replace with format specifiers

ℹ Unsafe fix
64 64 | 
65 65 | bar = {"bar": y}
66 66 | print(
67    |-    "foo %(foo)s "
68    |-    "bar %(bar)s" % {"foo": x, **bar}
   67 |+    "foo {foo} "
   68 |+    "bar {bar}".format(foo=x, **bar)
69 69 | )
70 70 | 
71 71 | print("%s \N{snowman}" % (a,))

UP031_0.py:71:7: UP031 [*] Use format specifiers instead of percent format
   |
69 | )
70 | 
71 | print("%s \N{snowman}" % (a,))
   |       ^^^^^^^^^^^^^^^^^^^^^^^ UP031
72 | 
73 | print("%(foo)s \N{snowman}" % {"foo": 1})
   |
   = help: Replace with format specifiers

ℹ Unsafe fix
68 68 |     "bar %(bar)s" % {"foo": x, **bar}
69 69 | )
70 70 | 
71    |-print("%s \N{snowman}" % (a,))
   71 |+print("{} \N{snowman}".format(a))
72 72 | 
73 73 | print("%(foo)s \N{snowman}" % {"foo": 1})
74 74 | 

UP031_0.py:73:7: UP031 [*] Use format specifiers instead of percent format
   |
71 | print("%s \N{snowman}" % (a,))
72 | 
73 | print("%(foo)s \N{snowman}" % {"foo": 1})
   |       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP031
74 | 
75 | print(("foo %s " "bar %s") % (x, y))
   |
   = help: Replace with format specifiers

ℹ Unsafe fix
70 70 | 
71 71 | print("%s \N{snowman}" % (a,))
72 72 | 
73    |-print("%(foo)s \N{snowman}" % {"foo": 1})
   73 |+print("{foo} \N{snowman}".format(foo=1))
74 74 | 
75 75 | print(("foo %s " "bar %s") % (x, y))
76 76 | 

UP031_0.py:75:7: UP031 [*] Use format specifiers instead of percent format
   |
73 | print("%(foo)s \N{snowman}" % {"foo": 1})
74 | 
75 | print(("foo %s " "bar %s") % (x, y))
   |       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP031
76 | 
77 | # Single-value expressions
   |
   = help: Replace with format specifiers

ℹ Unsafe fix
72 72 | 
73 73 | print("%(foo)s \N{snowman}" % {"foo": 1})
74 74 | 
75    |-print(("foo %s " "bar %s") % (x, y))
   75 |+print(("foo {} " "bar {}").format(x, y))
76 76 | 
77 77 | # Single-value expressions
78 78 | print('Hello %s' % "World")

UP031_0.py:78:7: UP031 [*] Use format specifiers instead of percent format
   |
77 | # Single-value expressions
78 | print('Hello %s' % "World")
   |       ^^^^^^^^^^^^^^^^^^^^ UP031
79 | print('Hello %s' % f"World")
80 | print('Hello %s (%s)' % bar)
   |
   = help: Replace with format specifiers

ℹ Unsafe fix
75 75 | print(("foo %s " "bar %s") % (x, y))
76 76 | 
77 77 | # Single-value expressions
78    |-print('Hello %s' % "World")
   78 |+print('Hello {}'.format("World"))
79 79 | print('Hello %s' % f"World")
80 80 | print('Hello %s (%s)' % bar)
81 81 | print('Hello %s (%s)' % bar.baz)

UP031_0.py:79:7: UP031 [*] Use format specifiers instead of percent format
   |
77 | # Single-value expressions
78 | print('Hello %s' % "World")
79 | print('Hello %s' % f"World")
   |       ^^^^^^^^^^^^^^^^^^^^^ UP031
80 | print('Hello %s (%s)' % bar)
81 | print('Hello %s (%s)' % bar.baz)
   |
   = help: Replace with format specifiers

ℹ Unsafe fix
76 76 | 
77 77 | # Single-value expressions
78 78 | print('Hello %s' % "World")
79    |-print('Hello %s' % f"World")
   79 |+print('Hello {}'.format(f"World"))
80 80 | print('Hello %s (%s)' % bar)
81 81 | print('Hello %s (%s)' % bar.baz)
82 82 | print('Hello %s (%s)' % bar['bop'])

UP031_0.py:80:7: UP031 [*] Use format specifiers instead of percent format
   |
78 | print('Hello %s' % "World")
79 | print('Hello %s' % f"World")
80 | print('Hello %s (%s)' % bar)
   |       ^^^^^^^^^^^^^^^^^^^^^ UP031
81 | print('Hello %s (%s)' % bar.baz)
82 | print('Hello %s (%s)' % bar['bop'])
   |
   = help: Replace with format specifiers

ℹ Unsafe fix
77 77 | # Single-value expressions
78 78 | print('Hello %s' % "World")
79 79 | print('Hello %s' % f"World")
80    |-print('Hello %s (%s)' % bar)
   80 |+print('Hello {} ({})'.format(*bar))
81 81 | print('Hello %s (%s)' % bar.baz)
82 82 | print('Hello %s (%s)' % bar['bop'])
83 83 | print('Hello %(arg)s' % bar)

UP031_0.py:81:7: UP031 [*] Use format specifiers instead of percent format
   |
79 | print('Hello %s' % f"World")
80 | print('Hello %s (%s)' % bar)
81 | print('Hello %s (%s)' % bar.baz)
   |       ^^^^^^^^^^^^^^^^^^^^^^^^^ UP031
82 | print('Hello %s (%s)' % bar['bop'])
83 | print('Hello %(arg)s' % bar)
   |
   = help: Replace with format specifiers

ℹ Unsafe fix
78 78 | print('Hello %s' % "World")
79 79 | print('Hello %s' % f"World")
80 80 | print('Hello %s (%s)' % bar)
81    |-print('Hello %s (%s)' % bar.baz)
   81 |+print('Hello {} ({})'.format(*bar.baz))
82 82 | print('Hello %s (%s)' % bar['bop'])
83 83 | print('Hello %(arg)s' % bar)
84 84 | print('Hello %(arg)s' % bar.baz)

UP031_0.py:82:7: UP031 [*] Use format specifiers instead of percent format
   |
80 | print('Hello %s (%s)' % bar)
81 | print('Hello %s (%s)' % bar.baz)
82 | print('Hello %s (%s)' % bar['bop'])
   |       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP031
83 | print('Hello %(arg)s' % bar)
84 | print('Hello %(arg)s' % bar.baz)
   |
   = help: Replace with format specifiers

ℹ Unsafe fix
79 79 | print('Hello %s' % f"World")
80 80 | print('Hello %s (%s)' % bar)
81 81 | print('Hello %s (%s)' % bar.baz)
82    |-print('Hello %s (%s)' % bar['bop'])
   82 |+print('Hello {} ({})'.format(*bar['bop']))
83 83 | print('Hello %(arg)s' % bar)
84 84 | print('Hello %(arg)s' % bar.baz)
85 85 | print('Hello %(arg)s' % bar['bop'])

UP031_0.py:83:7: UP031 [*] Use format specifiers instead of percent format
   |
81 | print('Hello %s (%s)' % bar.baz)
82 | print('Hello %s (%s)' % bar['bop'])
83 | print('Hello %(arg)s' % bar)
   |       ^^^^^^^^^^^^^^^^^^^^^ UP031
84 | print('Hello %(arg)s' % bar.baz)
85 | print('Hello %(arg)s' % bar['bop'])
   |
   = help: Replace with format specifiers

ℹ Unsafe fix
80 80 | print('Hello %s (%s)' % bar)
81 81 | print('Hello %s (%s)' % bar.baz)
82 82 | print('Hello %s (%s)' % bar['bop'])
83    |-print('Hello %(arg)s' % bar)
   83 |+print('Hello {arg}'.format(**bar))
84 84 | print('Hello %(arg)s' % bar.baz)
85 85 | print('Hello %(arg)s' % bar['bop'])
86 86 | 

UP031_0.py:84:7: UP031 [*] Use format specifiers instead of percent format
   |
82 | print('Hello %s (%s)' % bar['bop'])
83 | print('Hello %(arg)s' % bar)
84 | print('Hello %(arg)s' % bar.baz)
   |       ^^^^^^^^^^^^^^^^^^^^^^^^^ UP031
85 | print('Hello %(arg)s' % bar['bop'])
   |
   = help: Replace with format specifiers

ℹ Unsafe fix
81 81 | print('Hello %s (%s)' % bar.baz)
82 82 | print('Hello %s (%s)' % bar['bop'])
83 83 | print('Hello %(arg)s' % bar)
84    |-print('Hello %(arg)s' % bar.baz)
   84 |+print('Hello {arg}'.format(**bar.baz))
85 85 | print('Hello %(arg)s' % bar['bop'])
86 86 | 
87 87 | # Hanging modulos

UP031_0.py:85:7: UP031 [*] Use format specifiers instead of percent format
   |
83 | print('Hello %(arg)s' % bar)
84 | print('Hello %(arg)s' % bar.baz)
85 | print('Hello %(arg)s' % bar['bop'])
   |       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UP031
86 | 
87 | # Hanging modulos
   |
   = help: Replace with format specifiers

ℹ Unsafe fix
82 82 | print('Hello %s (%s)' % bar['bop'])
83 83 | print('Hello %(arg)s' % bar)
84 84 | print('Hello %(arg)s' % bar.baz)
85    |-print('Hello %(arg)s' % bar['bop'])
   85 |+print('Hello {arg}'.format(**bar['bop']))
86 86 | 
87 87 | # Hanging modulos
88 88 | (

UP031_0.py:88:1: UP031 [*] Use format specifiers instead of percent format
   |
87 |   # Hanging modulos
88 | / (
89 | |     "foo %s "
90 | |     "bar %s"
91 | | ) % (x, y)
   | |__________^ UP031
92 |   
93 |   (
   |
   = help: Replace with format specifiers

ℹ Unsafe fix
86 86 | 
87 87 | # Hanging modulos
88 88 | (
89    |-    "foo %s "
90    |-    "bar %s"
91    |-) % (x, y)
   89 |+    "foo {} "
   90 |+    "bar {}"
   91 |+).format(x, y)
92 92 | 
93 93 | (
94 94 |     "foo %(foo)s "

UP031_0.py:93:1: UP031 [*] Use format specifiers instead of percent format
   |
91 |   ) % (x, y)
92 |   
93 | / (
94 | |     "foo %(foo)s "
95 | |     "bar %(bar)s"
96 | | ) % {"foo": x, "bar": y}
   | |________________________^ UP031
97 |   
98 |   (
   |
   = help: Replace with format specifiers

ℹ Unsafe fix
91 91 | ) % (x, y)
92 92 | 
93 93 | (
94    |-    "foo %(foo)s "
95    |-    "bar %(bar)s"
96    |-) % {"foo": x, "bar": y}
   94 |+    "foo {foo} "
   95 |+    "bar {bar}"
   96 |+).format(foo=x, bar=y)
97 97 | 
98 98 | (
99 99 |     """foo %s"""

UP031_0.py:99:5: UP031 [*] Use format specifiers instead of percent format
    |
 98 |   (
 99 |       """foo %s"""
    |  _____^
100 | |     % (x,)
    | |__________^ UP031
101 |   )
    |
    = help: Replace with format specifiers

ℹ Unsafe fix
96  96  | ) % {"foo": x, "bar": y}
97  97  | 
98  98  | (
99      |-    """foo %s"""
100     |-    % (x,)
    99  |+    """foo {}""".format(x)
101 100 | )
102 101 | 
103 102 | (

UP031_0.py:104:5: UP031 [*] Use format specifiers instead of percent format
    |
103 |   (
104 |       """
    |  _____^
105 | |     foo %s
106 | |     """
107 | |     % (x,)
    | |__________^ UP031
108 |   )
    |
    = help: Replace with format specifiers

ℹ Unsafe fix
102 102 | 
103 103 | (
104 104 |     """
105     |-    foo %s
106     |-    """
107     |-    % (x,)
    105 |+    foo {}
    106 |+    """.format(x)
108 107 | )
109 108 | 
110 109 | "%s" % (

UP031_0.py:110:1: UP031 [*] Use format specifiers instead of percent format
    |
108 |   )
109 |   
110 | / "%s" % (
111 | |     x,  # comment
112 | | )
    | |_^ UP031
    |
    = help: Replace with format specifiers

ℹ Unsafe fix
107 107 |     % (x,)
108 108 | )
109 109 | 
110     |-"%s" % (
    110 |+"{}".format(
111 111 |     x,  # comment
112 112 | )
113 113 | 

UP031_0.py:115:8: UP031 [*] Use format specifiers instead of percent format
    |
115 |   path = "%s-%s-%s.pem" % (
    |  ________^
116 | |     safe_domain_name(cn), # common name, which should be filename safe because it is IDNA-encoded, but in case of a malformed cert make sure it's ok to use as a filename
117 | |     cert.not_valid_after.date().isoformat().replace("-", ""), # expiration date
118 | |     hexlify(cert.fingerprint(hashes.SHA256())).decode("ascii")[0:8], # fingerprint prefix
119 | | )
    | |_^ UP031
    |
    = help: Replace with format specifiers

ℹ Unsafe fix
112 112 | )
113 113 | 
114 114 | 
115     |-path = "%s-%s-%s.pem" % (
    115 |+path = "{}-{}-{}.pem".format(
116 116 |     safe_domain_name(cn), # common name, which should be filename safe because it is IDNA-encoded, but in case of a malformed cert make sure it's ok to use as a filename
117 117 |     cert.not_valid_after.date().isoformat().replace("-", ""), # expiration date
118 118 |     hexlify(cert.fingerprint(hashes.SHA256())).decode("ascii")[0:8], # fingerprint prefix


