diff --git a/pyrightconfig.stricter.json b/pyrightconfig.stricter.json index 4242a2ba3..08ff5a63e 100644 --- a/pyrightconfig.stricter.json +++ b/pyrightconfig.stricter.json @@ -45,7 +45,10 @@ "stubs/geopandas", "stubs/google-cloud-ndb", "stubs/grpcio/grpc/__init__.pyi", - "stubs/grpcio/grpc_status/rpc_status.pyi", + "stubs/grpcio/grpc_channelz/v1", + "stubs/grpcio/grpc_health/v1/health_pb2_grpc.pyi", + "stubs/grpcio/grpc_reflection/v1alpha", + "stubs/grpcio/grpc_status", "stubs/hdbcli/hdbcli/dbapi.pyi", "stubs/html5lib", "stubs/httplib2", diff --git a/stubs/grpcio/@tests/stubtest_allowlist.txt b/stubs/grpcio/@tests/stubtest_allowlist.txt index dad6fb3e8..3409137cf 100644 --- a/stubs/grpcio/@tests/stubtest_allowlist.txt +++ b/stubs/grpcio/@tests/stubtest_allowlist.txt @@ -4,8 +4,3 @@ grpc.RpcError.code grpc.RpcError.details grpc.RpcError.trailing_metadata - -# Error: is inconsistent -# ============================= -# Stub class is incomplete. -grpc_reflection.v1alpha._base.BaseReflectionServicer.__init__ diff --git a/stubs/grpcio/grpc/__init__.pyi b/stubs/grpcio/grpc/__init__.pyi index 8f370e86a..caf5e9884 100644 --- a/stubs/grpcio/grpc/__init__.pyi +++ b/stubs/grpcio/grpc/__init__.pyi @@ -79,21 +79,21 @@ class Future(abc.ABC, Generic[_TFutureValue]): @abc.abstractmethod def done(self) -> bool: ... @abc.abstractmethod - def exception(self, timeout: float | None = ...) -> Exception | None: ... + def exception(self, timeout: float | None = None) -> Exception | None: ... @abc.abstractmethod - def result(self, timeout: float | None = ...) -> _TFutureValue: ... + def result(self, timeout: float | None = None) -> _TFutureValue: ... @abc.abstractmethod def running(self) -> bool: ... # FIXME: unsure of the exact return type here. Is it a traceback.StackSummary? @abc.abstractmethod - def traceback(self, timeout: float | None = ...) -> Any: ... + def traceback(self, timeout: float | None = None): ... # Create Client: -def insecure_channel(target: str, options: _Options | None = ..., compression: Compression | None = ...) -> Channel: ... +def insecure_channel(target: str, options: _Options | None = None, compression: Compression | None = None) -> Channel: ... def secure_channel( - target: str, credentials: ChannelCredentials, options: _Options | None = ..., compression: Compression | None = ... + target: str, credentials: ChannelCredentials, options: _Options | None = None, compression: Compression | None = None ) -> Channel: ... _Interceptor: TypeAlias = ( @@ -108,14 +108,14 @@ def intercept_channel(channel: Channel, *interceptors: _Interceptor[_TRequest, _ # Create Client Credentials: def ssl_channel_credentials( - root_certificates: bytes | None = ..., private_key: bytes | None = ..., certificate_chain: bytes | None = ... + root_certificates: bytes | None = None, private_key: bytes | None = None, certificate_chain: bytes | None = None ) -> ChannelCredentials: ... def local_channel_credentials(local_connect_type: LocalConnectionType = ...) -> ChannelCredentials: ... -def metadata_call_credentials(metadata_plugin: AuthMetadataPlugin, name: str | None = ...) -> CallCredentials: ... +def metadata_call_credentials(metadata_plugin: AuthMetadataPlugin, name: str | None = None) -> CallCredentials: ... def access_token_call_credentials(access_token: str) -> CallCredentials: ... -def alts_channel_credentials(service_accounts: Sequence[str] | None = ...) -> ChannelCredentials: ... +def alts_channel_credentials(service_accounts: Sequence[str] | None = None) -> ChannelCredentials: ... def compute_engine_channel_credentials(call_credentials: CallCredentials) -> ChannelCredentials: ... -def xds_channel_credentials(fallback_credentials: ChannelCredentials | None = ...) -> ChannelCredentials: ... +def xds_channel_credentials(fallback_credentials: ChannelCredentials | None = None) -> ChannelCredentials: ... # GRPC docs say there should be at least two: def composite_call_credentials(creds1: CallCredentials, creds2: CallCredentials, *rest: CallCredentials) -> CallCredentials: ... @@ -129,12 +129,12 @@ def composite_channel_credentials( def server( thread_pool: futures.ThreadPoolExecutor, - handlers: list[GenericRpcHandler[Any, Any]] | None = ..., - interceptors: list[ServerInterceptor[Any, Any]] | None = ..., - options: _Options | None = ..., - maximum_concurrent_rpcs: int | None = ..., - compression: Compression | None = ..., - xds: bool = ..., + handlers: list[GenericRpcHandler[Any, Any]] | None = None, + interceptors: list[ServerInterceptor[Any, Any]] | None = None, + options: _Options | None = None, + maximum_concurrent_rpcs: int | None = None, + compression: Compression | None = None, + xds: bool = False, ) -> Server: ... # Create Server Credentials: @@ -143,17 +143,17 @@ _CertificateChainPair: TypeAlias = tuple[bytes, bytes] def ssl_server_credentials( private_key_certificate_chain_pairs: list[_CertificateChainPair], - root_certificates: bytes | None = ..., - require_client_auth: bool = ..., + root_certificates: bytes | None = None, + require_client_auth: bool = False, ) -> ServerCredentials: ... def local_server_credentials(local_connect_type: LocalConnectionType = ...) -> ServerCredentials: ... def ssl_server_certificate_configuration( - private_key_certificate_chain_pairs: list[_CertificateChainPair], root_certificates: bytes | None = ... + private_key_certificate_chain_pairs: list[_CertificateChainPair], root_certificates: bytes | None = None ) -> ServerCertificateConfiguration: ... def dynamic_ssl_server_credentials( initial_certificate_configuration: ServerCertificateConfiguration, certificate_configuration_fetcher: Callable[[], ServerCertificateConfiguration], - require_client_authentication: bool = ..., + require_client_authentication: bool = False, ) -> ServerCredentials: ... def alts_server_credentials() -> ServerCredentials: ... def insecure_server_credentials() -> ServerCredentials: ... @@ -174,23 +174,23 @@ class _Behaviour(Protocol): def unary_unary_rpc_method_handler( behavior: _Behaviour, - request_deserializer: _RequestDeserializer | None = ..., - response_serializer: _ResponseSerializer | None = ..., + request_deserializer: _RequestDeserializer | None = None, + response_serializer: _ResponseSerializer | None = None, ) -> RpcMethodHandler[Any, Any]: ... def unary_stream_rpc_method_handler( behavior: _Behaviour, - request_deserializer: _RequestDeserializer | None = ..., - response_serializer: _ResponseSerializer | None = ..., + request_deserializer: _RequestDeserializer | None = None, + response_serializer: _ResponseSerializer | None = None, ) -> RpcMethodHandler[Any, Any]: ... def stream_unary_rpc_method_handler( behavior: _Behaviour, - request_deserializer: _RequestDeserializer | None = ..., - response_serializer: _ResponseSerializer | None = ..., + request_deserializer: _RequestDeserializer | None = None, + response_serializer: _ResponseSerializer | None = None, ) -> RpcMethodHandler[Any, Any]: ... def stream_stream_rpc_method_handler( behavior: _Behaviour, - request_deserializer: _RequestDeserializer | None = ..., - response_serializer: _ResponseSerializer | None = ..., + request_deserializer: _RequestDeserializer | None = None, + response_serializer: _ResponseSerializer | None = None, ) -> RpcMethodHandler[Any, Any]: ... def method_handlers_generic_handler( service: str, method_handlers: dict[str, RpcMethodHandler[Any, Any]] @@ -248,31 +248,31 @@ class Channel(abc.ABC): def stream_stream( self, method: str, - request_serializer: _RequestSerializer | None = ..., - response_deserializer: _ResponseDeserializer | None = ..., + request_serializer: _RequestSerializer | None = None, + response_deserializer: _ResponseDeserializer | None = None, ) -> StreamStreamMultiCallable[Any, Any]: ... @abc.abstractmethod def stream_unary( self, method: str, - request_serializer: _RequestSerializer | None = ..., - response_deserializer: _ResponseDeserializer | None = ..., + request_serializer: _RequestSerializer | None = None, + response_deserializer: _ResponseDeserializer | None = None, ) -> StreamUnaryMultiCallable[Any, Any]: ... @abc.abstractmethod - def subscribe(self, callback: Callable[[ChannelConnectivity], None], try_to_connect: bool = ...) -> None: ... + def subscribe(self, callback: Callable[[ChannelConnectivity], None], try_to_connect: bool = False) -> None: ... @abc.abstractmethod def unary_stream( self, method: str, - request_serializer: _RequestSerializer | None = ..., - response_deserializer: _ResponseDeserializer | None = ..., + request_serializer: _RequestSerializer | None = None, + response_deserializer: _ResponseDeserializer | None = None, ) -> UnaryStreamMultiCallable[Any, Any]: ... @abc.abstractmethod def unary_unary( self, method: str, - request_serializer: _RequestSerializer | None = ..., - response_deserializer: _ResponseDeserializer | None = ..., + request_serializer: _RequestSerializer | None = None, + response_deserializer: _ResponseDeserializer | None = None, ) -> UnaryUnaryMultiCallable[Any, Any]: ... @abc.abstractmethod def unsubscribe(self, callback: Callable[[ChannelConnectivity], None]) -> None: ... @@ -303,7 +303,7 @@ class Server(abc.ABC): # Block current thread until the server stops. Returns a bool # indicates if the operation times out. Timeout is in seconds. - def wait_for_termination(self, timeout: float | None = ...) -> bool: ... + def wait_for_termination(self, timeout: float | None = None) -> bool: ... # Authentication & Authorization Objects: @@ -538,34 +538,31 @@ class UnaryUnaryMultiCallable(abc.ABC, Generic[_TRequest, _TResponse]): def __call__( self, request: _TRequest, - timeout: float | None = ..., - metadata: _Metadata | None = ..., - credentials: CallCredentials | None = ..., - # FIXME: optional bool seems weird, but that's what the docs suggest - wait_for_ready: bool | None = ..., - compression: Compression | None = ..., + timeout: float | None = None, + metadata: _Metadata | None = None, + credentials: CallCredentials | None = None, + wait_for_ready: bool | None = None, + compression: Compression | None = None, ) -> _TResponse: ... @abc.abstractmethod def future( self, request: _TRequest, - timeout: float | None = ..., - metadata: _Metadata | None = ..., - credentials: CallCredentials | None = ..., - # FIXME: optional bool seems weird, but that's what the docs suggest - wait_for_ready: bool | None = ..., - compression: Compression | None = ..., + timeout: float | None = None, + metadata: _Metadata | None = None, + credentials: CallCredentials | None = None, + wait_for_ready: bool | None = None, + compression: Compression | None = None, ) -> _CallFuture[_TResponse]: ... @abc.abstractmethod def with_call( self, request: _TRequest, - timeout: float | None = ..., - metadata: _Metadata | None = ..., - credentials: CallCredentials | None = ..., - # FIXME: optional bool seems weird, but that's what the docs suggest - wait_for_ready: bool | None = ..., - compression: Compression | None = ..., + timeout: float | None = None, + metadata: _Metadata | None = None, + credentials: CallCredentials | None = None, + wait_for_ready: bool | None = None, + compression: Compression | None = None, # FIXME: Return value is documented as "The response value for the RPC and a Call value for the RPC"; # this is slightly unclear so this return type is a best-effort guess. ) -> tuple[_TResponse, Call]: ... @@ -575,12 +572,11 @@ class UnaryStreamMultiCallable(abc.ABC, Generic[_TRequest, _TResponse]): def __call__( self, request: _TRequest, - timeout: float | None = ..., - metadata: _Metadata | None = ..., - credentials: CallCredentials | None = ..., - # FIXME: optional bool seems weird, but that's what the docs suggest - wait_for_ready: bool | None = ..., - compression: Compression | None = ..., + timeout: float | None = None, + metadata: _Metadata | None = None, + credentials: CallCredentials | None = None, + wait_for_ready: bool | None = None, + compression: Compression | None = None, ) -> _CallIterator[_TResponse]: ... class StreamUnaryMultiCallable(abc.ABC, Generic[_TRequest, _TResponse]): @@ -588,34 +584,31 @@ class StreamUnaryMultiCallable(abc.ABC, Generic[_TRequest, _TResponse]): def __call__( self, request_iterator: Iterator[_TRequest], - timeout: float | None = ..., - metadata: _Metadata | None = ..., - credentials: CallCredentials | None = ..., - # FIXME: optional bool seems weird, but that's what the docs suggest - wait_for_ready: bool | None = ..., - compression: Compression | None = ..., + timeout: float | None = None, + metadata: _Metadata | None = None, + credentials: CallCredentials | None = None, + wait_for_ready: bool | None = None, + compression: Compression | None = None, ) -> _TResponse: ... @abc.abstractmethod def future( self, request_iterator: Iterator[_TRequest], - timeout: float | None = ..., - metadata: _Metadata | None = ..., - credentials: CallCredentials | None = ..., - # FIXME: optional bool seems weird, but that's what the docs suggest - wait_for_ready: bool | None = ..., - compression: Compression | None = ..., + timeout: float | None = None, + metadata: _Metadata | None = None, + credentials: CallCredentials | None = None, + wait_for_ready: bool | None = None, + compression: Compression | None = None, ) -> _CallFuture[_TResponse]: ... @abc.abstractmethod def with_call( self, request_iterator: Iterator[_TRequest], - timeout: float | None = ..., - metadata: _Metadata | None = ..., - credentials: CallCredentials | None = ..., - # FIXME: optional bool seems weird, but that's what the docs suggest - wait_for_ready: bool | None = ..., - compression: Compression | None = ..., + timeout: float | None = None, + metadata: _Metadata | None = None, + credentials: CallCredentials | None = None, + wait_for_ready: bool | None = None, + compression: Compression | None = None, # FIXME: Return value is documented as "The response value for the RPC and a Call value for the RPC"; # this is slightly unclear so this return type is a best-effort guess. ) -> tuple[_TResponse, Call]: ... @@ -625,12 +618,11 @@ class StreamStreamMultiCallable(abc.ABC, Generic[_TRequest, _TResponse]): def __call__( self, request_iterator: Iterator[_TRequest], - timeout: float | None = ..., - metadata: _Metadata | None = ..., - credentials: CallCredentials | None = ..., - # FIXME: optional bool seems weird, but that's what the docs suggest - wait_for_ready: bool | None = ..., - compression: Compression | None = ..., + timeout: float | None = None, + metadata: _Metadata | None = None, + credentials: CallCredentials | None = None, + wait_for_ready: bool | None = None, + compression: Compression | None = None, ) -> _CallIterator[_TResponse]: ... # Runtime Protobuf Parsing: diff --git a/stubs/grpcio/grpc/aio/__init__.pyi b/stubs/grpcio/grpc/aio/__init__.pyi index 8a9cb36bb..1b0f592a9 100644 --- a/stubs/grpcio/grpc/aio/__init__.pyi +++ b/stubs/grpcio/grpc/aio/__init__.pyi @@ -37,12 +37,9 @@ class AioRpcError(RpcError): code: StatusCode, initial_metadata: Metadata, trailing_metadata: Metadata, - details: str | None = ..., - debug_error_string: str | None = ..., + details: str | None = None, + debug_error_string: str | None = None, ) -> None: ... - - # FIXME: confirm if these are present in the parent type. The remaining - # methods already exist. def debug_error_string(self) -> str: ... def initial_metadata(self) -> Metadata: ... @@ -52,27 +49,27 @@ class ClientInterceptor(metaclass=abc.ABCMeta): ... def insecure_channel( target: str, - options: _Options | None = ..., - compression: Compression | None = ..., - interceptors: Sequence[ClientInterceptor] | None = ..., + options: _Options | None = None, + compression: Compression | None = None, + interceptors: Sequence[ClientInterceptor] | None = None, ) -> Channel: ... def secure_channel( target: str, credentials: ChannelCredentials, - options: _Options | None = ..., - compression: Compression | None = ..., - interceptors: Sequence[ClientInterceptor] | None = ..., + options: _Options | None = None, + compression: Compression | None = None, + interceptors: Sequence[ClientInterceptor] | None = None, ) -> Channel: ... # Create Server: def server( - migration_thread_pool: futures.Executor | None = ..., - handlers: Sequence[GenericRpcHandler[Any, Any]] | None = ..., - interceptors: Sequence[ServerInterceptor[Any, Any]] | None = ..., - options: _Options | None = ..., - maximum_concurrent_rpcs: int | None = ..., - compression: Compression | None = ..., + migration_thread_pool: futures.Executor | None = None, + handlers: Sequence[GenericRpcHandler[Any, Any]] | None = None, + interceptors: Sequence[ServerInterceptor[Any, Any]] | None = None, + options: _Options | None = None, + maximum_concurrent_rpcs: int | None = None, + compression: Compression | None = None, ) -> Server: ... # Channel Object: @@ -85,38 +82,38 @@ _ResponseDeserializer: TypeAlias = Callable[[bytes], Any] class Channel(abc.ABC): @abc.abstractmethod - async def close(self, grace: float | None = ...) -> None: ... + async def close(self, grace: float | None = None) -> None: ... @abc.abstractmethod - def get_state(self, try_to_connect: bool = ...) -> ChannelConnectivity: ... + def get_state(self, try_to_connect: bool = False) -> ChannelConnectivity: ... @abc.abstractmethod async def wait_for_state_change(self, last_observed_state: ChannelConnectivity) -> None: ... @abc.abstractmethod def stream_stream( self, method: str, - request_serializer: _RequestSerializer | None = ..., - response_deserializer: _ResponseDeserializer | None = ..., + request_serializer: _RequestSerializer | None = None, + response_deserializer: _ResponseDeserializer | None = None, ) -> StreamStreamMultiCallable[Any, Any]: ... @abc.abstractmethod def stream_unary( self, method: str, - request_serializer: _RequestSerializer | None = ..., - response_deserializer: _ResponseDeserializer | None = ..., + request_serializer: _RequestSerializer | None = None, + response_deserializer: _ResponseDeserializer | None = None, ) -> StreamUnaryMultiCallable[Any, Any]: ... @abc.abstractmethod def unary_stream( self, method: str, - request_serializer: _RequestSerializer | None = ..., - response_deserializer: _ResponseDeserializer | None = ..., + request_serializer: _RequestSerializer | None = None, + response_deserializer: _ResponseDeserializer | None = None, ) -> UnaryStreamMultiCallable[Any, Any]: ... @abc.abstractmethod def unary_unary( self, method: str, - request_serializer: _RequestSerializer | None = ..., - response_deserializer: _ResponseDeserializer | None = ..., + request_serializer: _RequestSerializer | None = None, + response_deserializer: _ResponseDeserializer | None = None, ) -> UnaryUnaryMultiCallable[Any, Any]: ... @abc.abstractmethod async def __aenter__(self) -> Self: ... @@ -149,7 +146,7 @@ class Server(metaclass=abc.ABCMeta): # Returns a bool indicates if the operation times out. Timeout is in seconds. @abc.abstractmethod - async def wait_for_termination(self, timeout: float | None = ...) -> bool: ... + async def wait_for_termination(self, timeout: float | None = None) -> bool: ... # Client-Side Context: @@ -216,7 +213,7 @@ class _DoneCallback(Generic[_TRequest, _TResponse]): class ServicerContext(Generic[_TRequest, _TResponse], metaclass=abc.ABCMeta): @abc.abstractmethod - async def abort(self, code: StatusCode, details: str = ..., trailing_metadata: _MetadataType = ...) -> NoReturn: ... + async def abort(self, code: StatusCode, details: str = "", trailing_metadata: _MetadataType = ()) -> NoReturn: ... @abc.abstractmethod async def read(self) -> _TRequest: ... @abc.abstractmethod @@ -377,12 +374,11 @@ class UnaryUnaryMultiCallable(Generic[_TRequest, _TResponse], metaclass=abc.ABCM self, request: _TRequest, *, - timeout: float | None = ..., - metadata: _MetadataType | None = ..., - credentials: CallCredentials | None = ..., - # FIXME: optional bool seems weird, but that's what the docs suggest - wait_for_ready: bool | None = ..., - compression: Compression | None = ..., + timeout: float | None = None, + metadata: _MetadataType | None = None, + credentials: CallCredentials | None = None, + wait_for_ready: bool | None = None, + compression: Compression | None = None, ) -> UnaryUnaryCall[_TRequest, _TResponse]: ... class UnaryStreamMultiCallable(Generic[_TRequest, _TResponse], metaclass=abc.ABCMeta): @@ -391,12 +387,11 @@ class UnaryStreamMultiCallable(Generic[_TRequest, _TResponse], metaclass=abc.ABC self, request: _TRequest, *, - timeout: float | None = ..., - metadata: _MetadataType | None = ..., - credentials: CallCredentials | None = ..., - # FIXME: optional bool seems weird, but that's what the docs suggest - wait_for_ready: bool | None = ..., - compression: Compression | None = ..., + timeout: float | None = None, + metadata: _MetadataType | None = None, + credentials: CallCredentials | None = None, + wait_for_ready: bool | None = None, + compression: Compression | None = None, ) -> UnaryStreamCall[_TRequest, _TResponse]: ... class StreamUnaryMultiCallable(Generic[_TRequest, _TResponse], metaclass=abc.ABCMeta): @@ -404,12 +399,11 @@ class StreamUnaryMultiCallable(Generic[_TRequest, _TResponse], metaclass=abc.ABC def __call__( self, request_iterator: AsyncIterator[_TRequest] | Iterator[_TRequest] | None = None, - timeout: float | None = ..., - metadata: _MetadataType | None = ..., - credentials: CallCredentials | None = ..., - # FIXME: optional bool seems weird, but that's what the docs suggest - wait_for_ready: bool | None = ..., - compression: Compression | None = ..., + timeout: float | None = None, + metadata: _MetadataType | None = None, + credentials: CallCredentials | None = None, + wait_for_ready: bool | None = None, + compression: Compression | None = None, ) -> StreamUnaryCall[_TRequest, _TResponse]: ... class StreamStreamMultiCallable(Generic[_TRequest, _TResponse], metaclass=abc.ABCMeta): @@ -417,12 +411,11 @@ class StreamStreamMultiCallable(Generic[_TRequest, _TResponse], metaclass=abc.AB def __call__( self, request_iterator: AsyncIterator[_TRequest] | Iterator[_TRequest] | None = None, - timeout: float | None = ..., - metadata: _MetadataType | None = ..., - credentials: CallCredentials | None = ..., - # FIXME: optional bool seems weird, but that's what the docs suggest - wait_for_ready: bool | None = ..., - compression: Compression | None = ..., + timeout: float | None = None, + metadata: _MetadataType | None = None, + credentials: CallCredentials | None = None, + wait_for_ready: bool | None = None, + compression: Compression | None = None, ) -> StreamStreamCall[_TRequest, _TResponse]: ... # Metadata: diff --git a/stubs/grpcio/grpc_channelz/__init__.pyi b/stubs/grpcio/grpc_channelz/__init__.pyi index 0f6820f05..e69de29bb 100644 --- a/stubs/grpcio/grpc_channelz/__init__.pyi +++ b/stubs/grpcio/grpc_channelz/__init__.pyi @@ -1,3 +0,0 @@ -from _typeshed import Incomplete - -def __getattr__(name: str) -> Incomplete: ... diff --git a/stubs/grpcio/grpc_channelz/v1/__init__.pyi b/stubs/grpcio/grpc_channelz/v1/__init__.pyi index 0f6820f05..e69de29bb 100644 --- a/stubs/grpcio/grpc_channelz/v1/__init__.pyi +++ b/stubs/grpcio/grpc_channelz/v1/__init__.pyi @@ -1,3 +0,0 @@ -from _typeshed import Incomplete - -def __getattr__(name: str) -> Incomplete: ... diff --git a/stubs/grpcio/grpc_channelz/v1/_async.pyi b/stubs/grpcio/grpc_channelz/v1/_async.pyi new file mode 100644 index 000000000..87aa2bf12 --- /dev/null +++ b/stubs/grpcio/grpc_channelz/v1/_async.pyi @@ -0,0 +1,19 @@ +from grpc_channelz.v1 import channelz_pb2, channelz_pb2_grpc + +class ChannelzServicer(channelz_pb2_grpc.ChannelzServicer): + @staticmethod + async def GetTopChannels(request: channelz_pb2.GetTopChannelsRequest, context) -> channelz_pb2.GetTopChannelsResponse: ... + @staticmethod + async def GetServers(request: channelz_pb2.GetServersRequest, context) -> channelz_pb2.GetServersResponse: ... + @staticmethod + async def GetServer(request: channelz_pb2.GetServerRequest, context) -> channelz_pb2.GetServerResponse: ... + @staticmethod + async def GetServerSockets( + request: channelz_pb2.GetServerSocketsRequest, context + ) -> channelz_pb2.GetServerSocketsResponse: ... + @staticmethod + async def GetChannel(request: channelz_pb2.GetChannelRequest, context) -> channelz_pb2.GetChannelResponse: ... + @staticmethod + async def GetSubchannel(request: channelz_pb2.GetSubchannelRequest, context) -> channelz_pb2.GetSubchannelResponse: ... + @staticmethod + async def GetSocket(request: channelz_pb2.GetSocketRequest, context) -> channelz_pb2.GetSocketResponse: ... diff --git a/stubs/grpcio/grpc_channelz/v1/channelz.pyi b/stubs/grpcio/grpc_channelz/v1/channelz.pyi index f5aa790e0..2ed61fd4f 100644 --- a/stubs/grpcio/grpc_channelz/v1/channelz.pyi +++ b/stubs/grpcio/grpc_channelz/v1/channelz.pyi @@ -1,3 +1,6 @@ -from grpc import Server +from grpc_channelz.v1 import _async as aio +from grpc_channelz.v1._servicer import ChannelzServicer -def add_channelz_servicer(server: Server) -> None: ... +def add_channelz_servicer(server) -> None: ... + +__all__ = ["aio", "add_channelz_servicer", "ChannelzServicer"] diff --git a/stubs/grpcio/grpc_channelz/v1/channelz_pb2.pyi b/stubs/grpcio/grpc_channelz/v1/channelz_pb2.pyi index fdc2ff0ee..b867e0e8c 100644 --- a/stubs/grpcio/grpc_channelz/v1/channelz_pb2.pyi +++ b/stubs/grpcio/grpc_channelz/v1/channelz_pb2.pyi @@ -1,16 +1,473 @@ from _typeshed import Incomplete +from collections.abc import Iterable, Mapping +from typing import ClassVar, final -GetTopChannelsRequest = Incomplete -GetTopChannelsResponse = Incomplete -GetServersRequest = Incomplete -GetServersResponse = Incomplete -GetServerRequest = Incomplete -GetServerResponse = Incomplete -GetServerSocketsRequest = Incomplete -GetServerSocketsResponse = Incomplete -GetChannelRequest = Incomplete -GetChannelResponse = Incomplete -GetSubchannelRequest = Incomplete -GetSubchannelResponse = Incomplete -GetSocketRequest = Incomplete -GetSocketResponse = Incomplete +from google._upb._message import Descriptor, FileDescriptor, MessageMeta +from google.protobuf import any_pb2, duration_pb2, message, timestamp_pb2, wrappers_pb2 +from google.protobuf.internal import containers + +DESCRIPTOR: FileDescriptor +@final +class Channel(message.Message, metaclass=MessageMeta): + REF_FIELD_NUMBER: ClassVar[int] + DATA_FIELD_NUMBER: ClassVar[int] + CHANNEL_REF_FIELD_NUMBER: ClassVar[int] + SUBCHANNEL_REF_FIELD_NUMBER: ClassVar[int] + SOCKET_REF_FIELD_NUMBER: ClassVar[int] + ref: ChannelRef + data: ChannelData + channel_ref: containers.RepeatedCompositeFieldContainer[ChannelRef] + subchannel_ref: containers.RepeatedCompositeFieldContainer[SubchannelRef] + socket_ref: containers.RepeatedCompositeFieldContainer[SocketRef] + def __init__(self, ref: ChannelRef | Mapping[Incomplete, Incomplete] | None = ..., data: ChannelData | Mapping[Incomplete, Incomplete] | None = ..., channel_ref: Iterable[ChannelRef | Mapping[Incomplete, Incomplete]] | None = ..., subchannel_ref: Iterable[SubchannelRef | Mapping[Incomplete, Incomplete]] | None = ..., socket_ref: Iterable[SocketRef | Mapping[Incomplete, Incomplete]] | None = ...) -> None: ... + DESCRIPTOR: Descriptor + +@final +class Subchannel(message.Message, metaclass=MessageMeta): + REF_FIELD_NUMBER: ClassVar[int] + DATA_FIELD_NUMBER: ClassVar[int] + CHANNEL_REF_FIELD_NUMBER: ClassVar[int] + SUBCHANNEL_REF_FIELD_NUMBER: ClassVar[int] + SOCKET_REF_FIELD_NUMBER: ClassVar[int] + ref: SubchannelRef + data: ChannelData + channel_ref: containers.RepeatedCompositeFieldContainer[ChannelRef] + subchannel_ref: containers.RepeatedCompositeFieldContainer[SubchannelRef] + socket_ref: containers.RepeatedCompositeFieldContainer[SocketRef] + def __init__(self, ref: SubchannelRef | Mapping[Incomplete, Incomplete] | None = ..., data: ChannelData | Mapping[Incomplete, Incomplete] | None = ..., channel_ref: Iterable[ChannelRef | Mapping[Incomplete, Incomplete]] | None = ..., subchannel_ref: Iterable[SubchannelRef | Mapping[Incomplete, Incomplete]] | None = ..., socket_ref: Iterable[SocketRef | Mapping[Incomplete, Incomplete]] | None = ...) -> None: ... + DESCRIPTOR: Descriptor + +@final +class ChannelConnectivityState(message.Message, metaclass=MessageMeta): + State: Incomplete + UNKNOWN: Incomplete + IDLE: Incomplete + CONNECTING: Incomplete + READY: Incomplete + TRANSIENT_FAILURE: Incomplete + SHUTDOWN: Incomplete + STATE_FIELD_NUMBER: ClassVar[int] + state: Incomplete + def __init__(self, state: Incomplete | str | None = ...) -> None: ... + DESCRIPTOR: Descriptor + +@final +class ChannelData(message.Message, metaclass=MessageMeta): + STATE_FIELD_NUMBER: ClassVar[int] + TARGET_FIELD_NUMBER: ClassVar[int] + TRACE_FIELD_NUMBER: ClassVar[int] + CALLS_STARTED_FIELD_NUMBER: ClassVar[int] + CALLS_SUCCEEDED_FIELD_NUMBER: ClassVar[int] + CALLS_FAILED_FIELD_NUMBER: ClassVar[int] + LAST_CALL_STARTED_TIMESTAMP_FIELD_NUMBER: ClassVar[int] + state: ChannelConnectivityState + target: str + trace: ChannelTrace + calls_started: int + calls_succeeded: int + calls_failed: int + last_call_started_timestamp: timestamp_pb2.Timestamp + def __init__(self, state: ChannelConnectivityState | Mapping[Incomplete, Incomplete] | None = ..., target: str | None = ..., trace: ChannelTrace | Mapping[Incomplete, Incomplete] | None = ..., calls_started: int | None = ..., calls_succeeded: int | None = ..., calls_failed: int | None = ..., last_call_started_timestamp: timestamp_pb2.Timestamp | Mapping[Incomplete, Incomplete] | None = ...) -> None: ... + DESCRIPTOR: Descriptor + +@final +class ChannelTraceEvent(message.Message, metaclass=MessageMeta): + Severity: Incomplete + CT_UNKNOWN: Incomplete + CT_INFO: Incomplete + CT_WARNING: Incomplete + CT_ERROR: Incomplete + DESCRIPTION_FIELD_NUMBER: ClassVar[int] + SEVERITY_FIELD_NUMBER: ClassVar[int] + TIMESTAMP_FIELD_NUMBER: ClassVar[int] + CHANNEL_REF_FIELD_NUMBER: ClassVar[int] + SUBCHANNEL_REF_FIELD_NUMBER: ClassVar[int] + description: str + severity: Incomplete + timestamp: timestamp_pb2.Timestamp + channel_ref: ChannelRef + subchannel_ref: SubchannelRef + def __init__(self, description: str | None = ..., severity: Incomplete | str | None = ..., timestamp: timestamp_pb2.Timestamp | Mapping[Incomplete, Incomplete] | None = ..., channel_ref: ChannelRef | Mapping[Incomplete, Incomplete] | None = ..., subchannel_ref: SubchannelRef | Mapping[Incomplete, Incomplete] | None = ...) -> None: ... + DESCRIPTOR: Descriptor + +@final +class ChannelTrace(message.Message, metaclass=MessageMeta): + NUM_EVENTS_LOGGED_FIELD_NUMBER: ClassVar[int] + CREATION_TIMESTAMP_FIELD_NUMBER: ClassVar[int] + EVENTS_FIELD_NUMBER: ClassVar[int] + num_events_logged: int + creation_timestamp: timestamp_pb2.Timestamp + events: containers.RepeatedCompositeFieldContainer[ChannelTraceEvent] + def __init__(self, num_events_logged: int | None = ..., creation_timestamp: timestamp_pb2.Timestamp | Mapping[Incomplete, Incomplete] | None = ..., events: Iterable[ChannelTraceEvent | Mapping[Incomplete, Incomplete]] | None = ...) -> None: ... + DESCRIPTOR: Descriptor + +@final +class ChannelRef(message.Message, metaclass=MessageMeta): + CHANNEL_ID_FIELD_NUMBER: ClassVar[int] + NAME_FIELD_NUMBER: ClassVar[int] + channel_id: int + name: str + def __init__(self, channel_id: int | None = ..., name: str | None = ...) -> None: ... + DESCRIPTOR: Descriptor + +@final +class SubchannelRef(message.Message, metaclass=MessageMeta): + SUBCHANNEL_ID_FIELD_NUMBER: ClassVar[int] + NAME_FIELD_NUMBER: ClassVar[int] + subchannel_id: int + name: str + def __init__(self, subchannel_id: int | None = ..., name: str | None = ...) -> None: ... + DESCRIPTOR: Descriptor + +@final +class SocketRef(message.Message, metaclass=MessageMeta): + SOCKET_ID_FIELD_NUMBER: ClassVar[int] + NAME_FIELD_NUMBER: ClassVar[int] + socket_id: int + name: str + def __init__(self, socket_id: int | None = ..., name: str | None = ...) -> None: ... + DESCRIPTOR: Descriptor + +@final +class ServerRef(message.Message, metaclass=MessageMeta): + SERVER_ID_FIELD_NUMBER: ClassVar[int] + NAME_FIELD_NUMBER: ClassVar[int] + server_id: int + name: str + def __init__(self, server_id: int | None = ..., name: str | None = ...) -> None: ... + DESCRIPTOR: Descriptor + +@final +class Server(message.Message, metaclass=MessageMeta): + REF_FIELD_NUMBER: ClassVar[int] + DATA_FIELD_NUMBER: ClassVar[int] + LISTEN_SOCKET_FIELD_NUMBER: ClassVar[int] + ref: ServerRef + data: ServerData + listen_socket: containers.RepeatedCompositeFieldContainer[SocketRef] + def __init__(self, ref: ServerRef | Mapping[Incomplete, Incomplete] | None = ..., data: ServerData | Mapping[Incomplete, Incomplete] | None = ..., listen_socket: Iterable[SocketRef | Mapping[Incomplete, Incomplete]] | None = ...) -> None: ... + DESCRIPTOR: Descriptor + +@final +class ServerData(message.Message, metaclass=MessageMeta): + TRACE_FIELD_NUMBER: ClassVar[int] + CALLS_STARTED_FIELD_NUMBER: ClassVar[int] + CALLS_SUCCEEDED_FIELD_NUMBER: ClassVar[int] + CALLS_FAILED_FIELD_NUMBER: ClassVar[int] + LAST_CALL_STARTED_TIMESTAMP_FIELD_NUMBER: ClassVar[int] + trace: ChannelTrace + calls_started: int + calls_succeeded: int + calls_failed: int + last_call_started_timestamp: timestamp_pb2.Timestamp + def __init__(self, trace: ChannelTrace | Mapping[Incomplete, Incomplete] | None = ..., calls_started: int | None = ..., calls_succeeded: int | None = ..., calls_failed: int | None = ..., last_call_started_timestamp: timestamp_pb2.Timestamp | Mapping[Incomplete, Incomplete] | None = ...) -> None: ... + DESCRIPTOR: Descriptor + +@final +class Socket(message.Message, metaclass=MessageMeta): + REF_FIELD_NUMBER: ClassVar[int] + DATA_FIELD_NUMBER: ClassVar[int] + LOCAL_FIELD_NUMBER: ClassVar[int] + REMOTE_FIELD_NUMBER: ClassVar[int] + SECURITY_FIELD_NUMBER: ClassVar[int] + REMOTE_NAME_FIELD_NUMBER: ClassVar[int] + ref: SocketRef + data: SocketData + local: Address + remote: Address + security: Security + remote_name: str + def __init__(self, ref: SocketRef | Mapping[Incomplete, Incomplete] | None = ..., data: SocketData | Mapping[Incomplete, Incomplete] | None = ..., local: Address | Mapping[Incomplete, Incomplete] | None = ..., remote: Address | Mapping[Incomplete, Incomplete] | None = ..., security: Security | Mapping[Incomplete, Incomplete] | None = ..., remote_name: str | None = ...) -> None: ... + DESCRIPTOR: Descriptor + +@final +class SocketData(message.Message, metaclass=MessageMeta): + STREAMS_STARTED_FIELD_NUMBER: ClassVar[int] + STREAMS_SUCCEEDED_FIELD_NUMBER: ClassVar[int] + STREAMS_FAILED_FIELD_NUMBER: ClassVar[int] + MESSAGES_SENT_FIELD_NUMBER: ClassVar[int] + MESSAGES_RECEIVED_FIELD_NUMBER: ClassVar[int] + KEEP_ALIVES_SENT_FIELD_NUMBER: ClassVar[int] + LAST_LOCAL_STREAM_CREATED_TIMESTAMP_FIELD_NUMBER: ClassVar[int] + LAST_REMOTE_STREAM_CREATED_TIMESTAMP_FIELD_NUMBER: ClassVar[int] + LAST_MESSAGE_SENT_TIMESTAMP_FIELD_NUMBER: ClassVar[int] + LAST_MESSAGE_RECEIVED_TIMESTAMP_FIELD_NUMBER: ClassVar[int] + LOCAL_FLOW_CONTROL_WINDOW_FIELD_NUMBER: ClassVar[int] + REMOTE_FLOW_CONTROL_WINDOW_FIELD_NUMBER: ClassVar[int] + OPTION_FIELD_NUMBER: ClassVar[int] + streams_started: int + streams_succeeded: int + streams_failed: int + messages_sent: int + messages_received: int + keep_alives_sent: int + last_local_stream_created_timestamp: timestamp_pb2.Timestamp + last_remote_stream_created_timestamp: timestamp_pb2.Timestamp + last_message_sent_timestamp: timestamp_pb2.Timestamp + last_message_received_timestamp: timestamp_pb2.Timestamp + local_flow_control_window: wrappers_pb2.Int64Value + remote_flow_control_window: wrappers_pb2.Int64Value + option: containers.RepeatedCompositeFieldContainer[SocketOption] + def __init__(self, streams_started: int | None = ..., streams_succeeded: int | None = ..., streams_failed: int | None = ..., messages_sent: int | None = ..., messages_received: int | None = ..., keep_alives_sent: int | None = ..., last_local_stream_created_timestamp: timestamp_pb2.Timestamp | Mapping[Incomplete, Incomplete] | None = ..., last_remote_stream_created_timestamp: timestamp_pb2.Timestamp | Mapping[Incomplete, Incomplete] | None = ..., last_message_sent_timestamp: timestamp_pb2.Timestamp | Mapping[Incomplete, Incomplete] | None = ..., last_message_received_timestamp: timestamp_pb2.Timestamp | Mapping[Incomplete, Incomplete] | None = ..., local_flow_control_window: wrappers_pb2.Int64Value | Mapping[Incomplete, Incomplete] | None = ..., remote_flow_control_window: wrappers_pb2.Int64Value | Mapping[Incomplete, Incomplete] | None = ..., option: Iterable[SocketOption | Mapping[Incomplete, Incomplete]] | None = ...) -> None: ... + DESCRIPTOR: Descriptor + +@final +class Address(message.Message, metaclass=MessageMeta): + @final + class TcpIpAddress(message.Message, metaclass=MessageMeta): + IP_ADDRESS_FIELD_NUMBER: ClassVar[int] + PORT_FIELD_NUMBER: ClassVar[int] + ip_address: bytes + port: int + def __init__(self, ip_address: bytes | None = ..., port: int | None = ...) -> None: ... + @final + class UdsAddress(message.Message, metaclass=MessageMeta): + FILENAME_FIELD_NUMBER: ClassVar[int] + filename: str + def __init__(self, filename: str | None = ...) -> None: ... + @final + class OtherAddress(message.Message, metaclass=MessageMeta): + NAME_FIELD_NUMBER: ClassVar[int] + VALUE_FIELD_NUMBER: ClassVar[int] + name: str + value: any_pb2.Any + def __init__(self, name: str | None = ..., value: any_pb2.Any | Mapping[Incomplete, Incomplete] | None = ...) -> None: ... + TCPIP_ADDRESS_FIELD_NUMBER: ClassVar[int] + UDS_ADDRESS_FIELD_NUMBER: ClassVar[int] + OTHER_ADDRESS_FIELD_NUMBER: ClassVar[int] + tcpip_address: Address.TcpIpAddress + uds_address: Address.UdsAddress + other_address: Address.OtherAddress + def __init__(self, tcpip_address: Address.TcpIpAddress | Mapping[Incomplete, Incomplete] | None = ..., uds_address: Address.UdsAddress | Mapping[Incomplete, Incomplete] | None = ..., other_address: Address.OtherAddress | Mapping[Incomplete, Incomplete] | None = ...) -> None: ... + DESCRIPTOR: Descriptor + +@final +class Security(message.Message, metaclass=MessageMeta): + @final + class Tls(message.Message, metaclass=MessageMeta): + STANDARD_NAME_FIELD_NUMBER: ClassVar[int] + OTHER_NAME_FIELD_NUMBER: ClassVar[int] + LOCAL_CERTIFICATE_FIELD_NUMBER: ClassVar[int] + REMOTE_CERTIFICATE_FIELD_NUMBER: ClassVar[int] + standard_name: str + other_name: str + local_certificate: bytes + remote_certificate: bytes + def __init__(self, standard_name: str | None = ..., other_name: str | None = ..., local_certificate: bytes | None = ..., remote_certificate: bytes | None = ...) -> None: ... + @final + class OtherSecurity(message.Message, metaclass=MessageMeta): + NAME_FIELD_NUMBER: ClassVar[int] + VALUE_FIELD_NUMBER: ClassVar[int] + name: str + value: any_pb2.Any + def __init__(self, name: str | None = ..., value: any_pb2.Any | Mapping[Incomplete, Incomplete] | None = ...) -> None: ... + TLS_FIELD_NUMBER: ClassVar[int] + OTHER_FIELD_NUMBER: ClassVar[int] + tls: Security.Tls + other: Security.OtherSecurity + def __init__(self, tls: Security.Tls | Mapping[Incomplete, Incomplete] | None = ..., other: Security.OtherSecurity | Mapping[Incomplete, Incomplete] | None = ...) -> None: ... + DESCRIPTOR: Descriptor + +@final +class SocketOption(message.Message, metaclass=MessageMeta): + NAME_FIELD_NUMBER: ClassVar[int] + VALUE_FIELD_NUMBER: ClassVar[int] + ADDITIONAL_FIELD_NUMBER: ClassVar[int] + name: str + value: str + additional: any_pb2.Any + def __init__(self, name: str | None = ..., value: str | None = ..., additional: any_pb2.Any | Mapping[Incomplete, Incomplete] | None = ...) -> None: ... + DESCRIPTOR: Descriptor + +@final +class SocketOptionTimeout(message.Message, metaclass=MessageMeta): + DURATION_FIELD_NUMBER: ClassVar[int] + duration: duration_pb2.Duration + def __init__(self, duration: duration_pb2.Duration | Mapping[Incomplete, Incomplete] | None = ...) -> None: ... + DESCRIPTOR: Descriptor + +@final +class SocketOptionLinger(message.Message, metaclass=MessageMeta): + ACTIVE_FIELD_NUMBER: ClassVar[int] + DURATION_FIELD_NUMBER: ClassVar[int] + active: bool + duration: duration_pb2.Duration + def __init__(self, active: bool = ..., duration: duration_pb2.Duration | Mapping[Incomplete, Incomplete] | None = ...) -> None: ... + DESCRIPTOR: Descriptor + +@final +class SocketOptionTcpInfo(message.Message, metaclass=MessageMeta): + TCPI_STATE_FIELD_NUMBER: ClassVar[int] + TCPI_CA_STATE_FIELD_NUMBER: ClassVar[int] + TCPI_RETRANSMITS_FIELD_NUMBER: ClassVar[int] + TCPI_PROBES_FIELD_NUMBER: ClassVar[int] + TCPI_BACKOFF_FIELD_NUMBER: ClassVar[int] + TCPI_OPTIONS_FIELD_NUMBER: ClassVar[int] + TCPI_SND_WSCALE_FIELD_NUMBER: ClassVar[int] + TCPI_RCV_WSCALE_FIELD_NUMBER: ClassVar[int] + TCPI_RTO_FIELD_NUMBER: ClassVar[int] + TCPI_ATO_FIELD_NUMBER: ClassVar[int] + TCPI_SND_MSS_FIELD_NUMBER: ClassVar[int] + TCPI_RCV_MSS_FIELD_NUMBER: ClassVar[int] + TCPI_UNACKED_FIELD_NUMBER: ClassVar[int] + TCPI_SACKED_FIELD_NUMBER: ClassVar[int] + TCPI_LOST_FIELD_NUMBER: ClassVar[int] + TCPI_RETRANS_FIELD_NUMBER: ClassVar[int] + TCPI_FACKETS_FIELD_NUMBER: ClassVar[int] + TCPI_LAST_DATA_SENT_FIELD_NUMBER: ClassVar[int] + TCPI_LAST_ACK_SENT_FIELD_NUMBER: ClassVar[int] + TCPI_LAST_DATA_RECV_FIELD_NUMBER: ClassVar[int] + TCPI_LAST_ACK_RECV_FIELD_NUMBER: ClassVar[int] + TCPI_PMTU_FIELD_NUMBER: ClassVar[int] + TCPI_RCV_SSTHRESH_FIELD_NUMBER: ClassVar[int] + TCPI_RTT_FIELD_NUMBER: ClassVar[int] + TCPI_RTTVAR_FIELD_NUMBER: ClassVar[int] + TCPI_SND_SSTHRESH_FIELD_NUMBER: ClassVar[int] + TCPI_SND_CWND_FIELD_NUMBER: ClassVar[int] + TCPI_ADVMSS_FIELD_NUMBER: ClassVar[int] + TCPI_REORDERING_FIELD_NUMBER: ClassVar[int] + tcpi_state: int + tcpi_ca_state: int + tcpi_retransmits: int + tcpi_probes: int + tcpi_backoff: int + tcpi_options: int + tcpi_snd_wscale: int + tcpi_rcv_wscale: int + tcpi_rto: int + tcpi_ato: int + tcpi_snd_mss: int + tcpi_rcv_mss: int + tcpi_unacked: int + tcpi_sacked: int + tcpi_lost: int + tcpi_retrans: int + tcpi_fackets: int + tcpi_last_data_sent: int + tcpi_last_ack_sent: int + tcpi_last_data_recv: int + tcpi_last_ack_recv: int + tcpi_pmtu: int + tcpi_rcv_ssthresh: int + tcpi_rtt: int + tcpi_rttvar: int + tcpi_snd_ssthresh: int + tcpi_snd_cwnd: int + tcpi_advmss: int + tcpi_reordering: int + def __init__(self, tcpi_state: int | None = ..., tcpi_ca_state: int | None = ..., tcpi_retransmits: int | None = ..., tcpi_probes: int | None = ..., tcpi_backoff: int | None = ..., tcpi_options: int | None = ..., tcpi_snd_wscale: int | None = ..., tcpi_rcv_wscale: int | None = ..., tcpi_rto: int | None = ..., tcpi_ato: int | None = ..., tcpi_snd_mss: int | None = ..., tcpi_rcv_mss: int | None = ..., tcpi_unacked: int | None = ..., tcpi_sacked: int | None = ..., tcpi_lost: int | None = ..., tcpi_retrans: int | None = ..., tcpi_fackets: int | None = ..., tcpi_last_data_sent: int | None = ..., tcpi_last_ack_sent: int | None = ..., tcpi_last_data_recv: int | None = ..., tcpi_last_ack_recv: int | None = ..., tcpi_pmtu: int | None = ..., tcpi_rcv_ssthresh: int | None = ..., tcpi_rtt: int | None = ..., tcpi_rttvar: int | None = ..., tcpi_snd_ssthresh: int | None = ..., tcpi_snd_cwnd: int | None = ..., tcpi_advmss: int | None = ..., tcpi_reordering: int | None = ...) -> None: ... + DESCRIPTOR: Descriptor + +@final +class GetTopChannelsRequest(message.Message, metaclass=MessageMeta): + START_CHANNEL_ID_FIELD_NUMBER: ClassVar[int] + MAX_RESULTS_FIELD_NUMBER: ClassVar[int] + start_channel_id: int + max_results: int + def __init__(self, start_channel_id: int | None = ..., max_results: int | None = ...) -> None: ... + DESCRIPTOR: Descriptor + +@final +class GetTopChannelsResponse(message.Message, metaclass=MessageMeta): + CHANNEL_FIELD_NUMBER: ClassVar[int] + END_FIELD_NUMBER: ClassVar[int] + channel: containers.RepeatedCompositeFieldContainer[Channel] + end: bool + def __init__(self, channel: Iterable[Channel | Mapping[Incomplete, Incomplete]] | None = ..., end: bool = ...) -> None: ... + DESCRIPTOR: Descriptor + +@final +class GetServersRequest(message.Message, metaclass=MessageMeta): + START_SERVER_ID_FIELD_NUMBER: ClassVar[int] + MAX_RESULTS_FIELD_NUMBER: ClassVar[int] + start_server_id: int + max_results: int + def __init__(self, start_server_id: int | None = ..., max_results: int | None = ...) -> None: ... + DESCRIPTOR: Descriptor + +@final +class GetServersResponse(message.Message, metaclass=MessageMeta): + SERVER_FIELD_NUMBER: ClassVar[int] + END_FIELD_NUMBER: ClassVar[int] + server: containers.RepeatedCompositeFieldContainer[Server] + end: bool + def __init__(self, server: Iterable[Server | Mapping[Incomplete, Incomplete]] | None = ..., end: bool = ...) -> None: ... + DESCRIPTOR: Descriptor + +@final +class GetServerRequest(message.Message, metaclass=MessageMeta): + SERVER_ID_FIELD_NUMBER: ClassVar[int] + server_id: int + def __init__(self, server_id: int | None = ...) -> None: ... + DESCRIPTOR: Descriptor + +@final +class GetServerResponse(message.Message, metaclass=MessageMeta): + SERVER_FIELD_NUMBER: ClassVar[int] + server: Server + def __init__(self, server: Server | Mapping[Incomplete, Incomplete] | None = ...) -> None: ... + DESCRIPTOR: Descriptor + +@final +class GetServerSocketsRequest(message.Message, metaclass=MessageMeta): + SERVER_ID_FIELD_NUMBER: ClassVar[int] + START_SOCKET_ID_FIELD_NUMBER: ClassVar[int] + MAX_RESULTS_FIELD_NUMBER: ClassVar[int] + server_id: int + start_socket_id: int + max_results: int + def __init__(self, server_id: int | None = ..., start_socket_id: int | None = ..., max_results: int | None = ...) -> None: ... + DESCRIPTOR: Descriptor + +@final +class GetServerSocketsResponse(message.Message, metaclass=MessageMeta): + SOCKET_REF_FIELD_NUMBER: ClassVar[int] + END_FIELD_NUMBER: ClassVar[int] + socket_ref: containers.RepeatedCompositeFieldContainer[SocketRef] + end: bool + def __init__(self, socket_ref: Iterable[SocketRef | Mapping[Incomplete, Incomplete]] | None = ..., end: bool = ...) -> None: ... + DESCRIPTOR: Descriptor + +@final +class GetChannelRequest(message.Message, metaclass=MessageMeta): + CHANNEL_ID_FIELD_NUMBER: ClassVar[int] + channel_id: int + def __init__(self, channel_id: int | None = ...) -> None: ... + DESCRIPTOR: Descriptor + +@final +class GetChannelResponse(message.Message, metaclass=MessageMeta): + CHANNEL_FIELD_NUMBER: ClassVar[int] + channel: Channel + def __init__(self, channel: Channel | Mapping[Incomplete, Incomplete] | None = ...) -> None: ... + DESCRIPTOR: Descriptor + +@final +class GetSubchannelRequest(message.Message, metaclass=MessageMeta): + SUBCHANNEL_ID_FIELD_NUMBER: ClassVar[int] + subchannel_id: int + def __init__(self, subchannel_id: int | None = ...) -> None: ... + DESCRIPTOR: Descriptor + +@final +class GetSubchannelResponse(message.Message, metaclass=MessageMeta): + SUBCHANNEL_FIELD_NUMBER: ClassVar[int] + subchannel: Subchannel + def __init__(self, subchannel: Subchannel | Mapping[Incomplete, Incomplete] | None = ...) -> None: ... + DESCRIPTOR: Descriptor + +@final +class GetSocketRequest(message.Message, metaclass=MessageMeta): + SOCKET_ID_FIELD_NUMBER: ClassVar[int] + SUMMARY_FIELD_NUMBER: ClassVar[int] + socket_id: int + summary: bool + def __init__(self, socket_id: int | None = ..., summary: bool = ...) -> None: ... + DESCRIPTOR: Descriptor + +@final +class GetSocketResponse(message.Message, metaclass=MessageMeta): + SOCKET_FIELD_NUMBER: ClassVar[int] + socket: Socket + def __init__(self, socket: Socket | Mapping[Incomplete, Incomplete] | None = ...) -> None: ... + DESCRIPTOR: Descriptor diff --git a/stubs/grpcio/grpc_channelz/v1/channelz_pb2_grpc.pyi b/stubs/grpcio/grpc_channelz/v1/channelz_pb2_grpc.pyi index 0b9716abc..bd6f78fec 100644 --- a/stubs/grpcio/grpc_channelz/v1/channelz_pb2_grpc.pyi +++ b/stubs/grpcio/grpc_channelz/v1/channelz_pb2_grpc.pyi @@ -1,3 +1,121 @@ from _typeshed import Incomplete +from typing import Final -ChannelzServicer = Incomplete +import grpc + +GRPC_GENERATED_VERSION: Final[str] +GRPC_VERSION: Final[str] + +class ChannelzStub: + GetTopChannels: Incomplete + GetServers: Incomplete + GetServer: Incomplete + GetServerSockets: Incomplete + GetChannel: Incomplete + GetSubchannel: Incomplete + GetSocket: Incomplete + def __init__(self, channel: grpc.Channel): ... + +class ChannelzServicer: + def GetTopChannels(self, request, context): ... + def GetServers(self, request, context): ... + def GetServer(self, request, context): ... + def GetServerSockets(self, request, context): ... + def GetChannel(self, request, context): ... + def GetSubchannel(self, request, context): ... + def GetSocket(self, request, context): ... + +def add_ChannelzServicer_to_server(servicer, server) -> None: ... + +class Channelz: + @staticmethod + def GetTopChannels( + request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None, + ): ... + @staticmethod + def GetServers( + request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None, + ): ... + @staticmethod + def GetServer( + request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None, + ): ... + @staticmethod + def GetServerSockets( + request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None, + ): ... + @staticmethod + def GetChannel( + request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None, + ): ... + @staticmethod + def GetSubchannel( + request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None, + ): ... + @staticmethod + def GetSocket( + request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None, + ): ... diff --git a/stubs/grpcio/grpc_health/__init__.pyi b/stubs/grpcio/grpc_health/__init__.pyi index 0f6820f05..e69de29bb 100644 --- a/stubs/grpcio/grpc_health/__init__.pyi +++ b/stubs/grpcio/grpc_health/__init__.pyi @@ -1,3 +0,0 @@ -from _typeshed import Incomplete - -def __getattr__(name: str) -> Incomplete: ... diff --git a/stubs/grpcio/grpc_health/v1/__init__.pyi b/stubs/grpcio/grpc_health/v1/__init__.pyi index 0f6820f05..e69de29bb 100644 --- a/stubs/grpcio/grpc_health/v1/__init__.pyi +++ b/stubs/grpcio/grpc_health/v1/__init__.pyi @@ -1,3 +0,0 @@ -from _typeshed import Incomplete - -def __getattr__(name: str) -> Incomplete: ... diff --git a/stubs/grpcio/grpc_health/v1/health.pyi b/stubs/grpcio/grpc_health/v1/health.pyi index 7ea7dc5d0..1353f3f84 100644 --- a/stubs/grpcio/grpc_health/v1/health.pyi +++ b/stubs/grpcio/grpc_health/v1/health.pyi @@ -1,34 +1,35 @@ +from _typeshed import Incomplete +from collections.abc import Callable from concurrent import futures -from typing import Any, Protocol +from typing import Final, overload +from typing_extensions import Self from grpc import ServicerContext -from grpc_health.v1 import health_pb2 as _health_pb2, health_pb2_grpc as _health_pb2_grpc +from grpc_health.v1 import health_pb2, health_pb2_grpc -SERVICE_NAME: str -OVERALL_HEALTH: str +SERVICE_NAME: Final[str] +OVERALL_HEALTH: Final[str] class _Watcher: def __init__(self) -> None: ... - def __iter__(self) -> _Watcher: ... - def next(self) -> _health_pb2.HealthCheckResponse: ... - def __next__(self) -> _health_pb2.HealthCheckResponse: ... - def add(self, response: _health_pb2.HealthCheckResponse) -> None: ... + def __iter__(self) -> Self: ... + def next(self) -> health_pb2.HealthCheckResponse: ... + def __next__(self) -> health_pb2.HealthCheckResponse: ... + def add(self, response: health_pb2.HealthCheckResponse) -> None: ... def close(self) -> None: ... -# FIXME: This needs further investigation -class _SendResponseCallback(Protocol): - def __call__(self, *args: Any, **kwargs: Any) -> Any: ... - -class HealthServicer(_health_pb2_grpc.HealthServicer): +class HealthServicer(health_pb2_grpc.HealthServicer): def __init__( - self, experimental_non_blocking: bool = ..., experimental_thread_pool: futures.ThreadPoolExecutor | None = ... + self, experimental_non_blocking: bool = True, experimental_thread_pool: futures.ThreadPoolExecutor | None = None ) -> None: ... - def Check(self, request: _health_pb2.HealthCheckRequest, context: ServicerContext) -> _health_pb2.HealthCheckResponse: ... + def Check(self, request: health_pb2.HealthCheckRequest, context: ServicerContext) -> health_pb2.HealthCheckResponse: ... + @overload def Watch( - self, - request: _health_pb2.HealthCheckRequest, - context: ServicerContext, - send_response_callback: _SendResponseCallback | None = ..., - ) -> _health_pb2.HealthCheckResponse: ... - def set(self, service: str, status: _health_pb2.HealthCheckResponse.ServingStatus) -> None: ... + self, request: health_pb2.HealthCheckRequest, context: ServicerContext, send_response_callback: None = None + ) -> _Watcher: ... + @overload + def Watch( + self, request: health_pb2.HealthCheckRequest, context: ServicerContext, send_response_callback: Callable[..., Incomplete] + ) -> None: ... + def set(self, service: str, status: health_pb2.HealthCheckResponse.ServingStatus) -> None: ... def enter_graceful_shutdown(self) -> None: ... diff --git a/stubs/grpcio/grpc_health/v1/health_pb2.pyi b/stubs/grpcio/grpc_health/v1/health_pb2.pyi index 0f6820f05..82191f79b 100644 --- a/stubs/grpcio/grpc_health/v1/health_pb2.pyi +++ b/stubs/grpcio/grpc_health/v1/health_pb2.pyi @@ -1,3 +1,26 @@ from _typeshed import Incomplete +from typing import ClassVar, final -def __getattr__(name: str) -> Incomplete: ... +from google._upb._message import Descriptor, FileDescriptor, MessageMeta +from google.protobuf import message + +DESCRIPTOR: FileDescriptor + +@final +class HealthCheckRequest(message.Message, metaclass=MessageMeta): + SERVICE_FIELD_NUMBER: ClassVar[int] + service: str + def __init__(self, service: str | None = ...) -> None: ... + DESCRIPTOR: Descriptor + +@final +class HealthCheckResponse(message.Message, metaclass=MessageMeta): + ServingStatus: Incomplete + UNKNOWN: Incomplete + SERVING: Incomplete + NOT_SERVING: Incomplete + SERVICE_UNKNOWN: Incomplete + STATUS_FIELD_NUMBER: ClassVar[int] + status: Incomplete + def __init__(self, status: Incomplete | str | None = ...) -> None: ... + DESCRIPTOR: Descriptor diff --git a/stubs/grpcio/grpc_health/v1/health_pb2_grpc.pyi b/stubs/grpcio/grpc_health/v1/health_pb2_grpc.pyi index 8a29ae2fa..8170664f0 100644 --- a/stubs/grpcio/grpc_health/v1/health_pb2_grpc.pyi +++ b/stubs/grpcio/grpc_health/v1/health_pb2_grpc.pyi @@ -1,6 +1,41 @@ -from _typeshed import Incomplete +from typing import Final -def __getattr__(name: str) -> Incomplete: ... +GRPC_GENERATED_VERSION: Final[str] +GRPC_VERSION: Final[str] -# FIXME: Incomplete -class HealthServicer: ... +class HealthStub: + def __init__(self, channel) -> None: ... + +class HealthServicer: + def Check(self, request, context): ... + def Watch(self, request, context): ... + +def add_HealthServicer_to_server(servicer, server) -> None: ... + +class Health: + @staticmethod + def Check( + request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None, + ): ... + @staticmethod + def Watch( + request, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None, + ): ... diff --git a/stubs/grpcio/grpc_reflection/__init__.pyi b/stubs/grpcio/grpc_reflection/__init__.pyi index 0f6820f05..e69de29bb 100644 --- a/stubs/grpcio/grpc_reflection/__init__.pyi +++ b/stubs/grpcio/grpc_reflection/__init__.pyi @@ -1,3 +0,0 @@ -from _typeshed import Incomplete - -def __getattr__(name: str) -> Incomplete: ... diff --git a/stubs/grpcio/grpc_reflection/v1alpha/__init__.pyi b/stubs/grpcio/grpc_reflection/v1alpha/__init__.pyi index 0f6820f05..e69de29bb 100644 --- a/stubs/grpcio/grpc_reflection/v1alpha/__init__.pyi +++ b/stubs/grpcio/grpc_reflection/v1alpha/__init__.pyi @@ -1,3 +0,0 @@ -from _typeshed import Incomplete - -def __getattr__(name: str) -> Incomplete: ... diff --git a/stubs/grpcio/grpc_reflection/v1alpha/_async.pyi b/stubs/grpcio/grpc_reflection/v1alpha/_async.pyi new file mode 100644 index 000000000..39fa94fe1 --- /dev/null +++ b/stubs/grpcio/grpc_reflection/v1alpha/_async.pyi @@ -0,0 +1,11 @@ +from collections.abc import AsyncIterable + +from grpc_reflection.v1alpha import reflection_pb2 +from grpc_reflection.v1alpha._base import BaseReflectionServicer + +class ReflectionServicer(BaseReflectionServicer): + async def ServerReflectionInfo( + self, request_iterator: AsyncIterable[reflection_pb2.ServerReflectionRequest], unused_context + ) -> AsyncIterable[reflection_pb2.ServerReflectionResponse]: ... + +__all__ = ["ReflectionServicer"] diff --git a/stubs/grpcio/grpc_reflection/v1alpha/_base.pyi b/stubs/grpcio/grpc_reflection/v1alpha/_base.pyi index 00704b506..e808f4a91 100644 --- a/stubs/grpcio/grpc_reflection/v1alpha/_base.pyi +++ b/stubs/grpcio/grpc_reflection/v1alpha/_base.pyi @@ -1,6 +1,6 @@ -from _typeshed import Incomplete +from grpc_reflection.v1alpha import reflection_pb2_grpc -def __getattr__(name: str) -> Incomplete: ... +class BaseReflectionServicer(reflection_pb2_grpc.ServerReflectionServicer): + def __init__(self, service_names, pool=None) -> None: ... -# FIXME: Incomplete -class BaseReflectionServicer: ... +__all__ = ["BaseReflectionServicer"] diff --git a/stubs/grpcio/grpc_reflection/v1alpha/proto_reflection_descriptor_database.pyi b/stubs/grpcio/grpc_reflection/v1alpha/proto_reflection_descriptor_database.pyi new file mode 100644 index 000000000..e41b1edb0 --- /dev/null +++ b/stubs/grpcio/grpc_reflection/v1alpha/proto_reflection_descriptor_database.pyi @@ -0,0 +1,11 @@ +import grpc +from google.protobuf.descriptor_database import DescriptorDatabase +from google.protobuf.descriptor_pb2 import FileDescriptorProto + +class ProtoReflectionDescriptorDatabase(DescriptorDatabase): + def __init__(self, channel: grpc.Channel) -> None: ... + def get_services(self) -> list[str]: ... + def FindFileByName(self, name: str) -> FileDescriptorProto: ... + def FindFileContainingSymbol(self, symbol: str) -> FileDescriptorProto: ... + def FindAllExtensionNumbers(self, extendee_name: str) -> list[int]: ... + def FindFileContainingExtension(self, extendee_name: str, extension_number: int) -> FileDescriptorProto: ... diff --git a/stubs/grpcio/grpc_reflection/v1alpha/reflection.pyi b/stubs/grpcio/grpc_reflection/v1alpha/reflection.pyi index cf75c363f..8b336b9be 100644 --- a/stubs/grpcio/grpc_reflection/v1alpha/reflection.pyi +++ b/stubs/grpcio/grpc_reflection/v1alpha/reflection.pyi @@ -1,23 +1,28 @@ -import typing_extensions from _typeshed import Incomplete from collections.abc import Iterable +from typing import Final +from typing_extensions import TypeAlias import grpc +import grpc.aio from google.protobuf import descriptor_pool -from grpc import aio from grpc_reflection.v1alpha import reflection_pb2 as _reflection_pb2 from grpc_reflection.v1alpha._base import BaseReflectionServicer -SERVICE_NAME: str +from . import _async as aio -_AnyServer: typing_extensions.TypeAlias = grpc.Server | aio.Server -_AnyServicerContext: typing_extensions.TypeAlias = grpc.ServicerContext | aio.ServicerContext[Incomplete, Incomplete] +SERVICE_NAME: Final[str] + +_AnyServer: TypeAlias = grpc.Server | grpc.aio.Server +_AnyServicerContext: TypeAlias = grpc.ServicerContext | grpc.aio.ServicerContext[Incomplete, Incomplete] class ReflectionServicer(BaseReflectionServicer): def ServerReflectionInfo( self, request_iterator: Iterable[_reflection_pb2.ServerReflectionRequest], context: _AnyServicerContext - ) -> None: ... + ): ... def enable_server_reflection( - service_names: Iterable[str], server: _AnyServer, pool: descriptor_pool.DescriptorPool | None = ... + service_names: Iterable[str], server: _AnyServer, pool: descriptor_pool.DescriptorPool | None = None ) -> None: ... + +__all__ = ["SERVICE_NAME", "ReflectionServicer", "enable_server_reflection", "aio"] diff --git a/stubs/grpcio/grpc_reflection/v1alpha/reflection_pb2.pyi b/stubs/grpcio/grpc_reflection/v1alpha/reflection_pb2.pyi index 0f6820f05..35eff35cd 100644 --- a/stubs/grpcio/grpc_reflection/v1alpha/reflection_pb2.pyi +++ b/stubs/grpcio/grpc_reflection/v1alpha/reflection_pb2.pyi @@ -1,3 +1,90 @@ from _typeshed import Incomplete +from collections.abc import Iterable, Mapping +from typing import ClassVar, final -def __getattr__(name: str) -> Incomplete: ... +from google._upb._message import Descriptor, FileDescriptor, MessageMeta +from google.protobuf import message +from google.protobuf.internal import containers + +DESCRIPTOR: FileDescriptor + +@final +class ServerReflectionRequest(message.Message, metaclass=MessageMeta): + HOST_FIELD_NUMBER: ClassVar[int] + FILE_BY_FILENAME_FIELD_NUMBER: ClassVar[int] + FILE_CONTAINING_SYMBOL_FIELD_NUMBER: ClassVar[int] + FILE_CONTAINING_EXTENSION_FIELD_NUMBER: ClassVar[int] + ALL_EXTENSION_NUMBERS_OF_TYPE_FIELD_NUMBER: ClassVar[int] + LIST_SERVICES_FIELD_NUMBER: ClassVar[int] + host: str + file_by_filename: str + file_containing_symbol: str + file_containing_extension: ExtensionRequest + all_extension_numbers_of_type: str + list_services: str + def __init__(self, host: str | None = ..., file_by_filename: str | None = ..., file_containing_symbol: str | None = ..., file_containing_extension: ExtensionRequest | Mapping[Incomplete, Incomplete] | None = ..., all_extension_numbers_of_type: str | None = ..., list_services: str | None = ...) -> None: ... + DESCRIPTOR: Descriptor +@final +class ExtensionRequest(message.Message, metaclass=MessageMeta): + CONTAINING_TYPE_FIELD_NUMBER: ClassVar[int] + EXTENSION_NUMBER_FIELD_NUMBER: ClassVar[int] + containing_type: str + extension_number: int + def __init__(self, containing_type: str | None = ..., extension_number: int | None = ...) -> None: ... + DESCRIPTOR: Descriptor + +@final +class ServerReflectionResponse(message.Message, metaclass=MessageMeta): + VALID_HOST_FIELD_NUMBER: ClassVar[int] + ORIGINAL_REQUEST_FIELD_NUMBER: ClassVar[int] + FILE_DESCRIPTOR_RESPONSE_FIELD_NUMBER: ClassVar[int] + ALL_EXTENSION_NUMBERS_RESPONSE_FIELD_NUMBER: ClassVar[int] + LIST_SERVICES_RESPONSE_FIELD_NUMBER: ClassVar[int] + ERROR_RESPONSE_FIELD_NUMBER: ClassVar[int] + valid_host: str + original_request: ServerReflectionRequest + file_descriptor_response: FileDescriptorResponse + all_extension_numbers_response: ExtensionNumberResponse + list_services_response: ListServiceResponse + error_response: ErrorResponse + def __init__(self, valid_host: str | None = ..., original_request: ServerReflectionRequest | Mapping[Incomplete, Incomplete] | None = ..., file_descriptor_response: FileDescriptorResponse | Mapping[Incomplete, Incomplete] | None = ..., all_extension_numbers_response: ExtensionNumberResponse | Mapping[Incomplete, Incomplete] | None = ..., list_services_response: ListServiceResponse | Mapping[Incomplete, Incomplete] | None = ..., error_response: ErrorResponse | Mapping[Incomplete, Incomplete] | None = ...) -> None: ... + DESCRIPTOR: Descriptor + +@final +class FileDescriptorResponse(message.Message, metaclass=MessageMeta): + FILE_DESCRIPTOR_PROTO_FIELD_NUMBER: ClassVar[int] + file_descriptor_proto: containers.RepeatedScalarFieldContainer[bytes] + def __init__(self, file_descriptor_proto: Iterable[bytes] | None = ...) -> None: ... + DESCRIPTOR: Descriptor + +@final +class ExtensionNumberResponse(message.Message, metaclass=MessageMeta): + BASE_TYPE_NAME_FIELD_NUMBER: ClassVar[int] + EXTENSION_NUMBER_FIELD_NUMBER: ClassVar[int] + base_type_name: str + extension_number: containers.RepeatedScalarFieldContainer[int] + def __init__(self, base_type_name: str | None = ..., extension_number: Iterable[int] | None = ...) -> None: ... + DESCRIPTOR: Descriptor + +@final +class ListServiceResponse(message.Message, metaclass=MessageMeta): + SERVICE_FIELD_NUMBER: ClassVar[int] + service: containers.RepeatedCompositeFieldContainer[ServiceResponse] + def __init__(self, service: Iterable[ServiceResponse | Mapping[Incomplete, Incomplete]] | None = ...) -> None: ... + DESCRIPTOR: Descriptor + +@final +class ServiceResponse(message.Message, metaclass=MessageMeta): + NAME_FIELD_NUMBER: ClassVar[int] + name: str + def __init__(self, name: str | None = ...) -> None: ... + DESCRIPTOR: Descriptor + +@final +class ErrorResponse(message.Message, metaclass=MessageMeta): + ERROR_CODE_FIELD_NUMBER: ClassVar[int] + ERROR_MESSAGE_FIELD_NUMBER: ClassVar[int] + error_code: int + error_message: str + def __init__(self, error_code: int | None = ..., error_message: str | None = ...) -> None: ... + DESCRIPTOR: Descriptor diff --git a/stubs/grpcio/grpc_reflection/v1alpha/reflection_pb2_grpc.pyi b/stubs/grpcio/grpc_reflection/v1alpha/reflection_pb2_grpc.pyi new file mode 100644 index 000000000..31b983b4f --- /dev/null +++ b/stubs/grpcio/grpc_reflection/v1alpha/reflection_pb2_grpc.pyi @@ -0,0 +1,31 @@ +from binascii import Incomplete +from typing import Final + +import grpc + +GRPC_GENERATED_VERSION: Final[str] +GRPC_VERSION: Final[str] + +class ServerReflectionStub: + ServerReflectionInfo: Incomplete + def __init__(self, channel: grpc.Channel) -> None: ... + +class ServerReflectionServicer: + def ServerReflectionInfo(self, request_iterator, context): ... + +def add_ServerReflectionServicer_to_server(servicer, server): ... + +class ServerReflection: + @staticmethod + def ServerReflectionInfo( + request_iterator, + target, + options=(), + channel_credentials=None, + call_credentials=None, + insecure=False, + compression=None, + wait_for_ready=None, + timeout=None, + metadata=None, + ): ... diff --git a/stubs/grpcio/grpc_status/__init__.pyi b/stubs/grpcio/grpc_status/__init__.pyi index 0f6820f05..e69de29bb 100644 --- a/stubs/grpcio/grpc_status/__init__.pyi +++ b/stubs/grpcio/grpc_status/__init__.pyi @@ -1,3 +0,0 @@ -from _typeshed import Incomplete - -def __getattr__(name: str) -> Incomplete: ... diff --git a/stubs/grpcio/grpc_status/_async.pyi b/stubs/grpcio/grpc_status/_async.pyi new file mode 100644 index 000000000..a636b3f59 --- /dev/null +++ b/stubs/grpcio/grpc_status/_async.pyi @@ -0,0 +1,5 @@ +from _typeshed import Incomplete + +async def from_call(call) -> Incomplete | None: ... + +__all__ = ["from_call"] diff --git a/stubs/grpcio/grpc_status/rpc_status.pyi b/stubs/grpcio/grpc_status/rpc_status.pyi index 090716d5c..e2e020416 100644 --- a/stubs/grpcio/grpc_status/rpc_status.pyi +++ b/stubs/grpcio/grpc_status/rpc_status.pyi @@ -1,7 +1,11 @@ import grpc +from . import _async as aio + # Returns a google.rpc.status.Status message corresponding to a given grpc.Call. def from_call(call: grpc.Call): ... # Convert a google.rpc.status.Status message to grpc.Status. def to_status(status) -> grpc.Status: ... + +__all__ = ["from_call", "to_status", "aio"] diff --git a/stubs/protobuf/google/_upb/_message.pyi b/stubs/protobuf/google/_upb/_message.pyi new file mode 100644 index 000000000..bb188bcbf --- /dev/null +++ b/stubs/protobuf/google/_upb/_message.pyi @@ -0,0 +1,310 @@ +from _typeshed import Incomplete +from typing import ClassVar, final + +default_pool: DescriptorPool + +@final +class Arena: ... + +@final +class Descriptor: + containing_type: Incomplete + enum_types: Incomplete + enum_types_by_name: Incomplete + enum_values_by_name: Incomplete + extension_ranges: Incomplete + extensions: Incomplete + extensions_by_name: Incomplete + fields: Incomplete + fields_by_camelcase_name: Incomplete + fields_by_name: Incomplete + fields_by_number: Incomplete + file: Incomplete + full_name: Incomplete + has_options: Incomplete + is_extendable: Incomplete + name: Incomplete + nested_types: Incomplete + nested_types_by_name: Incomplete + oneofs: Incomplete + oneofs_by_name: Incomplete + def __init__(self, *args, **kwargs) -> None: ... # incomplete + def CopyToProto(self, object, /): ... + def EnumValueName(self, *args, **kwargs): ... # incomplete + def GetOptions(self): ... + +@final +class DescriptorPool: + def __init__(self, *args, **kwargs) -> None: ... # incomplete + def Add(self, object, /): ... + def AddSerializedFile(self, object, /): ... + def FindAllExtensions(self, object, /): ... + def FindEnumTypeByName(self, object, /): ... + def FindExtensionByName(self, object, /): ... + def FindExtensionByNumber(self, *args, **kwargs): ... # incomplete + def FindFieldByName(self, object, /): ... + def FindFileByName(self, object, /): ... + def FindFileContainingSymbol(self, object, /): ... + def FindMessageTypeByName(self, object, /): ... + def FindMethodByName(self, object, /): ... + def FindOneofByName(self, object, /): ... + def FindServiceByName(self, object, /): ... + def SetFeatureSetDefaults(self, object, /): ... + +@final +class EnumDescriptor: + containing_type: Incomplete + file: Incomplete + full_name: Incomplete + has_options: Incomplete + is_closed: Incomplete + name: Incomplete + values: Incomplete + values_by_name: Incomplete + values_by_number: Incomplete + def __init__(self, *args, **kwargs) -> None: ... # incomplete + def CopyToProto(self, object, /): ... + def GetOptions(self): ... + +@final +class EnumValueDescriptor: + has_options: Incomplete + index: Incomplete + name: Incomplete + number: Incomplete + type: Incomplete + def __init__(self, *args, **kwargs) -> None: ... # incomplete + def GetOptions(self): ... + +@final +class ExtensionDict: + def __contains__(self, other) -> bool: ... + def __delitem__(self, other) -> None: ... + def __eq__(self, other: object) -> bool: ... + def __ge__(self, other: object) -> bool: ... + def __getitem__(self, index): ... + def __gt__(self, other: object) -> bool: ... + def __iter__(self): ... + def __le__(self, other: object) -> bool: ... + def __len__(self) -> int: ... + def __lt__(self, other: object) -> bool: ... + def __ne__(self, other: object) -> bool: ... + def __setitem__(self, index, object) -> None: ... + +@final +class ExtensionIterator: + def __iter__(self): ... + def __next__(self): ... + +@final +class FieldDescriptor: + CPPTYPE_BOOL: ClassVar[int] = ... + CPPTYPE_BYTES: ClassVar[int] = ... + CPPTYPE_DOUBLE: ClassVar[int] = ... + CPPTYPE_ENUM: ClassVar[int] = ... + CPPTYPE_FLOAT: ClassVar[int] = ... + CPPTYPE_INT32: ClassVar[int] = ... + CPPTYPE_INT64: ClassVar[int] = ... + CPPTYPE_MESSAGE: ClassVar[int] = ... + CPPTYPE_STRING: ClassVar[int] = ... + CPPTYPE_UINT32: ClassVar[int] = ... + CPPTYPE_UINT64: ClassVar[int] = ... + LABEL_OPTIONAL: ClassVar[int] = ... + LABEL_REPEATED: ClassVar[int] = ... + LABEL_REQUIRED: ClassVar[int] = ... + TYPE_BOOL: ClassVar[int] = ... + TYPE_BYTES: ClassVar[int] = ... + TYPE_DOUBLE: ClassVar[int] = ... + TYPE_ENUM: ClassVar[int] = ... + TYPE_FIXED32: ClassVar[int] = ... + TYPE_FIXED64: ClassVar[int] = ... + TYPE_FLOAT: ClassVar[int] = ... + TYPE_GROUP: ClassVar[int] = ... + TYPE_INT32: ClassVar[int] = ... + TYPE_INT64: ClassVar[int] = ... + TYPE_MESSAGE: ClassVar[int] = ... + TYPE_SFIXED32: ClassVar[int] = ... + TYPE_SFIXED64: ClassVar[int] = ... + TYPE_SINT32: ClassVar[int] = ... + TYPE_SINT64: ClassVar[int] = ... + TYPE_STRING: ClassVar[int] = ... + TYPE_UINT32: ClassVar[int] = ... + TYPE_UINT64: ClassVar[int] = ... + camelcase_name: Incomplete + containing_oneof: Incomplete + containing_type: Incomplete + cpp_type: Incomplete + default_value: Incomplete + enum_type: Incomplete + extension_scope: Incomplete + file: Incomplete + full_name: Incomplete + has_default_value: Incomplete + has_options: Incomplete + has_presence: Incomplete + index: Incomplete + is_extension: Incomplete + is_packed: Incomplete + json_name: Incomplete + label: Incomplete + message_type: Incomplete + name: Incomplete + number: Incomplete + type: Incomplete + def __init__(self, *args, **kwargs) -> None: ... # incomplete + def GetOptions(self): ... + +@final +class FileDescriptor: + dependencies: Incomplete + enum_types_by_name: Incomplete + extensions_by_name: Incomplete + has_options: Incomplete + message_types_by_name: Incomplete + name: Incomplete + package: Incomplete + pool: Incomplete + public_dependencies: Incomplete + serialized_pb: Incomplete + services_by_name: Incomplete + def __init__(self, *args, **kwargs) -> None: ... # incomplete + def CopyToProto(self, object, /): ... + def GetOptions(self): ... + +@final +class MapIterator: + def __iter__(self): ... + def __next__(self): ... + +@final +class Message: + Extensions: Incomplete + def __init__(self, *args, **kwargs) -> None: ... # incomplete # incomplete + def ByteSize(self): ... + def Clear(self): ... + def ClearExtension(self, object, /): ... + def ClearField(self, object, /): ... + def CopyFrom(self, object, /): ... + def DiscardUnknownFields(self): ... + def FindInitializationErrors(self): ... + @classmethod + def FromString(cls, object, /): ... + def HasExtension(self, object, /): ... + def HasField(self, object, /): ... + def IsInitialized(self, *args, **kwargs): ... # incomplete + def ListFields(self): ... + def MergeFrom(self, object, /): ... + def MergeFromString(self, object, /): ... + def ParseFromString(self, object, /): ... + def SerializePartialToString(self, *args, **kwargs): ... # incomplete + def SerializeToString(self, *args, **kwargs): ... # incomplete + def SetInParent(self): ... + def UnknownFields(self): ... + def WhichOneof(self, object, /): ... + def __contains__(self, other) -> bool: ... + def __deepcopy__(self, memo=None): ... + def __delattr__(self, name): ... + def __eq__(self, other: object) -> bool: ... + def __ge__(self, other: object) -> bool: ... + def __gt__(self, other: object) -> bool: ... + def __le__(self, other: object) -> bool: ... + def __lt__(self, other: object) -> bool: ... + def __ne__(self, other: object) -> bool: ... + def __setattr__(self, name, value): ... + +@final +class MessageMeta(type): ... + +@final +class MethodDescriptor: + client_streaming: Incomplete + containing_service: Incomplete + full_name: Incomplete + index: Incomplete + input_type: Incomplete + name: Incomplete + output_type: Incomplete + server_streaming: Incomplete + def __init__(self, *args, **kwargs) -> None: ... # incomplete + def CopyToProto(self, object, /): ... + def GetOptions(self): ... + +@final +class OneofDescriptor: + containing_type: Incomplete + fields: Incomplete + full_name: Incomplete + has_options: Incomplete + index: Incomplete + name: Incomplete + def __init__(self, *args, **kwargs) -> None: ... # incomplete + def GetOptions(self): ... + +@final +class RepeatedCompositeContainer: + def __init__(self, *args, **kwargs) -> None: ... # incomplete + def MergeFrom(self, object, /): ... + def add(self, *args, **kwargs): ... # incomplete + def append(self, object, /): ... + def extend(self, object, /): ... + def insert(self, *args, **kwargs): ... # incomplete + def pop(self, *args, **kwargs): ... # incomplete + def remove(self, object, /): ... + def reverse(self): ... + def sort(self, *args, **kwargs): ... # incomplete + def __deepcopy__(self, memo=None): ... + def __delitem__(self, other) -> None: ... + def __eq__(self, other: object) -> bool: ... + def __ge__(self, other: object) -> bool: ... + def __getitem__(self, index): ... + def __gt__(self, other: object) -> bool: ... + def __le__(self, other: object) -> bool: ... + def __len__(self) -> int: ... + def __lt__(self, other: object) -> bool: ... + def __ne__(self, other: object) -> bool: ... + def __setitem__(self, index, object) -> None: ... + +@final +class RepeatedScalarContainer: + def __init__(self, *args, **kwargs) -> None: ... # incomplete + def MergeFrom(self, object, /): ... + def append(self, object, /): ... + def extend(self, object, /): ... + def insert(self, *args, **kwargs): ... # incomplete + def pop(self, *args, **kwargs): ... # incomplete + def remove(self, object, /): ... + def reverse(self): ... + def sort(self, *args, **kwargs): ... # incomplete + def __deepcopy__(self, memo=None): ... + def __delitem__(self, other) -> None: ... + def __eq__(self, other: object) -> bool: ... + def __ge__(self, other: object) -> bool: ... + def __getitem__(self, index): ... + def __gt__(self, other: object) -> bool: ... + def __le__(self, other: object) -> bool: ... + def __len__(self) -> int: ... + def __lt__(self, other: object) -> bool: ... + def __ne__(self, other: object) -> bool: ... + def __reduce__(self): ... + def __setitem__(self, index, object) -> None: ... + +@final +class ServiceDescriptor: + file: Incomplete + full_name: Incomplete + index: Incomplete + methods: Incomplete + methods_by_name: Incomplete + name: Incomplete + def __init__(self, *args, **kwargs) -> None: ... # incomplete + def CopyToProto(self, object, /): ... + def FindMethodByName(self, object, /): ... + def GetOptions(self): ... + +@final +class UnknownFieldSet: + def __init__(self, *args, **kwargs) -> None: ... # incomplete + def __getitem__(self, index): ... + def __len__(self) -> int: ... + +def SetAllowOversizeProtos(object, /): ... # incomplete diff --git a/stubs/protobuf/google/protobuf/descriptor_database.pyi b/stubs/protobuf/google/protobuf/descriptor_database.pyi new file mode 100644 index 000000000..6568fc215 --- /dev/null +++ b/stubs/protobuf/google/protobuf/descriptor_database.pyi @@ -0,0 +1,16 @@ +from typing import Final + +from google.protobuf.descriptor_pb2 import FileDescriptorProto + +__author__: Final[str] + +class Error(Exception): ... +class DescriptorDatabaseConflictingDefinitionError(Error): ... + +class DescriptorDatabase: + def __init__(self) -> None: ... + def Add(self, file_desc_proto) -> None: ... + def FindFileByName(self, name): ... + def FindFileContainingSymbol(self, symbol): ... + def FindFileContainingExtension(self, extendee_name, extension_number) -> FileDescriptorProto | None: ... + def FindAllExtensionNumbers(self, extendee_name) -> list[int]: ... diff --git a/stubs/protobuf/google/protobuf/message.pyi b/stubs/protobuf/google/protobuf/message.pyi index a63e610ff..ea1d636ee 100644 --- a/stubs/protobuf/google/protobuf/message.pyi +++ b/stubs/protobuf/google/protobuf/message.pyi @@ -2,6 +2,8 @@ from collections.abc import Sequence from typing import Any from typing_extensions import Self +from google._upb._message import Descriptor as _upb_Descriptor + from .descriptor import Descriptor, FieldDescriptor from .internal.extension_dict import _ExtensionDict, _ExtensionFieldDescriptor @@ -10,7 +12,7 @@ class DecodeError(Error): ... class EncodeError(Error): ... class Message: - DESCRIPTOR: Descriptor + DESCRIPTOR: Descriptor | _upb_Descriptor def __deepcopy__(self, memo: Any = None) -> Self: ... def __eq__(self, other_msg): ... def __ne__(self, other_msg): ...