5
5
See https://tox.readthedocs.io/en/rewrite/development.html#code-style-guide
6
6
"""
7
7
8
- from __future__ import print_function
9
-
10
8
import importlib
11
9
import json
12
10
import locale
@@ -31,12 +29,12 @@ def __init__(self, backend_module, backend_obj):
31
29
def __call__ (self , name , * args , ** kwargs ):
32
30
on_object = self if name .startswith ("_" ) else self .backend
33
31
if not hasattr (on_object , name ):
34
- msg = "{ !r} has no attribute {!r}". format ( on_object , name )
32
+ msg = f" { on_object !r} has no attribute { name !r} "
35
33
raise MissingCommand (msg )
36
34
return getattr (on_object , name )(* args , ** kwargs )
37
35
38
36
def __str__ (self ):
39
- return "{ }(backend={})" . format ( self .__class__ . __name__ , self . backend )
37
+ return f" { self . __class__ . __name__ } (backend={ self .backend } )"
40
38
41
39
def _exit (self ): # noqa: PLR6301
42
40
return 0
@@ -69,7 +67,7 @@ def run(argv): # noqa: C901, PLR0912, PLR0915
69
67
print ("failed to start backend" , file = sys .stderr )
70
68
raise
71
69
else :
72
- print ("started backend {}" . format ( backend_proxy ) , file = sys .stdout )
70
+ print (f "started backend { backend_proxy } " , file = sys .stdout )
73
71
finally :
74
72
flush () # pragma: no branch
75
73
while True :
@@ -85,7 +83,7 @@ def run(argv): # noqa: C901, PLR0912, PLR0915
85
83
result_file = parsed_message ["result" ]
86
84
except Exception : # noqa: BLE001
87
85
# ignore messages that are not valid JSON and contain a valid result path
88
- print ("Backend: incorrect request to backend: {}" . format ( content ) , file = sys .stderr )
86
+ print (f "Backend: incorrect request to backend: { content } " , file = sys .stderr )
89
87
flush ()
90
88
else :
91
89
result = {}
@@ -111,7 +109,7 @@ def run(argv): # noqa: C901, PLR0912, PLR0915
111
109
traceback .print_exc ()
112
110
finally :
113
111
# used as done marker by frontend
114
- print ("Backend: Wrote response {} to {}" . format ( result , result_file ) )
112
+ print (f "Backend: Wrote response { result } to { result_file } " )
115
113
flush () # pragma: no branch
116
114
if reuse_process is False : # pragma: no branch # no test for reuse process in root test env
117
115
break
0 commit comments