Skip to content

Commit 284e906

Browse files
committed
resolve subtest issues
1 parent 1290473 commit 284e906

File tree

3 files changed

+70
-10
lines changed

3 files changed

+70
-10
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Error: is not present at runtime
2+
# =============================
3+
# ...
4+
grpc.aio.MetadataKey
5+
grpc.aio.MetadataType
6+
grpc.aio.MetadataValue
7+
grpc.aio.MetadatumType
8+
grpc.aio.RequestSerializer
9+
grpc.aio.ResponseDeserializer
10+
grpc_health.v1.health.SendResponseCallback
11+
grpc_reflection.v1alpha.reflection.AnyServer
12+
grpc_reflection.v1alpha.reflection.AnyServicerContext
13+
14+
# Error: is inconsistent
15+
# =============================
16+
# Stub class is incomplete.
17+
grpc_reflection.v1alpha._base.BaseReflectionServicer.__init__

stubs/grpcio/METADATA.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,9 @@ requires = [
77

88
[tool.stubtest]
99
ignore_missing_stub = true
10+
stubtest_requirements = [
11+
"grpcio-channelz",
12+
"grpcio-health-checking",
13+
"grpcio-reflection",
14+
"grpcio-status",
15+
]

stubs/grpcio/grpc/aio/__init__.pyi

Lines changed: 47 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -129,20 +129,26 @@ class Channel(abc.ABC):
129129

130130
# Server Object:
131131

132-
class Server:
132+
class Server(metaclass=abc.ABCMeta):
133+
@abc.abstractmethod
133134
def add_generic_rpc_handlers(self, generic_rpc_handlers: Iterable[GenericRpcHandler[typing.Any, typing.Any]]) -> None: ...
134135

135136
# Returns an integer port on which server will accept RPC requests.
137+
@abc.abstractmethod
136138
def add_insecure_port(self, address: str) -> int: ...
137139

138140
# Returns an integer port on which server will accept RPC requests.
141+
@abc.abstractmethod
139142
def add_secure_port(self, address: str, server_credentials: ServerCredentials) -> int: ...
143+
@abc.abstractmethod
140144
async def start(self) -> None: ...
141145

142146
# Grace period is in seconds.
143-
async def stop(self, grace: float | None = ...) -> None: ...
147+
@abc.abstractmethod
148+
async def stop(self, grace: float | None) -> None: ...
144149

145150
# Returns a bool indicates if the operation times out. Timeout is in seconds.
151+
@abc.abstractmethod
146152
async def wait_for_termination(self, timeout: float | None = ...) -> bool: ...
147153

148154
# Client-Side Context:
@@ -175,43 +181,67 @@ class Call(RpcContext, metaclass=abc.ABCMeta):
175181
async def wait_for_connection(self) -> None: ...
176182

177183
class UnaryUnaryCall(Call, typing.Generic[_TRequest, _TResponse], metaclass=abc.ABCMeta):
184+
@abc.abstractmethod
178185
def __await__(self) -> Generator[None, None, _TResponse]: ...
179186

180187
class UnaryStreamCall(Call, typing.Generic[_TRequest, _TResponse], metaclass=abc.ABCMeta):
188+
@abc.abstractmethod
181189
def __aiter__(self) -> AsyncIterator[_TResponse]: ...
190+
@abc.abstractmethod
182191
async def read(self) -> EOFType | _TResponse: ...
183192

184193
class StreamUnaryCall(Call, typing.Generic[_TRequest, _TResponse], metaclass=abc.ABCMeta):
194+
@abc.abstractmethod
185195
async def write(self, request: _TRequest) -> None: ...
196+
@abc.abstractmethod
186197
async def done_writing(self) -> None: ...
198+
@abc.abstractmethod
187199
def __await__(self) -> Generator[None, None, _TResponse]: ...
188200

189201
class StreamStreamCall(Call, typing.Generic[_TRequest, _TResponse], metaclass=abc.ABCMeta):
202+
@abc.abstractmethod
190203
def __aiter__(self) -> AsyncIterator[_TResponse]: ...
204+
@abc.abstractmethod
191205
async def read(self) -> EOFType | _TResponse: ...
206+
@abc.abstractmethod
192207
async def write(self, request: _TRequest) -> None: ...
208+
@abc.abstractmethod
193209
async def done_writing(self) -> None: ...
194210

195211
# Service-Side Context:
196212

197213
class DoneCallback(typing.Generic[_TRequest, _TResponse]):
198214
def __call__(self, ctx: ServicerContext[_TRequest, _TResponse]) -> None: ...
199215

200-
class ServicerContext(typing.Generic[_TRequest, _TResponse]):
216+
class ServicerContext(typing.Generic[_TRequest, _TResponse], metaclass=abc.ABCMeta):
217+
@abc.abstractmethod
201218
async def abort(self, code: StatusCode, details: str = ..., trailing_metadata: MetadataType = ...) -> typing.NoReturn: ...
219+
@abc.abstractmethod
202220
async def read(self) -> _TRequest: ...
221+
@abc.abstractmethod
203222
async def write(self, message: _TResponse) -> None: ...
223+
@abc.abstractmethod
204224
async def send_initial_metadata(self, initial_metadata: MetadataType) -> None: ...
205225
def add_done_callback(self, callback: DoneCallback[_TRequest, _TResponse]) -> None: ...
226+
@abc.abstractmethod
206227
def set_trailing_metadata(self, trailing_metadata: MetadataType) -> None: ...
228+
@abc.abstractmethod
207229
def invocation_metadata(self) -> Metadata | None: ...
230+
@abc.abstractmethod
208231
def set_code(self, code: StatusCode) -> None: ...
232+
@abc.abstractmethod
209233
def set_details(self, details: str) -> None: ...
234+
@abc.abstractmethod
210235
def set_compression(self, compression: Compression) -> None: ...
236+
@abc.abstractmethod
211237
def disable_next_message_compression(self) -> None: ...
238+
@abc.abstractmethod
212239
def peer(self) -> str: ...
240+
@abc.abstractmethod
213241
def peer_identities(self) -> Iterable[bytes] | None: ...
242+
@abc.abstractmethod
214243
def peer_identity_key(self) -> str | None: ...
244+
@abc.abstractmethod
215245
def auth_context(self) -> Mapping[str, Iterable[bytes]]: ...
216246
def time_remaining(self) -> float: ...
217247
def trailing_metadata(self) -> Metadata: ...
@@ -290,7 +320,7 @@ class InterceptedUnaryUnaryCall(InterceptedCall[_TRequest, _TResponse]):
290320
) -> UnaryUnaryCall[_TRequest, _TResponse]: ...
291321
def time_remaining(self) -> float | None: ...
292322

