from abc import abstractmethod
from typing import Mapping, Protocol, runtime_checkable
import grpclib
from grpclib._typing import IServable
from grpclib.client import Channel
[docs]class RPCServiceBase(IServable):
"""The base requirements for an RPC Service.
An RPC Service is a service that can handle incoming RPC requests.
Services that implement the service bases generated by grpclib will automatically conform to this protocol.
"""
[docs] @abstractmethod
def __mapping__(self) -> Mapping[str, grpclib.const.Handler]: ...
[docs]@runtime_checkable
class RPCServiceStubBase(Protocol):
def __init__(self, channel: Channel) -> None: ...