@@ -7,9 +7,15 @@ import abc
7
7
import collections .abc
8
8
import grpc
9
9
import grpc .aio
10
+ import sys
10
11
import testproto .grpc .dummy_pb2
11
12
import typing
12
13
14
+ if sys .version_info >= (3 , 13 ):
15
+ import typing as typing_extensions
16
+ else :
17
+ import typing_extensions
18
+
13
19
_T = typing .TypeVar ("_T" )
14
20
15
21
class _MaybeAsyncIterator (collections .abc .AsyncIterator [_T ], collections .abc .Iterator [_T ], metaclass = abc .ABCMeta ): ...
@@ -19,60 +25,143 @@ class _ServicerContext(grpc.ServicerContext, grpc.aio.ServicerContext): # type:
19
25
20
26
GRPC_GENERATED_VERSION : str
21
27
GRPC_VERSION : str
22
- class DummyServiceStub :
23
- """DummyService"""
24
-
25
- def __init__ (self , channel : typing .Union [grpc .Channel , grpc .aio .Channel ]) -> None : ...
26
- UnaryUnary : grpc .UnaryUnaryMultiCallable [
28
+ _DummyServiceUnaryUnaryType = typing_extensions .TypeVar (
29
+ '_DummyServiceUnaryUnaryType' ,
30
+ grpc .UnaryUnaryMultiCallable [
27
31
testproto .grpc .dummy_pb2 .DummyRequest ,
28
32
testproto .grpc .dummy_pb2 .DummyReply ,
29
- ]
30
- """UnaryUnary"""
33
+ ],
34
+ grpc .aio .UnaryUnaryMultiCallable [
35
+ testproto .grpc .dummy_pb2 .DummyRequest ,
36
+ testproto .grpc .dummy_pb2 .DummyReply ,
37
+ ],
38
+ default = grpc .UnaryUnaryMultiCallable [
39
+ testproto .grpc .dummy_pb2 .DummyRequest ,
40
+ testproto .grpc .dummy_pb2 .DummyReply ,
41
+ ],
42
+ )
31
43
32
- UnaryStream : grpc .UnaryStreamMultiCallable [
44
+ _DummyServiceUnaryStreamType = typing_extensions .TypeVar (
45
+ '_DummyServiceUnaryStreamType' ,
46
+ grpc .UnaryStreamMultiCallable [
33
47
testproto .grpc .dummy_pb2 .DummyRequest ,
34
48
testproto .grpc .dummy_pb2 .DummyReply ,
35
- ]
36
- """UnaryStream"""
49
+ ],
50
+ grpc .aio .UnaryStreamMultiCallable [
51
+ testproto .grpc .dummy_pb2 .DummyRequest ,
52
+ testproto .grpc .dummy_pb2 .DummyReply ,
53
+ ],
54
+ default = grpc .UnaryStreamMultiCallable [
55
+ testproto .grpc .dummy_pb2 .DummyRequest ,
56
+ testproto .grpc .dummy_pb2 .DummyReply ,
57
+ ],
58
+ )
37
59
38
- StreamUnary : grpc .StreamUnaryMultiCallable [
60
+ _DummyServiceStreamUnaryType = typing_extensions .TypeVar (
61
+ '_DummyServiceStreamUnaryType' ,
62
+ grpc .StreamUnaryMultiCallable [
39
63
testproto .grpc .dummy_pb2 .DummyRequest ,
40
64
testproto .grpc .dummy_pb2 .DummyReply ,
41
- ]
42
- """StreamUnary"""
65
+ ],
66
+ grpc .aio .StreamUnaryMultiCallable [
67
+ testproto .grpc .dummy_pb2 .DummyRequest ,
68
+ testproto .grpc .dummy_pb2 .DummyReply ,
69
+ ],
70
+ default = grpc .StreamUnaryMultiCallable [
71
+ testproto .grpc .dummy_pb2 .DummyRequest ,
72
+ testproto .grpc .dummy_pb2 .DummyReply ,
73
+ ],
74
+ )
43
75
44
- StreamStream : grpc .StreamStreamMultiCallable [
76
+ _DummyServiceStreamStreamType = typing_extensions .TypeVar (
77
+ '_DummyServiceStreamStreamType' ,
78
+ grpc .StreamStreamMultiCallable [
45
79
testproto .grpc .dummy_pb2 .DummyRequest ,
46
80
testproto .grpc .dummy_pb2 .DummyReply ,
47
- ]
48
- """StreamStream"""
81
+ ],
82
+ grpc .aio .StreamStreamMultiCallable [
83
+ testproto .grpc .dummy_pb2 .DummyRequest ,
84
+ testproto .grpc .dummy_pb2 .DummyReply ,
85
+ ],
86
+ default = grpc .StreamStreamMultiCallable [
87
+ testproto .grpc .dummy_pb2 .DummyRequest ,
88
+ testproto .grpc .dummy_pb2 .DummyReply ,
89
+ ],
90
+ )
49
91
50
- class DummyServiceAsyncStub :
92
+ class DummyServiceStub ( typing . Generic [ _DummyServiceUnaryUnaryType , _DummyServiceUnaryStreamType , _DummyServiceStreamUnaryType , _DummyServiceStreamStreamType ]) :
51
93
"""DummyService"""
52
94
53
- UnaryUnary : grpc .aio .UnaryUnaryMultiCallable [
54
- testproto .grpc .dummy_pb2 .DummyRequest ,
55
- testproto .grpc .dummy_pb2 .DummyReply ,
56
- ]
95
+ @typing .overload
96
+ def __init__ (self : DummyServiceStub [
97
+ grpc .UnaryUnaryMultiCallable [
98
+ testproto .grpc .dummy_pb2 .DummyRequest ,
99
+ testproto .grpc .dummy_pb2 .DummyReply ,
100
+ ],
101
+ grpc .UnaryStreamMultiCallable [
102
+ testproto .grpc .dummy_pb2 .DummyRequest ,
103
+ testproto .grpc .dummy_pb2 .DummyReply ,
104
+ ],
105
+ grpc .StreamUnaryMultiCallable [
106
+ testproto .grpc .dummy_pb2 .DummyRequest ,
107
+ testproto .grpc .dummy_pb2 .DummyReply ,
108
+ ],
109
+ grpc .StreamStreamMultiCallable [
110
+ testproto .grpc .dummy_pb2 .DummyRequest ,
111
+ testproto .grpc .dummy_pb2 .DummyReply ,
112
+ ],
113
+ ], channel : grpc .Channel ) -> None : ...
114
+
115
+ @typing .overload
116
+ def __init__ (self : DummyServiceStub [
117
+ grpc .aio .UnaryUnaryMultiCallable [
118
+ testproto .grpc .dummy_pb2 .DummyRequest ,
119
+ testproto .grpc .dummy_pb2 .DummyReply ,
120
+ ],
121
+ grpc .aio .UnaryStreamMultiCallable [
122
+ testproto .grpc .dummy_pb2 .DummyRequest ,
123
+ testproto .grpc .dummy_pb2 .DummyReply ,
124
+ ],
125
+ grpc .aio .StreamUnaryMultiCallable [
126
+ testproto .grpc .dummy_pb2 .DummyRequest ,
127
+ testproto .grpc .dummy_pb2 .DummyReply ,
128
+ ],
129
+ grpc .aio .StreamStreamMultiCallable [
130
+ testproto .grpc .dummy_pb2 .DummyRequest ,
131
+ testproto .grpc .dummy_pb2 .DummyReply ,
132
+ ],
133
+ ], channel : grpc .aio .Channel ) -> None : ...
134
+
135
+ UnaryUnary : _DummyServiceUnaryUnaryType
57
136
"""UnaryUnary"""
58
137
59
- UnaryStream : grpc .aio .UnaryStreamMultiCallable [
60
- testproto .grpc .dummy_pb2 .DummyRequest ,
61
- testproto .grpc .dummy_pb2 .DummyReply ,
62
- ]
138
+ UnaryStream : _DummyServiceUnaryStreamType
63
139
"""UnaryStream"""
64
140
65
- StreamUnary : grpc .aio .StreamUnaryMultiCallable [
66
- testproto .grpc .dummy_pb2 .DummyRequest ,
67
- testproto .grpc .dummy_pb2 .DummyReply ,
68
- ]
141
+ StreamUnary : _DummyServiceStreamUnaryType
69
142
"""StreamUnary"""
70
143
71
- StreamStream : grpc .aio .StreamStreamMultiCallable [
144
+ StreamStream : _DummyServiceStreamStreamType
145
+ """StreamStream"""
146
+
147
+ DummyServiceAsyncStub : typing_extensions .TypeAlias = DummyServiceStub [
148
+ grpc .aio .UnaryUnaryMultiCallable [
72
149
testproto .grpc .dummy_pb2 .DummyRequest ,
73
150
testproto .grpc .dummy_pb2 .DummyReply ,
74
- ]
75
- """StreamStream"""
151
+ ],
152
+ grpc .aio .UnaryStreamMultiCallable [
153
+ testproto .grpc .dummy_pb2 .DummyRequest ,
154
+ testproto .grpc .dummy_pb2 .DummyReply ,
155
+ ],
156
+ grpc .aio .StreamUnaryMultiCallable [
157
+ testproto .grpc .dummy_pb2 .DummyRequest ,
158
+ testproto .grpc .dummy_pb2 .DummyReply ,
159
+ ],
160
+ grpc .aio .StreamStreamMultiCallable [
161
+ testproto .grpc .dummy_pb2 .DummyRequest ,
162
+ testproto .grpc .dummy_pb2 .DummyReply ,
163
+ ],
164
+ ]
76
165
77
166
class DummyServiceServicer (metaclass = abc .ABCMeta ):
78
167
"""DummyService"""
0 commit comments