mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-08-09 17:32:29 +08:00
Extract grpcio plugins (#13896)
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import cast
|
||||
|
||||
import grpc
|
||||
from grpc_reflection.v1alpha.reflection import enable_server_reflection
|
||||
|
||||
server = cast(grpc.Server, None)
|
||||
enable_server_reflection(["foo"], server, None)
|
||||
@@ -0,0 +1,9 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import cast
|
||||
|
||||
import grpc.aio
|
||||
from grpc_reflection.v1alpha.reflection import enable_server_reflection
|
||||
|
||||
server = cast(grpc.aio.Server, None)
|
||||
enable_server_reflection(["foo"], server, None)
|
||||
@@ -0,0 +1,3 @@
|
||||
version = "1.*"
|
||||
upstream_repository = "https://github.com/grpc/grpc"
|
||||
requires = ["types-grpcio", "types-protobuf"]
|
||||
@@ -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"]
|
||||
@@ -0,0 +1,6 @@
|
||||
from grpc_reflection.v1alpha import reflection_pb2_grpc
|
||||
|
||||
class BaseReflectionServicer(reflection_pb2_grpc.ServerReflectionServicer):
|
||||
def __init__(self, service_names, pool=None) -> None: ...
|
||||
|
||||
__all__ = ["BaseReflectionServicer"]
|
||||
+11
@@ -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: ...
|
||||
@@ -0,0 +1,28 @@
|
||||
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_reflection.v1alpha import reflection_pb2 as _reflection_pb2
|
||||
from grpc_reflection.v1alpha._base import BaseReflectionServicer
|
||||
|
||||
from . import _async as aio
|
||||
|
||||
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
|
||||
): ...
|
||||
|
||||
def enable_server_reflection(
|
||||
service_names: Iterable[str], server: _AnyServer, pool: descriptor_pool.DescriptorPool | None = None
|
||||
) -> None: ...
|
||||
|
||||
__all__ = ["SERVICE_NAME", "ReflectionServicer", "enable_server_reflection", "aio"]
|
||||
@@ -0,0 +1,107 @@
|
||||
from _typeshed import Incomplete
|
||||
from collections.abc import Iterable, Mapping
|
||||
from typing import ClassVar, final
|
||||
|
||||
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
|
||||
@@ -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,
|
||||
): ...
|
||||
Reference in New Issue
Block a user