55import subprocess
66
77from logging import getLogger
8- from ssl import SSLContext
9- from typing import List , Dict , Tuple
8+ from typing import List , Dict
109
1110import numpy as np
1211import websockets
@@ -35,6 +34,7 @@ def create_client_ssl_context():
3534async def picows_main (endpoint : str , msg : bytes , duration : int , ssl_context ):
3635 cl_type = "plain" if ssl_context is None else "ssl"
3736 print (f"Run picows python { cl_type } client" )
37+
3838 class PicowsClientListener (WSListener ):
3939 def __init__ (self ):
4040 super ().__init__ ()
@@ -69,7 +69,7 @@ async def websockets_main(endpoint: str, msg: bytes, duration: int, ssl_context)
6969 start_time = time ()
7070 cnt = 0
7171 while True :
72- reply = await websocket .recv ()
72+ await websocket .recv ()
7373 cnt += 1
7474 if time () - start_time >= duration :
7575 break
@@ -163,12 +163,12 @@ async def aiohttp_main(url: str, data: bytes, duration: int, ssl_context):
163163 try :
164164 from examples .echo_client_cython import picows_main_cython
165165 if not args .picows_ssl_only :
166- print (f "Run picows cython plain client" )
166+ print ("Run picows cython plain client" )
167167 rps = asyncio .run (picows_main_cython (plain_url , msg , duration , None ))
168168 RPS ["plain" ].append (rps )
169169
170170 if not args .picows_plain_only :
171- print (f "Run picows cython ssl client" )
171+ print ("Run picows cython ssl client" )
172172 rps = asyncio .run (picows_main_cython (ssl_url , msg , duration , ssl_context ))
173173 RPS ["ssl" ].append (rps )
174174
@@ -177,7 +177,7 @@ async def aiohttp_main(url: str, data: bytes, duration: int, ssl_context):
177177 pass
178178
179179 if not args .picows_plain_only and not args .picows_ssl_only and args .boost_client is not None :
180- print (f "Run boost.beast plain client" )
180+ print ("Run boost.beast plain client" )
181181 pr = subprocess .run ([args .boost_client , b"0" ,
182182 args .host .encode (),
183183 args .plain_port .encode (),
@@ -186,15 +186,15 @@ async def aiohttp_main(url: str, data: bytes, duration: int, ssl_context):
186186 _ , rps = pr .stdout .split (b":" , 2 )
187187 RPS ["plain" ].append (int (rps .decode ()))
188188
189- print (f "Run boost.beast ssl client" )
189+ print ("Run boost.beast ssl client" )
190190 pr = subprocess .run ([args .boost_client , b"1" ,
191191 args .host .encode (),
192192 args .ssl_port .encode (),
193193 args .msg_size , args .duration ],
194194 shell = False , check = True , capture_output = True )
195195 name , rps = pr .stdout .split (b":" , 2 )
196196 RPS ["ssl" ].append (int (rps .decode ()))
197- NAMES .append (f "c++ boost.beast" )
197+ NAMES .append ("c++ boost.beast" )
198198
199199 if args .picows_plain_only or args .picows_ssl_only :
200200 exit ()
0 commit comments