File: reflection_grpc.py

package info (click to toggle)
python-grpclib 0.4.8-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 484 kB
  • sloc: python: 3,370; makefile: 2
file content (40 lines) | stat: -rw-r--r-- 1,524 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# Generated by the Protocol Buffers compiler. DO NOT EDIT!
# source: grpclib/reflection/v1alpha/reflection.proto
# plugin: grpclib.plugin.main
import abc
import typing

import grpclib.const
import grpclib.client
if typing.TYPE_CHECKING:
    import grpclib.server

import grpclib.reflection.v1alpha.reflection_pb2


class ServerReflectionBase(abc.ABC):

    @abc.abstractmethod
    async def ServerReflectionInfo(self, stream: 'grpclib.server.Stream[grpclib.reflection.v1alpha.reflection_pb2.ServerReflectionRequest, grpclib.reflection.v1alpha.reflection_pb2.ServerReflectionResponse]') -> None:
        pass

    def __mapping__(self) -> typing.Dict[str, grpclib.const.Handler]:
        return {
            '/grpc.reflection.v1alpha.ServerReflection/ServerReflectionInfo': grpclib.const.Handler(
                self.ServerReflectionInfo,
                grpclib.const.Cardinality.STREAM_STREAM,
                grpclib.reflection.v1alpha.reflection_pb2.ServerReflectionRequest,
                grpclib.reflection.v1alpha.reflection_pb2.ServerReflectionResponse,
            ),
        }


class ServerReflectionStub:

    def __init__(self, channel: grpclib.client.Channel) -> None:
        self.ServerReflectionInfo = grpclib.client.StreamStreamMethod(
            channel,
            '/grpc.reflection.v1alpha.ServerReflection/ServerReflectionInfo',
            grpclib.reflection.v1alpha.reflection_pb2.ServerReflectionRequest,
            grpclib.reflection.v1alpha.reflection_pb2.ServerReflectionResponse,
        )