Skip to content

Commit 5849e04

Browse files
authored
docs: update missing docstrings (#890)
1 parent dc6babc commit 5849e04

File tree

1 file changed

+24
-20
lines changed

1 file changed

+24
-20
lines changed

google/cloud/pubsub_v1/subscriber/message.py

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -75,15 +75,15 @@ class Message(object):
7575
:class:`~.pubsub_v1.subscriber._consumer.Consumer`.)
7676
7777
Attributes:
78-
message_id:
78+
message_id (str):
7979
The message ID. In general, you should not need to use this directly.
80-
data:
80+
data (bytes):
8181
The data in the message. Note that this will be a :class:`bytes`,
8282
not a text string.
83-
attributes:
83+
attributes (MutableMapping[str, str]):
8484
The attributes sent along with the message. See :attr:`attributes` for more
8585
information on this type.
86-
publish_time:
86+
publish_time (google.protobuf.timestamp_pb2.Timestamp):
8787
The time that this message was originally published.
8888
"""
8989

@@ -103,21 +103,21 @@ def __init__(
103103
responsibility of :class:`BasePolicy` subclasses to do so.
104104
105105
Args:
106-
message:
106+
message (types.PubsubMessage._meta._pb):
107107
The message received from Pub/Sub. For performance reasons it should be
108108
the raw protobuf message normally wrapped by
109109
:class:`~pubsub_v1.types.PubsubMessage`. A raw message can be obtained
110110
from a :class:`~pubsub_v1.types.PubsubMessage` instance through the
111111
latter's ``._pb`` attribute.
112-
ack_id:
112+
ack_id (str):
113113
The ack_id received from Pub/Sub.
114-
delivery_attempt:
114+
delivery_attempt (int):
115115
The delivery attempt counter received from Pub/Sub if a DeadLetterPolicy
116116
is set on the subscription, and zero otherwise.
117-
request_queue:
117+
request_queue (queue.Queue):
118118
A queue provided by the policy that can accept requests; the policy is
119119
responsible for handling those requests.
120-
exactly_once_delivery_enabled_func:
120+
exactly_once_delivery_enabled_func (Callable[[], bool]):
121121
A Callable that returns whether exactly-once delivery is currently-enabled. Defaults to a lambda that always returns False.
122122
"""
123123
self._message = message
@@ -172,8 +172,8 @@ def attributes(self) -> "containers.ScalarMap":
172172
to just cast the map to a ``dict`` or to one use ``map.get``.
173173
174174
Returns:
175-
The message's attributes. This is a ``dict``-like object provided by
176-
``google.protobuf``.
175+
containers.ScalarMap: The message's attributes. This is a
176+
``dict``-like object provided by ``google.protobuf``.
177177
"""
178178
return self._attributes
179179

@@ -182,8 +182,8 @@ def data(self) -> bytes:
182182
"""Return the data for the underlying Pub/Sub Message.
183183
184184
Returns:
185-
The message data. This is always a bytestring; if you want a text string,
186-
call :meth:`bytes.decode`.
185+
bytes: The message data. This is always a bytestring; if you want
186+
a text string, call :meth:`bytes.decode`.
187187
"""
188188
return self._data
189189

@@ -192,7 +192,8 @@ def publish_time(self) -> "datetime.datetime":
192192
"""Return the time that the message was originally published.
193193
194194
Returns:
195-
The date and time that the message was published.
195+
datetime.datetime: The date and time that the message was
196+
published.
196197
"""
197198
return self._publish_time
198199

@@ -227,7 +228,7 @@ def delivery_attempt(self) -> Optional[int]:
227228
is calculated at best effort and is approximate.
228229
229230
Returns:
230-
The delivery attempt counter or ``None``.
231+
Optional[int]: The delivery attempt counter or ``None``.
231232
"""
232233
return self._delivery_attempt
233234

@@ -290,7 +291,8 @@ def ack_with_response(self) -> "futures.Future":
290291
see https://cloud.google.com/pubsub/docs/exactly-once-delivery."
291292
292293
Returns:
293-
A :class:`~google.cloud.pubsub_v1.subscriber.futures.Future`
294+
futures.Future: A
295+
:class:`~google.cloud.pubsub_v1.subscriber.futures.Future`
294296
instance that conforms to Python Standard library's
295297
:class:`~concurrent.futures.Future` interface (but not an
296298
instance of that class). Call `result()` to get the result
@@ -349,7 +351,7 @@ def modify_ack_deadline(self, seconds: int) -> None:
349351
:class:`~.pubsub_v1.subcriber._consumer.Consumer`.
350352
351353
Args:
352-
seconds:
354+
seconds (int):
353355
The number of seconds to set the lease deadline to. This should be
354356
between 0 and 600. Due to network latency, values below 10 are advised
355357
against.
@@ -387,12 +389,13 @@ def modify_ack_deadline_with_response(self, seconds: int) -> "futures.Future":
387389
see https://cloud.google.com/pubsub/docs/exactly-once-delivery."
388390
389391
Args:
390-
seconds:
392+
seconds (int):
391393
The number of seconds to set the lease deadline to. This should be
392394
between 0 and 600. Due to network latency, values below 10 are advised
393395
against.
394396
Returns:
395-
A :class:`~google.cloud.pubsub_v1.subscriber.futures.Future`
397+
futures.Future: A
398+
:class:`~google.cloud.pubsub_v1.subscriber.futures.Future`
396399
instance that conforms to Python Standard library's
397400
:class:`~concurrent.futures.Future` interface (but not an
398401
instance of that class). Call `result()` to get the result
@@ -457,7 +460,8 @@ def nack_with_response(self) -> "futures.Future":
457460
see https://cloud.google.com/pubsub/docs/exactly-once-delivery."
458461
459462
Returns:
460-
A :class:`~google.cloud.pubsub_v1.subscriber.futures.Future`
463+
futures.Future: A
464+
:class:`~google.cloud.pubsub_v1.subscriber.futures.Future`
461465
instance that conforms to Python Standard library's
462466
:class:`~concurrent.futures.Future` interface (but not an
463467
instance of that class). Call `result()` to get the result

0 commit comments

Comments
 (0)