Skip to content

Commit

Permalink
fix: Add async context manager return types (#280)
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] authored Jul 4, 2023
1 parent 6a010e7 commit b002edf
Show file tree
Hide file tree
Showing 8 changed files with 61 additions and 63 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1541,7 +1541,7 @@ async def sample_resume_patch_deployment():
# Done; return the response.
return response

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

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

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

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

async def __aenter__(self):
async def __aenter__(self) -> "OsConfigZonalServiceAsyncClient":
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-os-config",
"version": "1.15.1"
"version": "0.1.0"
},
"snippets": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
],
"language": "PYTHON",
"name": "google-cloud-os-config",
"version": "1.15.1"
"version": "0.1.0"
},
"snippets": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1766,9 +1766,11 @@ async def test_list_patch_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_patch_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 @@ -2209,9 +2211,11 @@ async def test_list_patch_job_instance_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.list_patch_job_instance_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 @@ -2243,9 +2247,6 @@ def test_create_patch_deployment(request_type, transport: str = "grpc"):
name="name_value",
description="description_value",
state=patch_deployments.PatchDeployment.State.ACTIVE,
one_time_schedule=patch_deployments.OneTimeSchedule(
execute_time=timestamp_pb2.Timestamp(seconds=751)
),
)
response = client.create_patch_deployment(request)

Expand Down Expand Up @@ -2521,9 +2522,6 @@ def test_get_patch_deployment(request_type, transport: str = "grpc"):
name="name_value",
description="description_value",
state=patch_deployments.PatchDeployment.State.ACTIVE,
one_time_schedule=patch_deployments.OneTimeSchedule(
execute_time=timestamp_pb2.Timestamp(seconds=751)
),
)
response = client.get_patch_deployment(request)

Expand Down Expand Up @@ -3188,9 +3186,11 @@ async def test_list_patch_deployments_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_patch_deployments(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 @@ -3457,9 +3457,6 @@ def test_update_patch_deployment(request_type, transport: str = "grpc"):
name="name_value",
description="description_value",
state=patch_deployments.PatchDeployment.State.ACTIVE,
one_time_schedule=patch_deployments.OneTimeSchedule(
execute_time=timestamp_pb2.Timestamp(seconds=751)
),
)
response = client.update_patch_deployment(request)

Expand Down Expand Up @@ -3725,9 +3722,6 @@ def test_pause_patch_deployment(request_type, transport: str = "grpc"):
name="name_value",
description="description_value",
state=patch_deployments.PatchDeployment.State.ACTIVE,
one_time_schedule=patch_deployments.OneTimeSchedule(
execute_time=timestamp_pb2.Timestamp(seconds=751)
),
)
response = client.pause_patch_deployment(request)

Expand Down Expand Up @@ -3983,9 +3977,6 @@ def test_resume_patch_deployment(request_type, transport: str = "grpc"):
name="name_value",
description="description_value",
state=patch_deployments.PatchDeployment.State.ACTIVE,
one_time_schedule=patch_deployments.OneTimeSchedule(
execute_time=timestamp_pb2.Timestamp(seconds=751)
),
)
response = client.resume_patch_deployment(request)

Expand Down Expand Up @@ -5758,9 +5749,6 @@ def test_create_patch_deployment_rest(request_type):
name="name_value",
description="description_value",
state=patch_deployments.PatchDeployment.State.ACTIVE,
one_time_schedule=patch_deployments.OneTimeSchedule(
execute_time=timestamp_pb2.Timestamp(seconds=751)
),
)

# Wrap the value into a proper Response obj
Expand Down Expand Up @@ -6155,9 +6143,6 @@ def test_get_patch_deployment_rest(request_type):
name="name_value",
description="description_value",
state=patch_deployments.PatchDeployment.State.ACTIVE,
one_time_schedule=patch_deployments.OneTimeSchedule(
execute_time=timestamp_pb2.Timestamp(seconds=751)
),
)

# Wrap the value into a proper Response obj
Expand Down Expand Up @@ -7124,9 +7109,6 @@ def test_update_patch_deployment_rest(request_type):
name="name_value",
description="description_value",
state=patch_deployments.PatchDeployment.State.ACTIVE,
one_time_schedule=patch_deployments.OneTimeSchedule(
execute_time=timestamp_pb2.Timestamp(seconds=751)
),
)

# Wrap the value into a proper Response obj
Expand Down Expand Up @@ -7497,9 +7479,6 @@ def test_pause_patch_deployment_rest(request_type):
name="name_value",
description="description_value",
state=patch_deployments.PatchDeployment.State.ACTIVE,
one_time_schedule=patch_deployments.OneTimeSchedule(
execute_time=timestamp_pb2.Timestamp(seconds=751)
),
)

# Wrap the value into a proper Response obj
Expand Down Expand Up @@ -7772,9 +7751,6 @@ def test_resume_patch_deployment_rest(request_type):
name="name_value",
description="description_value",
state=patch_deployments.PatchDeployment.State.ACTIVE,
one_time_schedule=patch_deployments.OneTimeSchedule(
execute_time=timestamp_pb2.Timestamp(seconds=751)
),
)

# Wrap the value into a proper Response obj
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2021,9 +2021,11 @@ async def test_list_os_policy_assignments_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_os_policy_assignments(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 @@ -2476,9 +2478,11 @@ async def test_list_os_policy_assignment_revisions_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_os_policy_assignment_revisions(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 @@ -3448,9 +3452,11 @@ async def test_list_os_policy_assignment_reports_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_os_policy_assignment_reports(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 @@ -4096,9 +4102,11 @@ async def test_list_inventories_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_inventories(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 @@ -4786,9 +4794,11 @@ async def test_list_vulnerability_reports_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_vulnerability_reports(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
Original file line number Diff line number Diff line change
Expand Up @@ -2023,9 +2023,11 @@ async def test_list_os_policy_assignments_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_os_policy_assignments(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 @@ -2478,9 +2480,11 @@ async def test_list_os_policy_assignment_revisions_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_os_policy_assignment_revisions(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 @@ -3473,9 +3477,11 @@ async def test_list_instance_os_policies_compliances_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_instance_os_policies_compliances(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 @@ -4204,9 +4210,11 @@ async def test_list_os_policy_assignment_reports_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_os_policy_assignment_reports(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 @@ -4852,9 +4860,11 @@ async def test_list_inventories_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_inventories(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 @@ -5542,9 +5552,11 @@ async def test_list_vulnerability_reports_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_vulnerability_reports(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 b002edf

Please sign in to comment.