@@ -194,9 +194,8 @@ def _feed_data(self, data: bytes) -> None:
194194 if self ._max_msg_size and len (self ._partial ) >= self ._max_msg_size :
195195 raise WebSocketError (
196196 WSCloseCode .MESSAGE_TOO_BIG ,
197- "Message size {} exceeds limit {}" .format (
198- len (self ._partial ), self ._max_msg_size
199- ),
197+ f"Message size { len (self ._partial )} "
198+ f"exceeds limit { self ._max_msg_size } " ,
200199 )
201200 continue
202201
@@ -215,7 +214,7 @@ def _feed_data(self, data: bytes) -> None:
215214 raise WebSocketError (
216215 WSCloseCode .PROTOCOL_ERROR ,
217216 "The opcode in non-fin frame is expected "
218- "to be zero, got {!r}" . format ( opcode ) ,
217+ f "to be zero, got { opcode !r} " ,
219218 )
220219
221220 assembled_payload : Union [bytes , bytearray ]
@@ -228,9 +227,8 @@ def _feed_data(self, data: bytes) -> None:
228227 if self ._max_msg_size and len (assembled_payload ) >= self ._max_msg_size :
229228 raise WebSocketError (
230229 WSCloseCode .MESSAGE_TOO_BIG ,
231- "Message size {} exceeds limit {}" .format (
232- len (assembled_payload ), self ._max_msg_size
233- ),
230+ f"Message size { len (assembled_payload )} "
231+ f"exceeds limit { self ._max_msg_size } " ,
234232 )
235233
236234 # Decompress process must to be done after all packets
@@ -247,9 +245,8 @@ def _feed_data(self, data: bytes) -> None:
247245 left = len (self ._decompressobj .unconsumed_tail )
248246 raise WebSocketError (
249247 WSCloseCode .MESSAGE_TOO_BIG ,
250- "Decompressed message size {} exceeds limit {}" .format (
251- self ._max_msg_size + left , self ._max_msg_size
252- ),
248+ f"Decompressed message size { self ._max_msg_size + left } "
249+ f" exceeds limit { self ._max_msg_size } " ,
253250 )
254251 elif type (assembled_payload ) is bytes :
255252 payload_merged = assembled_payload
0 commit comments