diff --git a/google/cloud/pubsublite_v1/services/admin_service/async_client.py b/google/cloud/pubsublite_v1/services/admin_service/async_client.py index a274aa1a..6c19a6fc 100644 --- a/google/cloud/pubsublite_v1/services/admin_service/async_client.py +++ b/google/cloud/pubsublite_v1/services/admin_service/async_client.py @@ -2510,7 +2510,7 @@ async def cancel_operation( metadata=metadata, ) - async def __aenter__(self): + async def __aenter__(self) -> "AdminServiceAsyncClient": return self async def __aexit__(self, exc_type, exc, tb): diff --git a/google/cloud/pubsublite_v1/services/cursor_service/async_client.py b/google/cloud/pubsublite_v1/services/cursor_service/async_client.py index c820cbfa..378a3889 100644 --- a/google/cloud/pubsublite_v1/services/cursor_service/async_client.py +++ b/google/cloud/pubsublite_v1/services/cursor_service/async_client.py @@ -740,7 +740,7 @@ async def cancel_operation( metadata=metadata, ) - async def __aenter__(self): + async def __aenter__(self) -> "CursorServiceAsyncClient": return self async def __aexit__(self, exc_type, exc, tb): diff --git a/google/cloud/pubsublite_v1/services/partition_assignment_service/async_client.py b/google/cloud/pubsublite_v1/services/partition_assignment_service/async_client.py index 52882e2b..7836eb4a 100644 --- a/google/cloud/pubsublite_v1/services/partition_assignment_service/async_client.py +++ b/google/cloud/pubsublite_v1/services/partition_assignment_service/async_client.py @@ -533,7 +533,7 @@ async def cancel_operation( metadata=metadata, ) - async def __aenter__(self): + async def __aenter__(self) -> "PartitionAssignmentServiceAsyncClient": return self async def __aexit__(self, exc_type, exc, tb): diff --git a/google/cloud/pubsublite_v1/services/publisher_service/async_client.py b/google/cloud/pubsublite_v1/services/publisher_service/async_client.py index c349200c..4ce1255d 100644 --- a/google/cloud/pubsublite_v1/services/publisher_service/async_client.py +++ b/google/cloud/pubsublite_v1/services/publisher_service/async_client.py @@ -524,7 +524,7 @@ async def cancel_operation( metadata=metadata, ) - async def __aenter__(self): + async def __aenter__(self) -> "PublisherServiceAsyncClient": return self async def __aexit__(self, exc_type, exc, tb): diff --git a/google/cloud/pubsublite_v1/services/subscriber_service/async_client.py b/google/cloud/pubsublite_v1/services/subscriber_service/async_client.py index 6d83859e..e6b66202 100644 --- a/google/cloud/pubsublite_v1/services/subscriber_service/async_client.py +++ b/google/cloud/pubsublite_v1/services/subscriber_service/async_client.py @@ -514,7 +514,7 @@ async def cancel_operation( metadata=metadata, ) - async def __aenter__(self): + async def __aenter__(self) -> "SubscriberServiceAsyncClient": return self async def __aexit__(self, exc_type, exc, tb): diff --git a/google/cloud/pubsublite_v1/services/topic_stats_service/async_client.py b/google/cloud/pubsublite_v1/services/topic_stats_service/async_client.py index 7069c342..b85658dd 100644 --- a/google/cloud/pubsublite_v1/services/topic_stats_service/async_client.py +++ b/google/cloud/pubsublite_v1/services/topic_stats_service/async_client.py @@ -688,7 +688,7 @@ async def cancel_operation( metadata=metadata, ) - async def __aenter__(self): + async def __aenter__(self) -> "TopicStatsServiceAsyncClient": return self async def __aexit__(self, exc_type, exc, tb): diff --git a/samples/generated_samples/snippet_metadata_google.cloud.pubsublite.v1.json b/samples/generated_samples/snippet_metadata_google.cloud.pubsublite.v1.json index 7f020b96..b2b99995 100644 --- a/samples/generated_samples/snippet_metadata_google.cloud.pubsublite.v1.json +++ b/samples/generated_samples/snippet_metadata_google.cloud.pubsublite.v1.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-pubsublite", - "version": "1.8.2" + "version": "0.1.0" }, "snippets": [ { diff --git a/tests/unit/gapic/pubsublite_v1/test_admin_service.py b/tests/unit/gapic/pubsublite_v1/test_admin_service.py index 1bfcce83..d62793b7 100644 --- a/tests/unit/gapic/pubsublite_v1/test_admin_service.py +++ b/tests/unit/gapic/pubsublite_v1/test_admin_service.py @@ -1810,9 +1810,11 @@ async def test_list_topics_async_pages(): RuntimeError, ) pages = [] - async for page_ in ( + # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` + # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 + async for page_ in ( # pragma: no branch await client.list_topics(request={}) - ).pages: # pragma: no branch + ).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -2714,9 +2716,11 @@ async def test_list_topic_subscriptions_async_pages(): RuntimeError, ) pages = [] - async for page_ in ( + # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` + # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 + async for page_ in ( # pragma: no branch await client.list_topic_subscriptions(request={}) - ).pages: # pragma: no branch + ).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -3654,9 +3658,11 @@ async def test_list_subscriptions_async_pages(): RuntimeError, ) pages = [] - async for page_ in ( + # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` + # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 + async for page_ in ( # pragma: no branch await client.list_subscriptions(request={}) - ).pages: # pragma: no branch + ).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -5238,9 +5244,11 @@ async def test_list_reservations_async_pages(): RuntimeError, ) pages = [] - async for page_ in ( + # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` + # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 + async for page_ in ( # pragma: no branch await client.list_reservations(request={}) - ).pages: # pragma: no branch + ).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -6174,9 +6182,11 @@ async def test_list_reservation_topics_async_pages(): RuntimeError, ) pages = [] - async for page_ in ( + # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` + # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 + async for page_ in ( # pragma: no branch await client.list_reservation_topics(request={}) - ).pages: # pragma: no branch + ).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token diff --git a/tests/unit/gapic/pubsublite_v1/test_cursor_service.py b/tests/unit/gapic/pubsublite_v1/test_cursor_service.py index 3ae20f03..dba18489 100644 --- a/tests/unit/gapic/pubsublite_v1/test_cursor_service.py +++ b/tests/unit/gapic/pubsublite_v1/test_cursor_service.py @@ -1336,9 +1336,11 @@ async def test_list_partition_cursors_async_pages(): RuntimeError, ) pages = [] - async for page_ in ( + # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` + # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 + async for page_ in ( # pragma: no branch await client.list_partition_cursors(request={}) - ).pages: # pragma: no branch + ).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token