mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-08-15 20:38:05 +08:00
[grpcio] ServerInterceptor and GenericRpcHandler should not be generic (#14785)
This commit is contained in:
@@ -108,8 +108,8 @@ def composite_channel_credentials(
|
||||
|
||||
def server(
|
||||
thread_pool: futures.ThreadPoolExecutor,
|
||||
handlers: list[GenericRpcHandler[Any, Any]] | None = None,
|
||||
interceptors: list[ServerInterceptor[Any, Any]] | None = None,
|
||||
handlers: list[GenericRpcHandler] | None = None,
|
||||
interceptors: list[ServerInterceptor] | None = None,
|
||||
options: _Options | None = None,
|
||||
maximum_concurrent_rpcs: int | None = None,
|
||||
compression: Compression | None = None,
|
||||
@@ -173,7 +173,7 @@ def stream_stream_rpc_method_handler(
|
||||
) -> RpcMethodHandler[_TRequest, _TResponse]: ...
|
||||
def method_handlers_generic_handler(
|
||||
service: str, method_handlers: dict[str, RpcMethodHandler[Any, Any]]
|
||||
) -> GenericRpcHandler[Any, Any]: ...
|
||||
) -> GenericRpcHandler: ...
|
||||
|
||||
# Channel Ready Future:
|
||||
|
||||
@@ -264,7 +264,7 @@ class Channel(abc.ABC):
|
||||
|
||||
class Server(abc.ABC):
|
||||
@abc.abstractmethod
|
||||
def add_generic_rpc_handlers(self, generic_rpc_handlers: Iterable[GenericRpcHandler[Any, Any]]) -> None: ...
|
||||
def add_generic_rpc_handlers(self, generic_rpc_handlers: Iterable[GenericRpcHandler]) -> None: ...
|
||||
|
||||
# Returns an integer port on which server will accept RPC requests.
|
||||
@abc.abstractmethod
|
||||
@@ -493,17 +493,19 @@ class HandlerCallDetails(abc.ABC):
|
||||
method: str
|
||||
invocation_metadata: _Metadata
|
||||
|
||||
class GenericRpcHandler(abc.ABC, Generic[_TRequest, _TResponse]):
|
||||
class GenericRpcHandler(abc.ABC):
|
||||
# The return type depends on the handler call details.
|
||||
@abc.abstractmethod
|
||||
def service(self, handler_call_details: HandlerCallDetails) -> RpcMethodHandler[_TRequest, _TResponse] | None: ...
|
||||
def service(self, handler_call_details: HandlerCallDetails) -> RpcMethodHandler[Any, Any] | None: ...
|
||||
|
||||
class ServiceRpcHandler(GenericRpcHandler[_TRequest, _TResponse], metaclass=abc.ABCMeta):
|
||||
class ServiceRpcHandler(GenericRpcHandler, metaclass=abc.ABCMeta):
|
||||
@abc.abstractmethod
|
||||
def service_name(self) -> str: ...
|
||||
|
||||
# Service-Side Interceptor:
|
||||
|
||||
class ServerInterceptor(abc.ABC, Generic[_TRequest, _TResponse]):
|
||||
class ServerInterceptor(abc.ABC):
|
||||
# This method (not the class) is generic over _TRequest and _TResponse.
|
||||
@abc.abstractmethod
|
||||
def intercept_service(
|
||||
self,
|
||||
|
||||
@@ -65,8 +65,8 @@ def secure_channel(
|
||||
|
||||
def server(
|
||||
migration_thread_pool: futures.Executor | None = None,
|
||||
handlers: Sequence[GenericRpcHandler[Any, Any]] | None = None,
|
||||
interceptors: Sequence[ServerInterceptor[Any, Any]] | None = None,
|
||||
handlers: Sequence[GenericRpcHandler] | None = None,
|
||||
interceptors: Sequence[ServerInterceptor] | None = None,
|
||||
options: _Options | None = None,
|
||||
maximum_concurrent_rpcs: int | None = None,
|
||||
compression: Compression | None = None,
|
||||
@@ -125,7 +125,7 @@ class Channel(abc.ABC):
|
||||
|
||||
class Server(metaclass=abc.ABCMeta):
|
||||
@abc.abstractmethod
|
||||
def add_generic_rpc_handlers(self, generic_rpc_handlers: Iterable[GenericRpcHandler[Any, Any]]) -> None: ...
|
||||
def add_generic_rpc_handlers(self, generic_rpc_handlers: Iterable[GenericRpcHandler]) -> None: ...
|
||||
|
||||
# Returns an integer port on which server will accept RPC requests.
|
||||
@abc.abstractmethod
|
||||
@@ -355,7 +355,8 @@ class StreamStreamClientInterceptor(Generic[_TRequest, _TResponse], metaclass=ab
|
||||
|
||||
# Server-Side Interceptor:
|
||||
|
||||
class ServerInterceptor(Generic[_TRequest, _TResponse], metaclass=abc.ABCMeta):
|
||||
class ServerInterceptor(metaclass=abc.ABCMeta):
|
||||
# This method (not the class) is generic over _TRequest and _TResponse.
|
||||
@abc.abstractmethod
|
||||
async def intercept_service(
|
||||
self,
|
||||
|
||||
Reference in New Issue
Block a user