@@ -59,7 +59,7 @@ def send_msg(self, msg: Any) -> None:
5959 Connection ._write_msg (msg , self .socket )
6060
6161 @staticmethod
62- def _write_int32 (value , sock ) :
62+ def _write_int32 (value : int , sock : socket . socket ) -> None :
6363 b = [
6464 ((value >> 24 ) & 0xFF ),
6565 ((value >> 16 ) & 0xFF ),
@@ -70,7 +70,7 @@ def _write_int32(value, sock):
7070 sock .sendall (bytes (b ))
7171
7272 @staticmethod
73- def _readnbytes (sock , n ) :
73+ def _readnbytes (sock : socket . socket , n : int ) -> bytes :
7474 buff = b""
7575 while n > 0 :
7676 b = sock .recv (n )
@@ -81,7 +81,7 @@ def _readnbytes(sock, n):
8181 return buff
8282
8383 @staticmethod
84- def _read_int32 (sock ) :
84+ def _read_int32 (sock : socket . socket ) -> int :
8585 byte_array = Connection ._readnbytes (sock , 4 )
8686 value = int (
8787 ((byte_array [0 ]) << 24 )
@@ -92,15 +92,14 @@ def _read_int32(sock):
9292 return value
9393
9494 @staticmethod
95- def _write_msg (msg , sock ) :
95+ def _write_msg (msg : Any , sock : socket . socket ) -> None :
9696 out = msg .SerializeToString ()
9797 Connection ._write_int32 (len (out ), sock )
9898
9999 sock .sendall (out )
100100
101101 @staticmethod
102- def _read_msg (sock ):
103- # await reader.read(1)
102+ def _read_msg (sock : socket .socket ) -> RCRSProto_pb2 .MessageProto :
104103 size = Connection ._read_int32 (sock )
105104 content = Connection ._readnbytes (sock , size )
106105 message = RCRSProto_pb2 .MessageProto ()
0 commit comments