X-Git-Url: http://average.org/gitweb/?a=blobdiff_plain;f=loctrkd%2Fprotomodule.py;h=a1698f2fde7ae52389a62b16dccf265122bacc93;hb=2a5d40ae0d3eebe40e6b53ee0776e10b228179f2;hp=1a6f0fc5ada46a73cb83d1536c9ad0d3d717d6c6;hpb=cbb7603aebedf517d7b7c61ff6de02d3e7193409;p=loctrkd.git diff --git a/loctrkd/protomodule.py b/loctrkd/protomodule.py index 1a6f0fc..a1698f2 100644 --- a/loctrkd/protomodule.py +++ b/loctrkd/protomodule.py @@ -88,6 +88,10 @@ class ProtoClass(Protocol, metaclass=_MetaProto): IN_KWARGS: Tuple[Tuple[str, Callable[[Any], Any], Any], ...] = () OUT_KWARGS: Tuple[Tuple[str, Callable[[Any], Any], Any], ...] = () + @classmethod + def proto_name(cls) -> str: + ... + class In: def __init__(self, *args: Any, **kwargs: Any) -> None: ... @@ -118,6 +122,8 @@ class ProtoClass(Protocol, metaclass=_MetaProto): class ProtoModule: + __name__: str + class Stream: def recv(self, segment: bytes) -> List[Union[bytes, str]]: ... @@ -129,6 +135,9 @@ class ProtoModule: def enframe(buffer: bytes, imei: Optional[str] = None) -> bytes: ... + class DecodeError(Exception): + ... + @staticmethod def exposed_protos() -> List[Tuple[str, bool]]: ... @@ -164,3 +173,9 @@ class ProtoModule: @staticmethod def class_by_prefix(prefix: str) -> Union[Type[ProtoClass], List[str]]: ... + + @staticmethod + def make_response( + cmd: str, imei: str, **kwargs: Any + ) -> Optional[ProtoClass.Out]: + ...