1313from typing import Any , Callable , Tuple
1414
1515import tzlocal
16- from websocket import ABNF , WebSocketApp # pyright: ignore [reportMissingTypeStubs ]
16+ from websocket import ABNF , WebSocketApp # pyright: ignore [reportPrivateImportUsage ]
1717
1818from ._rscpLib import (
1919 rscpDecode ,
@@ -120,11 +120,9 @@ def __init__(
120120 self .serialNumberWithPrefix = serialNumberWithPrefix .encode ("utf-8" )
121121 self .ws = WebSocketApp (
122122 REMOTE_ADDRESS ,
123- on_message = lambda _ , msg : self .on_message ( # pyright: ignore [reportUnknownLambdaType]
124- msg # pyright: ignore [reportUnknownArgumentType]
125- ),
126- on_close = lambda _ : self .reset (), # pyright: ignore [reportUnknownLambdaType]
127- on_error = lambda _ : self .reset (), # pyright: ignore [reportUnknownLambdaType]
123+ on_message = lambda _ , msg : self .on_message (msg ),
124+ on_close = lambda _ws , _ , __ : self .reset (),
125+ on_error = lambda _ws , _ : self .reset (),
128126 )
129127 self .reset ()
130128
@@ -163,9 +161,7 @@ def buildVirtualConn(self):
163161 )
164162
165163 # print("--------------------- Sending virtual conn")
166- self .ws .send (
167- virtualConn , ABNF .OPCODE_BINARY # pyright: ignore [reportGeneralTypeIssues]
168- )
164+ self .ws .send (virtualConn , ABNF .OPCODE_BINARY )
169165
170166 def respondToINFORequest (
171167 self , decoded : Tuple [str | int | RscpTag , str | int | RscpType , Any ]
@@ -255,9 +251,7 @@ def registerConnectionHandler(
255251 ],
256252 )
257253 )
258- self .ws .send (
259- reply , ABNF .OPCODE_BINARY # pyright: ignore [reportGeneralTypeIssues]
260- )
254+ self .ws .send (reply , ABNF .OPCODE_BINARY )
261255
262256 def on_message (self , message : bytes ):
263257 """Method to handle a received message."""
@@ -278,7 +272,7 @@ def on_message(self, message: bytes):
278272 rscpEncode (RscpTag .SERVER_PING , RscpType .NoneType , None )
279273 )
280274 self .ws .send (
281- pingFrame , # pyright: ignore [reportGeneralTypeIssues]
275+ pingFrame ,
282276 ABNF .OPCODE_BINARY ,
283277 )
284278 return
@@ -328,9 +322,7 @@ def on_message(self, message: bytes):
328322 )
329323
330324 self .ws .send (
331- rscpFrame (
332- responseContainer
333- ), # pyright: ignore [reportGeneralTypeIssues]
325+ rscpFrame (responseContainer ),
334326 ABNF .OPCODE_BINARY ,
335327 )
336328
@@ -406,9 +398,7 @@ def _sendRequest_internal(
406398 )
407399 )
408400
409- self .ws .send (
410- outerFrame , ABNF .OPCODE_BINARY # pyright: ignore [reportGeneralTypeIssues]
411- )
401+ self .ws .send (outerFrame , ABNF .OPCODE_BINARY )
412402
413403 def connect (self ):
414404 """Connect to E3DC system."""
0 commit comments