55See https://tox.readthedocs.io/en/rewrite/development.html#code-style-guide
66"""
77
8- from __future__ import print_function
9-
108import importlib
119import json
1210import locale
@@ -31,12 +29,12 @@ def __init__(self, backend_module, backend_obj):
3129 def __call__ (self , name , * args , ** kwargs ):
3230 on_object = self if name .startswith ("_" ) else self .backend
3331 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} "
3533 raise MissingCommand (msg )
3634 return getattr (on_object , name )(* args , ** kwargs )
3735
3836 def __str__ (self ):
39- return "{ }(backend={})" . format ( self .__class__ . __name__ , self . backend )
37+ return f" { self . __class__ . __name__ } (backend={ self .backend } )"
4038
4139 def _exit (self ): # noqa: PLR6301
4240 return 0
@@ -69,7 +67,7 @@ def run(argv): # noqa: C901, PLR0912, PLR0915
6967 print ("failed to start backend" , file = sys .stderr )
7068 raise
7169 else :
72- print ("started backend {}" . format ( backend_proxy ) , file = sys .stdout )
70+ print (f "started backend { backend_proxy } " , file = sys .stdout )
7371 finally :
7472 flush () # pragma: no branch
7573 while True :
@@ -85,7 +83,7 @@ def run(argv): # noqa: C901, PLR0912, PLR0915
8583 result_file = parsed_message ["result" ]
8684 except Exception : # noqa: BLE001
8785 # 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 )
8987 flush ()
9088 else :
9189 result = {}
@@ -111,7 +109,7 @@ def run(argv): # noqa: C901, PLR0912, PLR0915
111109 traceback .print_exc ()
112110 finally :
113111 # 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 } " )
115113 flush () # pragma: no branch
116114 if reuse_process is False : # pragma: no branch # no test for reuse process in root test env
117115 break
0 commit comments