@@ -7,9 +7,15 @@ import abc
77import collections .abc
88import grpc
99import grpc .aio
10+ import sys
1011import testproto .grpc .dummy_pb2
1112import typing
1213
14+ if sys .version_info >= (3 , 13 ):
15+ import typing as typing_extensions
16+ else :
17+ import typing_extensions
18+
1319_T = typing .TypeVar ("_T" )
1420
1521class _MaybeAsyncIterator (collections .abc .AsyncIterator [_T ], collections .abc .Iterator [_T ], metaclass = abc .ABCMeta ): ...
@@ -19,60 +25,143 @@ class _ServicerContext(grpc.ServicerContext, grpc.aio.ServicerContext): # type:
1925
2026GRPC_GENERATED_VERSION : str
2127GRPC_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 [
2731 testproto .grpc .dummy_pb2 .DummyRequest ,
2832 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+ )
3143
32- UnaryStream : grpc .UnaryStreamMultiCallable [
44+ _DummyServiceUnaryStreamType = typing_extensions .TypeVar (
45+ '_DummyServiceUnaryStreamType' ,
46+ grpc .UnaryStreamMultiCallable [
3347 testproto .grpc .dummy_pb2 .DummyRequest ,
3448 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+ )
3759
38- StreamUnary : grpc .StreamUnaryMultiCallable [
60+ _DummyServiceStreamUnaryType = typing_extensions .TypeVar (
61+ '_DummyServiceStreamUnaryType' ,
62+ grpc .StreamUnaryMultiCallable [
3963 testproto .grpc .dummy_pb2 .DummyRequest ,
4064 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+ )
4375
44- StreamStream : grpc .StreamStreamMultiCallable [
76+ _DummyServiceStreamStreamType = typing_extensions .TypeVar (
77+ '_DummyServiceStreamStreamType' ,
78+ grpc .StreamStreamMultiCallable [
4579 testproto .grpc .dummy_pb2 .DummyRequest ,
4680 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+ )
4991
50- class DummyServiceAsyncStub :
92+ class DummyServiceStub ( typing . Generic [ _DummyServiceUnaryUnaryType , _DummyServiceUnaryStreamType , _DummyServiceStreamUnaryType , _DummyServiceStreamStreamType ]) :
5193 """DummyService"""
5294
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
57136 """UnaryUnary"""
58137
59- UnaryStream : grpc .aio .UnaryStreamMultiCallable [
60- testproto .grpc .dummy_pb2 .DummyRequest ,
61- testproto .grpc .dummy_pb2 .DummyReply ,
62- ]
138+ UnaryStream : _DummyServiceUnaryStreamType
63139 """UnaryStream"""
64140
65- StreamUnary : grpc .aio .StreamUnaryMultiCallable [
66- testproto .grpc .dummy_pb2 .DummyRequest ,
67- testproto .grpc .dummy_pb2 .DummyReply ,
68- ]
141+ StreamUnary : _DummyServiceStreamUnaryType
69142 """StreamUnary"""
70143
71- StreamStream : grpc .aio .StreamStreamMultiCallable [
144+ StreamStream : _DummyServiceStreamStreamType
145+ """StreamStream"""
146+
147+ DummyServiceAsyncStub : typing_extensions .TypeAlias = DummyServiceStub [
148+ grpc .aio .UnaryUnaryMultiCallable [
72149 testproto .grpc .dummy_pb2 .DummyRequest ,
73150 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+ ]
76165
77166class DummyServiceServicer (metaclass = abc .ABCMeta ):
78167 """DummyService"""
0 commit comments