293-
class UnaryUnaryClientInterceptor(typing.Generic[_TRequest, _TResponse]):
323+
class UnaryUnaryClientInterceptor(typing.Generic[_TRequest, _TResponse], metaclass=abc.ABCMeta):
294324
@abc.abstractmethod
295325
async def intercept_unary_unary(
296326
self,
@@ -300,7 +330,7 @@ class UnaryUnaryClientInterceptor(typing.Generic[_TRequest, _TResponse]):
300330
request: _TRequest,
301331
) -> _TResponse: ...
302332

303-
class UnaryStreamClientInterceptor(typing.Generic[_TRequest, _TResponse]):
333+
class UnaryStreamClientInterceptor(typing.Generic[_TRequest, _TResponse], metaclass=abc.ABCMeta):
304334
@abc.abstractmethod
305335
async def intercept_unary_stream(
306336
self,
@@ -309,7 +339,7 @@ class UnaryStreamClientInterceptor(typing.Generic[_TRequest, _TResponse]):
309339
request: _TRequest,
310340
) -> AsyncIterable[_TResponse] | UnaryStreamCall[_TRequest, _TResponse]: ...
311341

312-
class StreamUnaryClientInterceptor(typing.Generic[_TRequest, _TResponse]):
342+
class StreamUnaryClientInterceptor(typing.Generic[_TRequest, _TResponse], metaclass=abc.ABCMeta):
313343
@abc.abstractmethod
314344
async def intercept_stream_unary(
315345
self,
@@ -318,7 +348,7 @@ class StreamUnaryClientInterceptor(typing.Generic[_TRequest, _TResponse]):
318348
request_iterator: AsyncIterable[_TRequest] | Iterable[_TRequest],
319349
) -> AsyncIterable[_TResponse] | UnaryStreamCall[_TRequest, _TResponse]: ...
320350

