Skip to content

Commit 9e9d068

Browse files
chore: remove string replacement in owlbot.py (#469)
PiperOrigin-RevId: 389879008 Source-Link: googleapis/googleapis@7b6a2ce Source-Link: googleapis/googleapis-gen@3443eec
1 parent af8c126 commit 9e9d068

File tree

9 files changed

+18
-99
lines changed

9 files changed

+18
-99
lines changed

google/pubsub_v1/services/publisher/async_client.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929

3030
from google.iam.v1 import iam_policy_pb2 # type: ignore
3131
from google.iam.v1 import policy_pb2 # type: ignore
32+
from google.protobuf import duration_pb2 # type: ignore
3233
from google.pubsub_v1.services.publisher import pagers
3334
from google.pubsub_v1.types import pubsub
3435
from google.pubsub_v1.types import TimeoutType

google/pubsub_v1/services/publisher/client.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434

3535
from google.iam.v1 import iam_policy_pb2 # type: ignore
3636
from google.iam.v1 import policy_pb2 # type: ignore
37+
from google.protobuf import duration_pb2 # type: ignore
3738
from google.pubsub_v1.services.publisher import pagers
3839
from google.pubsub_v1.types import pubsub
3940
from google.pubsub_v1.types import TimeoutType

google/pubsub_v1/services/schema_service/async_client.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,8 @@ async def validate_schema(
509509
Returns:
510510
google.pubsub_v1.types.ValidateSchemaResponse:
511511
Response for the ValidateSchema method.
512+
Empty for now.
513+
512514
"""
513515
# Create or coerce a protobuf request object.
514516
# Sanity check: If we got a request object, we should *not* have
@@ -572,6 +574,8 @@ async def validate_message(
572574
Returns:
573575
google.pubsub_v1.types.ValidateMessageResponse:
574576
Response for the ValidateMessage method.
577+
Empty for now.
578+
575579
"""
576580
# Create or coerce a protobuf request object.
577581
request = schema.ValidateMessageRequest(request)

google/pubsub_v1/services/schema_service/client.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -693,6 +693,8 @@ def validate_schema(
693693
Returns:
694694
google.pubsub_v1.types.ValidateSchemaResponse:
695695
Response for the ValidateSchema method.
696+
Empty for now.
697+
696698
"""
697699
# Create or coerce a protobuf request object.
698700
# Sanity check: If we got a request object, we should *not* have
@@ -756,6 +758,8 @@ def validate_message(
756758
Returns:
757759
google.pubsub_v1.types.ValidateMessageResponse:
758760
Response for the ValidateMessage method.
761+
Empty for now.
762+
759763
"""
760764
# Create or coerce a protobuf request object.
761765
# Minor optimization to avoid making a copy if the user passes

google/pubsub_v1/types/pubsub.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -494,8 +494,9 @@ class Subscription(proto.Message):
494494
then messages are not expunged from the subscription's
495495
backlog, even if they are acknowledged, until they fall out
496496
of the ``message_retention_duration`` window. This must be
497-
true if you would like to [Seek to a timestamp]
498-
(https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time).
497+
true if you would like to [``Seek`` to a timestamp]
498+
(https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time)
499+
in the past to replay previously-acknowledged messages.
499500
message_retention_duration (google.protobuf.duration_pb2.Duration):
500501
How long to retain unacknowledged messages in the
501502
subscription's backlog, from the moment a message is

google/pubsub_v1/types/schema.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ class ValidateSchemaRequest(proto.Message):
195195

196196

197197
class ValidateSchemaResponse(proto.Message):
198-
r"""Response for the ``ValidateSchema`` method. """
198+
r"""Response for the ``ValidateSchema`` method. Empty for now. """
199199

200200

201201
class ValidateMessageRequest(proto.Message):
@@ -227,7 +227,7 @@ class ValidateMessageRequest(proto.Message):
227227

228228

229229
class ValidateMessageResponse(proto.Message):
230-
r"""Response for the ``ValidateMessage`` method. """
230+
r"""Response for the ``ValidateMessage`` method. Empty for now. """
231231

232232

233233
__all__ = tuple(sorted(__protobuf__.manifest))

owlbot.py

Lines changed: 0 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -299,99 +299,6 @@
299299
),
300300
)
301301

302-
# Add development feature `message_retention_duration` from pubsub_dev branch of googleapis
303-
# See PR https://github.com/googleapis/python-pubsub/pull/456
304-
count = s.replace(
305-
library / f"google/pubsub_{library.name}/types/pubsub.py",
306-
"""satisfies_pzs \(bool\):
307-
Reserved for future use. This field is set
308-
only in responses from the server; it is ignored
309-
if it is set in any requests.""",
310-
"""satisfies_pzs (bool):
311-
Reserved for future use. This field is set
312-
only in responses from the server; it is ignored
313-
if it is set in any requests.
314-
message_retention_duration (google.protobuf.duration_pb2.Duration):
315-
Indicates the minimum duration to retain a message after it
316-
is published to the topic. If this field is set, messages
317-
published to the topic in the last
318-
``message_retention_duration`` are always available to
319-
subscribers. For instance, it allows any attached
320-
subscription to `seek to a
321-
timestamp <https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time>`__
322-
that is up to ``message_retention_duration`` in the past. If
323-
this field is not set, message retention is controlled by
324-
settings on individual subscriptions. Cannot be more than 7
325-
days or less than 10 minutes."""
326-
)
327-
328-
# Add development feature `message_retention_duration` from pubsub_dev branch of googleapis
329-
# See PR https://github.com/googleapis/python-pubsub/pull/456
330-
count += s.replace(
331-
library / f"google/pubsub_{library.name}/types/pubsub.py",
332-
"""satisfies_pzs = proto.Field\(
333-
proto.BOOL,
334-
number=7,
335-
\)""",
336-
"""satisfies_pzs = proto.Field(
337-
proto.BOOL,
338-
number=7,
339-
)
340-
message_retention_duration = proto.Field(
341-
proto.MESSAGE, number=8, message=duration_pb2.Duration,
342-
)"""
343-
)
344-
345-
# Add development feature `topic_message_retention_duration` from pubsub_dev branch of googleapis
346-
# See PR https://github.com/googleapis/python-pubsub/pull/456
347-
count += s.replace(
348-
library / f"google/pubsub_{library.name}/types/pubsub.py",
349-
"""detached \(bool\):
350-
Indicates whether the subscription is detached from its
351-
topic. Detached subscriptions don't receive messages from
352-
their topic and don't retain any backlog. ``Pull`` and
353-
``StreamingPull`` requests will return FAILED_PRECONDITION.
354-
If the subscription is a push subscription, pushes to the
355-
endpoint will not be made.""",
356-
"""detached (bool):
357-
Indicates whether the subscription is detached from its
358-
topic. Detached subscriptions don't receive messages from
359-
their topic and don't retain any backlog. ``Pull`` and
360-
``StreamingPull`` requests will return FAILED_PRECONDITION.
361-
If the subscription is a push subscription, pushes to the
362-
endpoint will not be made.
363-
topic_message_retention_duration (google.protobuf.duration_pb2.Duration):
364-
Output only. Indicates the minimum duration for which a
365-
message is retained after it is published to the
366-
subscription's topic. If this field is set, messages
367-
published to the subscription's topic in the last
368-
``topic_message_retention_duration`` are always available to
369-
subscribers. See the ``message_retention_duration`` field in
370-
``Topic``. This field is set only in responses from the
371-
server; it is ignored if it is set in any requests."""
372-
)
373-
374-
# Add development feature `topic_message_retention_duration` from pubsub_dev branch of googleapis
375-
# See PR https://github.com/googleapis/python-pubsub/pull/456
376-
count += s.replace(
377-
library / f"google/pubsub_{library.name}/types/pubsub.py",
378-
"""detached = proto.Field\(
379-
proto.BOOL,
380-
number=15,
381-
\)""",
382-
"""detached = proto.Field(
383-
proto.BOOL,
384-
number=15,
385-
)
386-
topic_message_retention_duration = proto.Field(
387-
proto.MESSAGE, number=17, message=duration_pb2.Duration,
388-
)
389-
"""
390-
)
391-
392-
if count != 4:
393-
raise Exception("Pub/Sub topic retention feature not added")
394-
395302
# The namespace package declaration in google/cloud/__init__.py should be excluded
396303
# from coverage.
397304
count = s.replace(

scripts/fixup_pubsub_v1_keywords.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ class pubsubCallTransformer(cst.CSTTransformer):
4242
'acknowledge': ('subscription', 'ack_ids', ),
4343
'create_schema': ('parent', 'schema', 'schema_id', ),
4444
'create_snapshot': ('name', 'subscription', 'labels', ),
45-
'create_subscription': ('name', 'topic', 'push_config', 'ack_deadline_seconds', 'retain_acked_messages', 'message_retention_duration', 'labels', 'enable_message_ordering', 'expiration_policy', 'filter', 'dead_letter_policy', 'retry_policy', 'detached', ),
46-
'create_topic': ('name', 'labels', 'message_storage_policy', 'kms_key_name', 'schema_settings', 'satisfies_pzs', ),
45+
'create_subscription': ('name', 'topic', 'push_config', 'ack_deadline_seconds', 'retain_acked_messages', 'message_retention_duration', 'labels', 'enable_message_ordering', 'expiration_policy', 'filter', 'dead_letter_policy', 'retry_policy', 'detached', 'topic_message_retention_duration', ),
46+
'create_topic': ('name', 'labels', 'message_storage_policy', 'kms_key_name', 'schema_settings', 'satisfies_pzs', 'message_retention_duration', ),
4747
'delete_schema': ('name', ),
4848
'delete_snapshot': ('snapshot', ),
4949
'delete_subscription': ('subscription', ),

tests/unit/gapic/pubsub_v1/test_publisher.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
from google.iam.v1 import options_pb2 # type: ignore
3636
from google.iam.v1 import policy_pb2 # type: ignore
3737
from google.oauth2 import service_account
38+
from google.protobuf import duration_pb2 # type: ignore
3839
from google.protobuf import field_mask_pb2 # type: ignore
3940
from google.protobuf import timestamp_pb2 # type: ignore
4041
from google.pubsub_v1.services.publisher import PublisherAsyncClient

0 commit comments

Comments
 (0)