Skip to content

Commit

Permalink
docs: update missing docstrings (#890)
Browse files Browse the repository at this point in the history
  • Loading branch information
dandhlee committed Mar 20, 2023
1 parent dc6babc commit 5849e04
Showing 1 changed file with 24 additions and 20 deletions.
44 changes: 24 additions & 20 deletions google/cloud/pubsub_v1/subscriber/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,15 @@ class Message(object):
:class:`~.pubsub_v1.subscriber._consumer.Consumer`.)
Attributes:
message_id:
message_id (str):
The message ID. In general, you should not need to use this directly.
data:
data (bytes):
The data in the message. Note that this will be a :class:`bytes`,
not a text string.
attributes:
attributes (MutableMapping[str, str]):
The attributes sent along with the message. See :attr:`attributes` for more
information on this type.
publish_time:
publish_time (google.protobuf.timestamp_pb2.Timestamp):
The time that this message was originally published.
"""

Expand All @@ -103,21 +103,21 @@ def __init__(
responsibility of :class:`BasePolicy` subclasses to do so.
Args:
message:
message (types.PubsubMessage._meta._pb):
The message received from Pub/Sub. For performance reasons it should be
the raw protobuf message normally wrapped by
:class:`~pubsub_v1.types.PubsubMessage`. A raw message can be obtained
from a :class:`~pubsub_v1.types.PubsubMessage` instance through the
latter's ``._pb`` attribute.
ack_id:
ack_id (str):
The ack_id received from Pub/Sub.
delivery_attempt:
delivery_attempt (int):
The delivery attempt counter received from Pub/Sub if a DeadLetterPolicy
is set on the subscription, and zero otherwise.
request_queue:
request_queue (queue.Queue):
A queue provided by the policy that can accept requests; the policy is
responsible for handling those requests.
exactly_once_delivery_enabled_func:
exactly_once_delivery_enabled_func (Callable[[], bool]):
A Callable that returns whether exactly-once delivery is currently-enabled. Defaults to a lambda that always returns False.
"""
self._message = message
Expand Down Expand Up @@ -172,8 +172,8 @@ def attributes(self) -> "containers.ScalarMap":
to just cast the map to a ``dict`` or to one use ``map.get``.
Returns:
The message's attributes. This is a ``dict``-like object provided by
``google.protobuf``.
containers.ScalarMap: The message's attributes. This is a
``dict``-like object provided by ``google.protobuf``.
"""
return self._attributes

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

Expand All @@ -192,7 +192,8 @@ def publish_time(self) -> "datetime.datetime":
"""Return the time that the message was originally published.
Returns:
The date and time that the message was published.
datetime.datetime: The date and time that the message was
published.
"""
return self._publish_time

Expand Down Expand Up @@ -227,7 +228,7 @@ def delivery_attempt(self) -> Optional[int]:
is calculated at best effort and is approximate.
Returns:
The delivery attempt counter or ``None``.
Optional[int]: The delivery attempt counter or ``None``.
"""
return self._delivery_attempt

Expand Down Expand Up @@ -290,7 +291,8 @@ def ack_with_response(self) -> "futures.Future":
see https://cloud.google.com/pubsub/docs/exactly-once-delivery."
Returns:
A :class:`~google.cloud.pubsub_v1.subscriber.futures.Future`
futures.Future: A
:class:`~google.cloud.pubsub_v1.subscriber.futures.Future`
instance that conforms to Python Standard library's
:class:`~concurrent.futures.Future` interface (but not an
instance of that class). Call `result()` to get the result
Expand Down Expand Up @@ -349,7 +351,7 @@ def modify_ack_deadline(self, seconds: int) -> None:
:class:`~.pubsub_v1.subcriber._consumer.Consumer`.
Args:
seconds:
seconds (int):
The number of seconds to set the lease deadline to. This should be
between 0 and 600. Due to network latency, values below 10 are advised
against.
Expand Down Expand Up @@ -387,12 +389,13 @@ def modify_ack_deadline_with_response(self, seconds: int) -> "futures.Future":
see https://cloud.google.com/pubsub/docs/exactly-once-delivery."
Args:
seconds:
seconds (int):
The number of seconds to set the lease deadline to. This should be
between 0 and 600. Due to network latency, values below 10 are advised
against.
Returns:
A :class:`~google.cloud.pubsub_v1.subscriber.futures.Future`
futures.Future: A
:class:`~google.cloud.pubsub_v1.subscriber.futures.Future`
instance that conforms to Python Standard library's
:class:`~concurrent.futures.Future` interface (but not an
instance of that class). Call `result()` to get the result
Expand Down Expand Up @@ -457,7 +460,8 @@ def nack_with_response(self) -> "futures.Future":
see https://cloud.google.com/pubsub/docs/exactly-once-delivery."
Returns:
A :class:`~google.cloud.pubsub_v1.subscriber.futures.Future`
futures.Future: A
:class:`~google.cloud.pubsub_v1.subscriber.futures.Future`
instance that conforms to Python Standard library's
:class:`~concurrent.futures.Future` interface (but not an
instance of that class). Call `result()` to get the result
Expand Down

0 comments on commit 5849e04

Please sign in to comment.