1- from collections .abc import Mapping , Sequence
1+ from collections .abc import Callable , Mapping , Sequence
22from contextlib import AbstractAsyncContextManager , AbstractContextManager
33from threading import Event as ThreadingEvent
44from types import ModuleType
5- from typing import Any , Literal , Protocol , TypeAlias , overload
5+ from typing import Any , Literal , TypeAlias , overload
66
77import engineio
88from _typeshed import Incomplete
@@ -19,7 +19,7 @@ from typing_extensions import NotRequired, Required, TypedDict
1919JsonType : TypeAlias = (
2020 str | int | float | bool | None | Sequence [JsonType ] | Mapping [str , JsonType ]
2121)
22- DataType : TypeAlias = str | bytes | Sequence [JsonType ] | Mapping [JsonType , JsonType ]
22+ DataType : TypeAlias = str | bytes | Sequence [JsonType ] | Mapping [str , JsonType ]
2323TransportType : TypeAlias = Literal ["websocket" , "polling" ]
2424SocketIOModeType : TypeAlias = Literal ["development" , "production" ]
2525SyncAsyncModeType : TypeAlias = Literal [
@@ -210,32 +210,13 @@ class JsonModule(ModuleType):
210210
211211## handlers
212212
213- class ServerConnectHandler (Protocol ):
214- def __call__ (self , sid : str , environ : Mapping [str , Any ]) -> Any : ...
215-
216- class ServerConnectHandlerWithData (Protocol ):
217- def __call__ (self , sid : str , environ : Mapping [str , Any ], data : Any ) -> Any : ...
218-
219- class ServerDisconnectHandler (Protocol ):
220- def __call__ (self , sid : str , reason : engineio .Server .reason ) -> Any : ...
221-
222- class ServerDisconnectLegacyHandler (Protocol ):
223- def __call__ (self , sid : str ) -> Any : ...
224-
225- class ClientConnectHandler (Protocol ):
226- def __call__ (self ) -> Any : ...
227-
228- class ClientDisconnectHandler (Protocol ):
229- def __call__ (self , reason : engineio .Client .reason ) -> Any : ...
230-
231- class ClientDisconnectLegacyHandler (Protocol ):
232- def __call__ (self ) -> Any : ...
233-
234- class ClientConnectErrorHandler (Protocol ):
235- def __call__ (self , data : Any ) -> Any : ...
236-
237- class CatchAllHandler (Protocol ):
238- def __call__ (self , event : str , sid : str , data : Any ) -> Any : ...
239-
240- class EventHandler (Protocol ):
241- def __call__ (self , sid : str , data : Any ) -> Any : ...
213+ ServerConnectHandler : TypeAlias = Callable [[str , dict [str , Any ]], Any ]
214+ ServerConnectHandlerWithData : TypeAlias = Callable [[str , dict [str , Any ], Any ], Any ]
215+ ServerDisconnectHandler : TypeAlias = Callable [[str , engineio .Server .reason ], Any ]
216+ ServerDisconnectLegacyHandler : TypeAlias = Callable [[str ], Any ]
217+ ClientConnectHandler : TypeAlias = Callable [[], Any ]
218+ ClientDisconnectHandler : TypeAlias = Callable [[engineio .Client .reason ], Any ]
219+ ClientDisconnectLegacyHandler : TypeAlias = Callable [[], Any ]
220+ ClientConnectErrorHandler : TypeAlias = Callable [[Any ], Any ]
221+ CatchAllHandler : TypeAlias = Callable [[str , str , Any ], Any ]
222+ EventHandler : TypeAlias = Callable [[str , Any ], DataType | tuple [DataType , ...] | None ]
0 commit comments