Skip to content

Commit 7b81eb4

Browse files
authored
Merge pull request #2584 from tswast/nonetype-to-optional
Remove None & NoneType from parameter types in docstrings.
2 parents 5aa24d6 + 9617e7d commit 7b81eb4

File tree

4 files changed

+45
-40
lines changed

4 files changed

+45
-40
lines changed

packages/google-cloud-pubsub/google/cloud/pubsub/_gax.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -269,14 +269,15 @@ def subscription_create(self, subscription_path, topic_path,
269269
subscribed, in format
270270
``projects/<PROJECT>/topics/<TOPIC_NAME>``.
271271
272-
:type ack_deadline: int, or ``NoneType``
273-
:param ack_deadline: the deadline (in seconds) by which messages pulled
274-
from the back-end must be acknowledged.
272+
:type ack_deadline: int
273+
:param ack_deadline:
274+
(Optional) the deadline (in seconds) by which messages pulled from
275+
the back-end must be acknowledged.
275276
276-
:type push_endpoint: str, or ``NoneType``
277-
:param push_endpoint: URL to which messages will be pushed by the
278-
back-end. If not set, the application must pull
279-
messages.
277+
:type push_endpoint: str
278+
:param push_endpoint:
279+
(Optional) URL to which messages will be pushed by the back-end.
280+
If not set, the application must pull messages.
280281
281282
:rtype: dict
282283
:returns: ``Subscription`` resource returned from the API.
@@ -351,10 +352,10 @@ def subscription_modify_push_config(self, subscription_path,
351352
the fully-qualified path of the new subscription, in format
352353
``projects/<PROJECT>/subscriptions/<SUB_NAME>``.
353354
354-
:type push_endpoint: str, or ``NoneType``
355-
:param push_endpoint: URL to which messages will be pushed by the
356-
back-end. If not set, the application must pull
357-
messages.
355+
:type push_endpoint: str
356+
:param push_endpoint:
357+
(Optional) URL to which messages will be pushed by the back-end.
358+
If not set, the application must pull messages.
358359
"""
359360
push_config = PushConfig(push_endpoint=push_endpoint)
360361
try:

packages/google-cloud-pubsub/google/cloud/pubsub/connection.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -309,14 +309,15 @@ def subscription_create(self, subscription_path, topic_path,
309309
subscribed, in format
310310
``projects/<PROJECT>/topics/<TOPIC_NAME>``.
311311
312-
:type ack_deadline: int, or ``NoneType``
313-
:param ack_deadline: the deadline (in seconds) by which messages pulled
314-
from the back-end must be acknowledged.
312+
:type ack_deadline: int
313+
:param ack_deadline:
314+
(Optional) the deadline (in seconds) by which messages pulled from
315+
the back-end must be acknowledged.
315316
316-
:type push_endpoint: str, or ``NoneType``
317-
:param push_endpoint: URL to which messages will be pushed by the
318-
back-end. If not set, the application must pull
319-
messages.
317+
:type push_endpoint: str
318+
:param push_endpoint:
319+
(Optional) URL to which messages will be pushed by the back-end.
320+
If not set, the application must pull messages.
320321
321322
:rtype: dict
322323
:returns: ``Subscription`` resource returned from the API.
@@ -378,10 +379,10 @@ def subscription_modify_push_config(self, subscription_path,
378379
the fully-qualified path of the new subscription, in format
379380
``projects/<PROJECT>/subscriptions/<SUB_NAME>``.
380381
381-
:type push_endpoint: str, or ``NoneType``
382-
:param push_endpoint: URL to which messages will be pushed by the
383-
back-end. If not set, the application must pull
384-
messages.
382+
:type push_endpoint: str
383+
:param push_endpoint:
384+
(Optional) URL to which messages will be pushed by the back-end.
385+
If not set, the application must pull messages.
385386
"""
386387
conn = self._connection
387388
path = '/%s:modifyPushConfig' % (subscription_path,)

packages/google-cloud-pubsub/google/cloud/pubsub/message.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ class Message(object):
3232
:type message_id: str
3333
:param message_id: An ID assigned to the message by the API.
3434
35-
:type attributes: dict or None
36-
:param attributes: Extra metadata associated by the publisher with the
37-
message.
35+
:type attributes: dict
36+
:param attributes:
37+
(Optional) Extra metadata associated by the publisher with the message.
3838
"""
3939
_service_timestamp = None
4040

@@ -80,8 +80,8 @@ def service_timestamp(self):
8080
def from_api_repr(cls, api_repr):
8181
"""Factory: construct message from API representation.
8282
83-
:type api_repr: dict or None
84-
:param api_repr: The API representation of the message
83+
:type api_repr: dict
84+
:param api_repr: (Optional) The API representation of the message
8585
8686
:rtype: :class:`Message`
8787
:returns: The message created from the response.

packages/google-cloud-pubsub/google/cloud/pubsub/subscription.py

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,22 +29,24 @@ class Subscription(object):
2929
:type name: str
3030
:param name: the name of the subscription.
3131
32-
:type topic: :class:`google.cloud.pubsub.topic.Topic` or ``NoneType``
33-
:param topic: the topic to which the subscription belongs; if ``None``,
34-
the subscription's topic has been deleted.
32+
:type topic: :class:`google.cloud.pubsub.topic.Topic`
33+
:param topic:
34+
(Optional) the topic to which the subscription belongs; if ``None``,
35+
the subscription's topic has been deleted.
3536
3637
:type ack_deadline: int
3738
:param ack_deadline: the deadline (in seconds) by which messages pulled
3839
from the back-end must be acknowledged.
3940
4041
:type push_endpoint: str
41-
:param push_endpoint: URL to which messages will be pushed by the back-end.
42-
If not set, the application must pull messages.
43-
44-
:type client: :class:`~google.cloud.pubsub.client.Client` or
45-
``NoneType``
46-
:param client: the client to use. If not passed, falls back to the
47-
``client`` stored on the topic.
42+
:param push_endpoint:
43+
(Optional) URL to which messages will be pushed by the back-end. If
44+
not set, the application must pull messages.
45+
46+
:type client: :class:`~google.cloud.pubsub.client.Client`
47+
:param client:
48+
(Optional) The client to use. If not passed, falls back to the
49+
``client`` stored on the topic.
4850
"""
4951

5052
_DELETED_TOPIC_PATH = '_deleted-topic_'
@@ -81,9 +83,10 @@ def from_api_repr(cls, resource, client, topics=None):
8183
:param client: Client which holds credentials and project
8284
configuration for a topic.
8385
84-
:type topics: dict or None
85-
:param topics: A mapping of topic names -> topics. If not passed,
86-
the subscription will have a newly-created topic.
86+
:type topics: dict
87+
:param topics:
88+
(Optional) A mapping of topic names -> topics. If not passed, the
89+
subscription will have a newly-created topic.
8790
8891
:rtype: :class:`google.cloud.pubsub.subscription.Subscription`
8992
:returns: Subscription parsed from ``resource``.

0 commit comments

Comments
 (0)