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

Commit

Permalink
fix: Add async context manager return types (#413)
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 57554e7 commit 96510ef
Show file tree
Hide file tree
Showing 18 changed files with 42 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1168,7 +1168,7 @@ async def sample_preview_update_game_server_cluster():
# Done; return the response.
return response

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

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

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

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

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

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

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

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

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

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

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

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

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

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

async def __aenter__(self):
async def __aenter__(self) -> "RealmsServiceAsyncClient":
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-game-servers",
"version": "1.8.2"
"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-game-servers",
"version": "1.8.2"
"version": "0.1.0"
},
"snippets": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1213,9 +1213,11 @@ async def test_list_game_server_clusters_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_game_server_clusters(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 @@ -1209,9 +1209,11 @@ async def test_list_game_server_configs_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_game_server_configs(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 @@ -1214,9 +1214,11 @@ async def test_list_game_server_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_game_server_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
6 changes: 4 additions & 2 deletions tests/unit/gapic/gaming_v1/test_realms_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -1131,9 +1131,11 @@ async def test_list_realms_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_realms(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 @@ -1213,9 +1213,11 @@ async def test_list_game_server_clusters_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_game_server_clusters(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 @@ -1209,9 +1209,11 @@ async def test_list_game_server_configs_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_game_server_configs(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 @@ -1214,9 +1214,11 @@ async def test_list_game_server_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_game_server_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
6 changes: 4 additions & 2 deletions tests/unit/gapic/gaming_v1beta/test_realms_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -1131,9 +1131,11 @@ async def test_list_realms_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_realms(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 96510ef

Please sign in to comment.