Skip to content
This repository has been archived by the owner on Oct 31, 2023. It is now read-only.

Commit

Permalink
fix: Add async context manager return types (#184)
Browse files Browse the repository at this point in the history
* fix: Add async context manager return types

chore: Mock return_value should not populate oneof message fields

chore: Support snippet generation for services that only support REST transport

chore: Update gapic-generator-python to v1.11.0
PiperOrigin-RevId: 545430278

Source-Link: googleapis/googleapis@601b532

Source-Link: googleapis/googleapis-gen@b3f18d0
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYjNmMThkMGY2NTYwYTg1NTAyMmZkMDU4ODY1ZTc2MjA0NzlkN2FmOSJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
  • Loading branch information
gcf-owl-bot[bot] and gcf-owl-bot[bot] committed Jul 4, 2023
1 parent 5c7f3af commit 355b8b4
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ async def sample_launch_flex_template():
# Done; return the response.
return response

async def __aenter__(self):
async def __aenter__(self) -> "FlexTemplatesServiceAsyncClient":
return self

async def __aexit__(self, exc_type, exc, tb):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -853,7 +853,7 @@ async def sample_snapshot_job():
# Done; return the response.
return response

async def __aenter__(self):
async def __aenter__(self) -> "JobsV1Beta3AsyncClient":
return self

async def __aexit__(self, exc_type, exc, tb):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ async def sample_list_job_messages():
# Done; return the response.
return response

async def __aenter__(self):
async def __aenter__(self) -> "MessagesV1Beta3AsyncClient":
return self

async def __aexit__(self, exc_type, exc, tb):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ async def sample_get_stage_execution_details():
# Done; return the response.
return response

async def __aenter__(self):
async def __aenter__(self) -> "MetricsV1Beta3AsyncClient":
return self

async def __aexit__(self, exc_type, exc, tb):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ async def sample_list_snapshots():
# Done; return the response.
return response

async def __aenter__(self):
async def __aenter__(self) -> "SnapshotsV1Beta3AsyncClient":
return self

async def __aexit__(self, exc_type, exc, tb):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ async def sample_get_template():
# Done; return the response.
return response

async def __aenter__(self):
async def __aenter__(self) -> "TemplatesServiceAsyncClient":
return self

async def __aexit__(self, exc_type, exc, tb):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
],
"language": "PYTHON",
"name": "google-cloud-dataflow-client",
"version": "0.8.3"
"version": "0.1.0"
},
"snippets": [
{
Expand Down
12 changes: 8 additions & 4 deletions tests/unit/gapic/dataflow_v1beta3/test_jobs_v1_beta3.py
Original file line number Diff line number Diff line change
Expand Up @@ -1635,9 +1635,11 @@ async def test_list_jobs_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_jobs(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
Expand Down Expand Up @@ -1991,9 +1993,11 @@ async def test_aggregated_list_jobs_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.aggregated_list_jobs(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
Expand Down
6 changes: 4 additions & 2 deletions tests/unit/gapic/dataflow_v1beta3/test_messages_v1_beta3.py
Original file line number Diff line number Diff line change
Expand Up @@ -1090,9 +1090,11 @@ async def test_list_job_messages_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_job_messages(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
Expand Down
12 changes: 8 additions & 4 deletions tests/unit/gapic/dataflow_v1beta3/test_metrics_v1_beta3.py
Original file line number Diff line number Diff line change
Expand Up @@ -1214,9 +1214,11 @@ async def test_get_job_execution_details_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.get_job_execution_details(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
Expand Down Expand Up @@ -1584,9 +1586,11 @@ async def test_get_stage_execution_details_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.get_stage_execution_details(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
Expand Down

0 comments on commit 355b8b4

Please sign in to comment.