321-
class StreamStreamClientInterceptor(typing.Generic[_TRequest, _TResponse]):
351+
class StreamStreamClientInterceptor(typing.Generic[_TRequest, _TResponse], metaclass=abc.ABCMeta):
322352
@abc.abstractmethod
323353
async def intercept_stream_stream(
324354
self,
@@ -329,7 +359,8 @@ class StreamStreamClientInterceptor(typing.Generic[_TRequest, _TResponse]):
329359

330360
# Server-Side Interceptor:
331361

332-
class ServerInterceptor(typing.Generic[_TRequest, _TResponse]):
362+
class ServerInterceptor(typing.Generic[_TRequest, _TResponse], metaclass=abc.ABCMeta):
363+
@abc.abstractmethod
333364
async def intercept_service(
334365
self,
335366
continuation: Callable[[HandlerCallDetails], Awaitable[RpcMethodHandler[_TRequest, _TResponse]]],
@@ -339,9 +370,11 @@ class ServerInterceptor(typing.Generic[_TRequest, _TResponse]):
339370
# Multi-Callable Interfaces:
340371

341372
class UnaryUnaryMultiCallable(typing.Generic[_TRequest, _TResponse], metaclass=abc.ABCMeta):
373+
@abc.abstractmethod
342374
def __call__(
343375
self,
344376
request: _TRequest,
377+
*,
345378
timeout: float | None = ...,
346379
metadata: MetadataType | None = ...,
347380
credentials: CallCredentials | None = ...,
@@ -351,9 +384,11 @@ class UnaryUnaryMultiCallable(typing.Generic[_TRequest, _TResponse], metaclass=a
351384
) -> UnaryUnaryCall[_TRequest, _TResponse]: ...
352385

353386
class UnaryStreamMultiCallable(typing.Generic[_TRequest, _TResponse], metaclass=abc.ABCMeta):
387+
@abc.abstractmethod
354388
def __call__(
355389
self,
356390
request: _TRequest,
391+
*,
357392
timeout: float | None = ...,
358393
metadata: MetadataType | None = ...,
359394
credentials: CallCredentials | None = ...,
@@ -363,9 +398,10 @@ class UnaryStreamMultiCallable(typing.Generic[_TRequest, _TResponse], metaclass=
363398
) -> UnaryStreamCall[_TRequest, _TResponse]: ...
364399

365400
class StreamUnaryMultiCallable(typing.Generic[_TRequest, _TResponse], metaclass=abc.ABCMeta):
401+
@abc.abstractmethod
366402
def __call__(
367403
self,
368-
request_iterator: AsyncIterator[_TRequest] | Iterator[_TRequest] | None,
404+
request_iterator: AsyncIterator[_TRequest] | Iterator[_TRequest] | None = None,
369405
timeout: float | None = ...,
370406
metadata: MetadataType | None = ...,
371407
credentials: CallCredentials | None = ...,
@@ -375,9 +411,10 @@ class StreamUnaryMultiCallable(typing.Generic[_TRequest, _TResponse], metaclass=
375411
) -> StreamUnaryCall[_TRequest, _TResponse]: ...
376412

377413
class StreamStreamMultiCallable(typing.Generic[_TRequest, _TResponse], metaclass=abc.ABCMeta):
414+
@abc.abstractmethod
378415
def __call__(
379416
self,
380-
request_iterator: AsyncIterator[_TRequest] | Iterator[_TRequest] | None,
417+
request_iterator: AsyncIterator[_TRequest] | Iterator[_TRequest] | None = None,
381418
timeout: float | None = ...,
382419
metadata: MetadataType | None = ...,
383420
credentials: CallCredentials | None = ...,

0 commit comments

Comments
 (0)