Skip to content

Commit 5a7550f

Browse files
committed
minor changes based on PR comments
1 parent af2121c commit 5a7550f

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

google/api_core/bidi_async.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2024, Google LLC
1+
# Copyright 2025, Google LLC
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -24,9 +24,9 @@
2424

2525

2626
class _AsyncRequestQueueGenerator:
27-
"""An async helper for sending requests to a gRPC stream from a Queue.
27+
"""_AsyncRequestQueueGenerator is a helper class for sending asynchronous requests to a gRPC stream from a Queue.
2828
29-
This generator takes requests off a given queue and yields them to gRPC.
29+
This generator takes asynchronous requests off a given queue and yields them to gRPC.
3030
3131
This helper is useful when you have an indeterminate, indefinite, or
3232
otherwise open-ended set of requests to send through a request-streaming
@@ -72,10 +72,9 @@ def __init__(self, queue: asyncio.Queue, initial_request=None):
7272
self.call = None
7373

7474
def _is_active(self):
75-
# Note: there is a possibility that this starts *before* the call
76-
# property is set. So we have to check if self.call is set before
77-
# seeing if it's active. We need to return True if self.call is None.
78-
# See https://github.com/googleapis/python-api-core/issues/560.
75+
"""
76+
Returns true if the call is not set or not completed.
77+
"""
7978
return self.call is None or not self.call.done()
8079

8180
async def __aiter__(self):
@@ -200,7 +199,7 @@ async def send(self, request):
200199
request (protobuf.Message): The request to send.
201200
"""
202201
if self.call is None:
203-
raise ValueError("Can not send() on an RPC that has never been open()ed.")
202+
raise ValueError("Can not send() on an RPC that has never been opened.")
204203

205204
# Don't use self.is_active(), as ResumableBidiRpc will overload it
206205
# to mean something semantically different.

google/api_core/bidi_base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def __init__(self, start_rpc, initial_request=None, metadata=None):
4747

4848
def _create_queue(self):
4949
"""Create a queue for requests."""
50-
raise NotImplementedError("Not implemented in base class")
50+
raise NotImplementedError("`_create_queue` is not implemented.")
5151

5252
def add_done_callback(self, callback):
5353
"""Adds a callback that will be called when the RPC terminates.
@@ -72,7 +72,7 @@ def _on_call_done(self, future):
7272
@property
7373
def is_active(self):
7474
"""bool: True if this stream is currently open and active."""
75-
raise NotImplementedError("Not implemented in base class")
75+
raise NotImplementedError("`is_active` is not implemented.")
7676

7777
@property
7878
def pending_requests(self):

0 commit comments

Comments
 (0)