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

Commit

Permalink
fix: Add async context manager return types (#284)
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 286b393 commit 6005f6f
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 10 deletions.
Expand Up @@ -841,7 +841,7 @@ async def sample_sign_jwt():
# Done; return the response.
return response

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

async def __aexit__(self, exc_type, exc, tb):
Expand Down
2 changes: 1 addition & 1 deletion google/cloud/iam_v2/services/policies/async_client.py
Expand Up @@ -930,7 +930,7 @@ async def get_operation(
# Done; return the response.
return response

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

async def __aexit__(self, exc_type, exc, tb):
Expand Down
2 changes: 1 addition & 1 deletion google/cloud/iam_v2beta/services/policies/async_client.py
Expand Up @@ -930,7 +930,7 @@ async def get_operation(
# Done; return the response.
return response

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

async def __aexit__(self, exc_type, exc, tb):
Expand Down
Expand Up @@ -8,7 +8,7 @@
],
"language": "PYTHON",
"name": "google-cloud-iam",
"version": "2.12.0"
"version": "0.1.0"
},
"snippets": [
{
Expand Down
Expand Up @@ -8,7 +8,7 @@
],
"language": "PYTHON",
"name": "google-cloud-iam",
"version": "2.12.0"
"version": "0.1.0"
},
"snippets": [
{
Expand Down
Expand Up @@ -8,7 +8,7 @@
],
"language": "PYTHON",
"name": "google-cloud-iam",
"version": "2.12.0"
"version": "0.1.0"
},
"snippets": [
{
Expand Down
6 changes: 4 additions & 2 deletions tests/unit/gapic/iam_v2/test_policies.py
Expand Up @@ -1093,9 +1093,11 @@ async def test_list_policies_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_policies(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/iam_v2beta/test_policies.py
Expand Up @@ -1071,9 +1071,11 @@ async def test_list_policies_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_policies(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 6005f6f

Please sign in to comment.