Skip to content

Commit 6992e13

Browse files
fix: Add async context manager return types (#522)
* 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>
1 parent 0401b06 commit 6992e13

File tree

12 files changed

+37
-23
lines changed

12 files changed

+37
-23
lines changed

packages/google-cloud-speech/google/cloud/speech_v1/services/adaptation/async_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1538,7 +1538,7 @@ async def get_operation(
15381538
# Done; return the response.
15391539
return response
15401540

1541-
async def __aenter__(self):
1541+
async def __aenter__(self) -> "AdaptationAsyncClient":
15421542
return self
15431543

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

packages/google-cloud-speech/google/cloud/speech_v1/services/speech/async_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -746,7 +746,7 @@ async def get_operation(
746746
# Done; return the response.
747747
return response
748748

749-
async def __aenter__(self):
749+
async def __aenter__(self) -> "SpeechAsyncClient":
750750
return self
751751

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

packages/google-cloud-speech/google/cloud/speech_v1p1beta1/services/adaptation/async_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1538,7 +1538,7 @@ async def get_operation(
15381538
# Done; return the response.
15391539
return response
15401540

1541-
async def __aenter__(self):
1541+
async def __aenter__(self) -> "AdaptationAsyncClient":
15421542
return self
15431543

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

packages/google-cloud-speech/google/cloud/speech_v1p1beta1/services/speech/async_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -746,7 +746,7 @@ async def get_operation(
746746
# Done; return the response.
747747
return response
748748

749-
async def __aenter__(self):
749+
async def __aenter__(self) -> "SpeechAsyncClient":
750750
return self
751751

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

packages/google-cloud-speech/google/cloud/speech_v2/services/speech/async_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3511,7 +3511,7 @@ async def list_locations(
35113511
# Done; return the response.
35123512
return response
35133513

3514-
async def __aenter__(self):
3514+
async def __aenter__(self) -> "SpeechAsyncClient":
35153515
return self
35163516

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

packages/google-cloud-speech/google/cloud/speech_v2/services/speech/transports/rest.py

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

3551-
body = json.loads(json.dumps(transcoded_request["body"]))
3551+
body = json.dumps(transcoded_request["body"])
35523552
uri = transcoded_request["uri"]
35533553
method = transcoded_request["method"]
35543554

packages/google-cloud-speech/samples/generated_samples/snippet_metadata_google.cloud.speech.v1.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
],
99
"language": "PYTHON",
1010
"name": "google-cloud-speech",
11-
"version": "2.20.0"
11+
"version": "0.1.0"
1212
},
1313
"snippets": [
1414
{

packages/google-cloud-speech/samples/generated_samples/snippet_metadata_google.cloud.speech.v1p1beta1.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
],
99
"language": "PYTHON",
1010
"name": "google-cloud-speech",
11-
"version": "2.20.0"
11+
"version": "0.1.0"
1212
},
1313
"snippets": [
1414
{

packages/google-cloud-speech/samples/generated_samples/snippet_metadata_google.cloud.speech.v2.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
],
99
"language": "PYTHON",
1010
"name": "google-cloud-speech",
11-
"version": "2.20.0"
11+
"version": "0.1.0"
1212
},
1313
"snippets": [
1414
{

packages/google-cloud-speech/tests/unit/gapic/speech_v1/test_adaptation.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1597,9 +1597,11 @@ async def test_list_phrase_set_async_pages():
15971597
RuntimeError,
15981598
)
15991599
pages = []
1600-
async for page_ in (
1600+
# Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch`
1601+
# See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372
1602+
async for page_ in ( # pragma: no branch
16011603
await client.list_phrase_set(request={})
1602-
).pages: # pragma: no branch
1604+
).pages:
16031605
pages.append(page_)
16041606
for page_, token in zip(pages, ["abc", "def", "ghi", ""]):
16051607
assert page_.raw_page.next_page_token == token
@@ -3040,9 +3042,11 @@ async def test_list_custom_classes_async_pages():
30403042
RuntimeError,
30413043
)
30423044
pages = []
3043-
async for page_ in (
3045+
# Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch`
3046+
# See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372
3047+
async for page_ in ( # pragma: no branch
30443048
await client.list_custom_classes(request={})
3045-
).pages: # pragma: no branch
3049+
).pages:
30463050
pages.append(page_)
30473051
for page_, token in zip(pages, ["abc", "def", "ghi", ""]):
30483052
assert page_.raw_page.next_page_token == token

0 commit comments

Comments
 (0)