Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Sep 5, 2023. It is now read-only.

Commit 57f49cc

Browse files
fix: Add async context manager return types (#122)
* 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: https://github.com/googleapis/googleapis-gen/commit/b3f18d0f6560a855022fd058865e7620479d7af9 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>
1 parent fa1e00b commit 57f49cc

File tree

6 files changed

+20
-12
lines changed

6 files changed

+20
-12
lines changed

google/cloud/batch_v1/services/batch_service/async_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1252,7 +1252,7 @@ async def list_locations(
12521252
# Done; return the response.
12531253
return response
12541254

1255-
async def __aenter__(self):
1255+
async def __aenter__(self) -> "BatchServiceAsyncClient":
12561256
return self
12571257

12581258
async def __aexit__(self, exc_type, exc, tb):

google/cloud/batch_v1/services/batch_service/transports/rest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1253,7 +1253,7 @@ def __call__(
12531253
request_kwargs = json_format.MessageToDict(request)
12541254
transcoded_request = path_template.transcode(http_options, **request_kwargs)
12551255

1256-
body = json.loads(json.dumps(transcoded_request["body"]))
1256+
body = json.dumps(transcoded_request["body"])
12571257
uri = transcoded_request["uri"]
12581258
method = transcoded_request["method"]
12591259

google/cloud/batch_v1alpha/services/batch_service/async_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1252,7 +1252,7 @@ async def list_locations(
12521252
# Done; return the response.
12531253
return response
12541254

1255-
async def __aenter__(self):
1255+
async def __aenter__(self) -> "BatchServiceAsyncClient":
12561256
return self
12571257

12581258
async def __aexit__(self, exc_type, exc, tb):

google/cloud/batch_v1alpha/services/batch_service/transports/rest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1253,7 +1253,7 @@ def __call__(
12531253
request_kwargs = json_format.MessageToDict(request)
12541254
transcoded_request = path_template.transcode(http_options, **request_kwargs)
12551255

1256-
body = json.loads(json.dumps(transcoded_request["body"]))
1256+
body = json.dumps(transcoded_request["body"])
12571257
uri = transcoded_request["uri"]
12581258
method = transcoded_request["method"]
12591259

tests/unit/gapic/batch_v1/test_batch_service.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1840,9 +1840,11 @@ async def test_list_jobs_async_pages():
18401840
RuntimeError,
18411841
)
18421842
pages = []
1843-
async for page_ in (
1843+
# Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch`
1844+
# See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372
1845+
async for page_ in ( # pragma: no branch
18441846
await client.list_jobs(request={})
1845-
).pages: # pragma: no branch
1847+
).pages:
18461848
pages.append(page_)
18471849
for page_, token in zip(pages, ["abc", "def", "ghi", ""]):
18481850
assert page_.raw_page.next_page_token == token
@@ -2492,9 +2494,11 @@ async def test_list_tasks_async_pages():
24922494
RuntimeError,
24932495
)
24942496
pages = []
2495-
async for page_ in (
2497+
# Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch`
2498+
# See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372
2499+
async for page_ in ( # pragma: no branch
24962500
await client.list_tasks(request={})
2497-
).pages: # pragma: no branch
2501+
).pages:
24982502
pages.append(page_)
24992503
for page_, token in zip(pages, ["abc", "def", "ghi", ""]):
25002504
assert page_.raw_page.next_page_token == token

tests/unit/gapic/batch_v1alpha/test_batch_service.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1852,9 +1852,11 @@ async def test_list_jobs_async_pages():
18521852
RuntimeError,
18531853
)
18541854
pages = []
1855-
async for page_ in (
1855+
# Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch`
1856+
# See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372
1857+
async for page_ in ( # pragma: no branch
18561858
await client.list_jobs(request={})
1857-
).pages: # pragma: no branch
1859+
).pages:
18581860
pages.append(page_)
18591861
for page_, token in zip(pages, ["abc", "def", "ghi", ""]):
18601862
assert page_.raw_page.next_page_token == token
@@ -2504,9 +2506,11 @@ async def test_list_tasks_async_pages():
25042506
RuntimeError,
25052507
)
25062508
pages = []
2507-
async for page_ in (
2509+
# Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch`
2510+
# See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372
2511+
async for page_ in ( # pragma: no branch
25082512
await client.list_tasks(request={})
2509-
).pages: # pragma: no branch
2513+
).pages:
25102514
pages.append(page_)
25112515
for page_, token in zip(pages, ["abc", "def", "ghi", ""]):
25122516
assert page_.raw_page.next_page_token == token

0 commit comments

Comments
 (0)