@@ -118,7 +118,7 @@ def __init__(self, stream):
118
118
self .conn = h11 .Connection (h11 .SERVER )
119
119
# Our Server: header
120
120
self .ident = " " .join (
121
- ["h11-example-trio-server/{}" . format ( h11 .__version__ ) , h11 .PRODUCT_ID ]
121
+ [f "h11-example-trio-server/{ h11 .__version__ } " , h11 .PRODUCT_ID ]
122
122
).encode ("ascii" )
123
123
# A unique id for this connection, to include in debugging output
124
124
# (useful for understanding what's going on if there are multiple
@@ -206,7 +206,7 @@ def basic_headers(self):
206
206
207
207
def info (self , * args ):
208
208
# Little debugging method
209
- print ("{}:" . format ( self ._obj_id ) , * args )
209
+ print (f" { self ._obj_id } :" , * args )
210
210
211
211
212
212
################################################################
@@ -253,7 +253,7 @@ async def http_serve(stream):
253
253
if type (event ) is h11 .Request :
254
254
await send_echo_response (wrapper , event )
255
255
except Exception as exc :
256
- wrapper .info ("Error during response handler: {!r}" . format ( exc ) )
256
+ wrapper .info (f "Error during response handler: { exc !r} " )
257
257
await maybe_send_error_response (wrapper , exc )
258
258
259
259
if wrapper .conn .our_state is h11 .MUST_CLOSE :
@@ -268,7 +268,7 @@ async def http_serve(stream):
268
268
states = wrapper .conn .states
269
269
wrapper .info ("unexpected state" , states , "-- bailing out" )
270
270
await maybe_send_error_response (
271
- wrapper , RuntimeError ("unexpected state {}" . format ( states ) )
271
+ wrapper , RuntimeError (f "unexpected state { states } " )
272
272
)
273
273
await wrapper .shutdown_and_clean_up ()
274
274
return
@@ -343,7 +343,7 @@ async def send_echo_response(wrapper, request):
343
343
344
344
345
345
async def serve (port ):
346
- print ("listening on http://localhost:{}" . format ( port ) )
346
+ print (f "listening on http://localhost:{ port } " )
347
347
try :
348
348
await trio .serve_tcp (http_serve , port )
349
349
except KeyboardInterrupt :
0 commit comments