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

Commit 355b8b4

Browse files
fix: Add async context manager return types (#184)
* 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 5c7f3af commit 355b8b4

File tree

10 files changed

+27
-17
lines changed

10 files changed

+27
-17
lines changed

‎google/cloud/dataflow_v1beta3/services/flex_templates_service/async_client.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ async def sample_launch_flex_template():
298298
# Done; return the response.
299299
return response
300300

301-
async def __aenter__(self):
301+
async def __aenter__(self) -> "FlexTemplatesServiceAsyncClient":
302302
return self
303303

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

‎google/cloud/dataflow_v1beta3/services/jobs_v1_beta3/async_client.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -853,7 +853,7 @@ async def sample_snapshot_job():
853853
# Done; return the response.
854854
return response
855855

856-
async def __aenter__(self):
856+
async def __aenter__(self) -> "JobsV1Beta3AsyncClient":
857857
return self
858858

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

‎google/cloud/dataflow_v1beta3/services/messages_v1_beta3/async_client.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ async def sample_list_job_messages():
323323
# Done; return the response.
324324
return response
325325

326-
async def __aenter__(self):
326+
async def __aenter__(self) -> "MessagesV1Beta3AsyncClient":
327327
return self
328328

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

‎google/cloud/dataflow_v1beta3/services/metrics_v1_beta3/async_client.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,7 @@ async def sample_get_stage_execution_details():
521521
# Done; return the response.
522522
return response
523523

524-
async def __aenter__(self):
524+
async def __aenter__(self) -> "MetricsV1Beta3AsyncClient":
525525
return self
526526

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

‎google/cloud/dataflow_v1beta3/services/snapshots_v1_beta3/async_client.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ async def sample_list_snapshots():
463463
# Done; return the response.
464464
return response
465465

466-
async def __aenter__(self):
466+
async def __aenter__(self) -> "SnapshotsV1Beta3AsyncClient":
467467
return self
468468

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

‎google/cloud/dataflow_v1beta3/services/templates_service/async_client.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ async def sample_get_template():
470470
# Done; return the response.
471471
return response
472472

473-
async def __aenter__(self):
473+
async def __aenter__(self) -> "TemplatesServiceAsyncClient":
474474
return self
475475

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

‎samples/generated_samples/snippet_metadata_google.dataflow.v1beta3.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
],
99
"language": "PYTHON",
1010
"name": "google-cloud-dataflow-client",
11-
"version": "0.8.3"
11+
"version": "0.1.0"
1212
},
1313
"snippets": [
1414
{

‎tests/unit/gapic/dataflow_v1beta3/test_jobs_v1_beta3.py

+8-4
Original file line numberDiff line numberDiff line change
@@ -1635,9 +1635,11 @@ async def test_list_jobs_async_pages():
16351635
RuntimeError,
16361636
)
16371637
pages = []
1638-
async for page_ in (
1638+
# Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch`
1639+
# See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372
1640+
async for page_ in ( # pragma: no branch
16391641
await client.list_jobs(request={})
1640-
).pages: # pragma: no branch
1642+
).pages:
16411643
pages.append(page_)
16421644
for page_, token in zip(pages, ["abc", "def", "ghi", ""]):
16431645
assert page_.raw_page.next_page_token == token
@@ -1991,9 +1993,11 @@ async def test_aggregated_list_jobs_async_pages():
19911993
RuntimeError,
19921994
)
19931995
pages = []
1994-
async for page_ in (
1996+
# Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch`
1997+
# See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372
1998+
async for page_ in ( # pragma: no branch
19951999
await client.aggregated_list_jobs(request={})
1996-
).pages: # pragma: no branch
2000+
).pages:
19972001
pages.append(page_)
19982002
for page_, token in zip(pages, ["abc", "def", "ghi", ""]):
19992003
assert page_.raw_page.next_page_token == token

‎tests/unit/gapic/dataflow_v1beta3/test_messages_v1_beta3.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -1090,9 +1090,11 @@ async def test_list_job_messages_async_pages():
10901090
RuntimeError,
10911091
)
10921092
pages = []
1093-
async for page_ in (
1093+
# Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch`
1094+
# See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372
1095+
async for page_ in ( # pragma: no branch
10941096
await client.list_job_messages(request={})
1095-
).pages: # pragma: no branch
1097+
).pages:
10961098
pages.append(page_)
10971099
for page_, token in zip(pages, ["abc", "def", "ghi", ""]):
10981100
assert page_.raw_page.next_page_token == token

‎tests/unit/gapic/dataflow_v1beta3/test_metrics_v1_beta3.py

+8-4
Original file line numberDiff line numberDiff line change
@@ -1214,9 +1214,11 @@ async def test_get_job_execution_details_async_pages():
12141214
RuntimeError,
12151215
)
12161216
pages = []
1217-
async for page_ in (
1217+
# Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch`
1218+
# See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372
1219+
async for page_ in ( # pragma: no branch
12181220
await client.get_job_execution_details(request={})
1219-
).pages: # pragma: no branch
1221+
).pages:
12201222
pages.append(page_)
12211223
for page_, token in zip(pages, ["abc", "def", "ghi", ""]):
12221224
assert page_.raw_page.next_page_token == token
@@ -1584,9 +1586,11 @@ async def test_get_stage_execution_details_async_pages():
15841586
RuntimeError,
15851587
)
15861588
pages = []
1587-
async for page_ in (
1589+
# Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch`
1590+
# See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372
1591+
async for page_ in ( # pragma: no branch
15881592
await client.get_stage_execution_details(request={})
1589-
).pages: # pragma: no branch
1593+
).pages:
15901594
pages.append(page_)
15911595
for page_, token in zip(pages, ["abc", "def", "ghi", ""]):
15921596
assert page_.raw_page.next_page_token == token

0 commit comments

Comments
 (0)