Skip to content

Commit f13bb7d

Browse files
feat: Added new fields to facilitate debugging (#465)
* chore: update to gapic-generator-python 1.5.0 feat: add support for `google.cloud.<api>.__version__` PiperOrigin-RevId: 484665853 Source-Link: googleapis/googleapis@8eb249a Source-Link: https://github.com/googleapis/googleapis-gen/commit/c8aa327b5f478865fc3fd91e3c2768e54e26ad44 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYzhhYTMyN2I1ZjQ3ODg2NWZjM2ZkOTFlM2MyNzY4ZTU0ZTI2YWQ0NCJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * update version in gapic_version.py * chore: Update to gapic-generator-python 1.6.0 feat(python): Add typing to proto.Message based class attributes feat(python): Snippetgen handling of repeated enum field PiperOrigin-RevId: 487326846 Source-Link: googleapis/googleapis@da380c7 Source-Link: https://github.com/googleapis/googleapis-gen/commit/61ef5762ee6731a0cbbfea22fd0eecee51ab1c8e Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNjFlZjU3NjJlZTY3MzFhMGNiYmZlYTIyZmQwZWVjZWU1MWFiMWM4ZSJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * feat: new APIs added to reflect updates to the filestore service - Add ENTERPRISE Tier - Add snapshot APIs: RevertInstance, ListSnapshots, CreateSnapshot, DeleteSnapshot, UpdateSnapshot - Add multi-share APIs: ListShares, GetShare, CreateShare, DeleteShare, UpdateShare - Add ConnectMode to NetworkConfig (for Private Service Access support) - New status codes (SUSPENDED/SUSPENDING, REVERTING/RESUMING) - Add SuspensionReason (for KMS related suspension) - Add new fields to Instance information: max_capacity_gb, capacity_step_size_gb, max_share_count, capacity_gb, multi_share_enabled PiperOrigin-RevId: 487492758 Source-Link: googleapis/googleapis@5be5981 Source-Link: https://github.com/googleapis/googleapis-gen/commit/ab0e217f560cc2c1afc11441c2eab6b6950efd2b Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYWIwZTIxN2Y1NjBjYzJjMWFmYzExNDQxYzJlYWI2YjY5NTBlZmQyYiJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * chore: Update gapic-generator-python to v1.6.1 PiperOrigin-RevId: 488036204 Source-Link: googleapis/googleapis@08f275f Source-Link: https://github.com/googleapis/googleapis-gen/commit/555c0945e60649e38739ae64bc45719cdf72178f Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNTU1YzA5NDVlNjA2NDllMzg3MzlhZTY0YmM0NTcxOWNkZjcyMTc4ZiJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * feat: Added new fields to facilitate debugging * Added new field to Speech response proto, to give more information to indicate whether, or not, Biasing was applied (eg. did Biasing application timed out). * Added request_id to Speech response protos. PiperOrigin-RevId: 492276727 Source-Link: googleapis/googleapis@4c25335 Source-Link: https://github.com/googleapis/googleapis-gen/commit/f15b9aca7ac2bd40b20e6715188732d08fc7fe21 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZjE1YjlhY2E3YWMyYmQ0MGIyMGU2NzE1MTg4NzMyZDA4ZmM3ZmUyMSJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * chore: use templated setup.py and owlbot.py * fix(deps): Require google-api-core >=1.34.0, >=2.11.0 fix: Drop usage of pkg_resources fix: Fix timeout default values docs(samples): Snippetgen should call await on the operation coroutine before calling result PiperOrigin-RevId: 493260409 Source-Link: googleapis/googleapis@fea4387 Source-Link: https://github.com/googleapis/googleapis-gen/commit/387b7344c7529ee44be84e613b19a820508c612b Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMzg3YjczNDRjNzUyOWVlNDRiZTg0ZTYxM2IxOWE4MjA1MDhjNjEyYiJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * feat: Added new fields to facilitate debugging * Added new field to Speech response proto, to give more information to indicate whether, or not, Biasing was applied (eg. did Biasing application timed out). * Added request_id to Speech response protos. PiperOrigin-RevId: 493311906 Source-Link: googleapis/googleapis@c9b244b Source-Link: https://github.com/googleapis/googleapis-gen/commit/d63ac840dec854ee7acab7b52b15deaf819eae07 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZDYzYWM4NDBkZWM4NTRlZTdhY2FiN2I1MmIxNWRlYWY4MTllYWUwNyJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * add gapic_version.py * fix build Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Anthonios Partheniou <[email protected]>
1 parent cee4ca2 commit f13bb7d

File tree

43 files changed

+119
-75
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+119
-75
lines changed

speech/generated_samples/snippet_metadata_speech_v1.json renamed to speech/generated_samples/snippet_metadata_google.cloud.speech.v1.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
}
88
],
99
"language": "PYTHON",
10-
"name": "google-cloud-speech"
10+
"name": "google-cloud-speech",
11+
"version": "0.1.0"
1112
},
1213
"snippets": [
1314
{

speech/generated_samples/snippet_metadata_speech_v1p1beta1.json renamed to speech/generated_samples/snippet_metadata_google.cloud.speech.v1p1beta1.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
}
88
],
99
"language": "PYTHON",
10-
"name": "google-cloud-speech"
10+
"name": "google-cloud-speech",
11+
"version": "0.1.0"
1112
},
1213
"snippets": [
1314
{

speech/generated_samples/snippet_metadata_speech_v2.json renamed to speech/generated_samples/snippet_metadata_google.cloud.speech.v2.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
}
88
],
99
"language": "PYTHON",
10-
"name": "google-cloud-speech"
10+
"name": "google-cloud-speech",
11+
"version": "0.1.0"
1112
},
1213
"snippets": [
1314
{
@@ -46,7 +47,7 @@
4647
},
4748
{
4849
"name": "files",
49-
"type": "Sequence[google.cloud.speech_v2.types.BatchRecognizeFileMetadata]"
50+
"type": "MutableSequence[google.cloud.speech_v2.types.BatchRecognizeFileMetadata]"
5051
},
5152
{
5253
"name": "retry",
@@ -138,7 +139,7 @@
138139
},
139140
{
140141
"name": "files",
141-
"type": "Sequence[google.cloud.speech_v2.types.BatchRecognizeFileMetadata]"
142+
"type": "MutableSequence[google.cloud.speech_v2.types.BatchRecognizeFileMetadata]"
142143
},
143144
{
144145
"name": "retry",

speech/generated_samples/speech_v1_generated_speech_long_running_recognize_async.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ async def sample_long_running_recognize():
5555

5656
print("Waiting for operation to complete...")
5757

58-
response = await operation.result()
58+
response = (await operation).result()
5959

6060
# Handle the response
6161
print(response)

speech/generated_samples/speech_v1p1beta1_generated_speech_long_running_recognize_async.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ async def sample_long_running_recognize():
5555

5656
print("Waiting for operation to complete...")
5757

58-
response = await operation.result()
58+
response = (await operation).result()
5959

6060
# Handle the response
6161
print(response)

speech/generated_samples/speech_v2_generated_speech_batch_recognize_async.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ async def sample_batch_recognize():
4848

4949
print("Waiting for operation to complete...")
5050

51-
response = await operation.result()
51+
response = (await operation).result()
5252

5353
# Handle the response
5454
print(response)

speech/generated_samples/speech_v2_generated_speech_create_custom_class_async.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ async def sample_create_custom_class():
4848

4949
print("Waiting for operation to complete...")
5050

51-
response = await operation.result()
51+
response = (await operation).result()
5252

5353
# Handle the response
5454
print(response)

speech/generated_samples/speech_v2_generated_speech_create_phrase_set_async.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ async def sample_create_phrase_set():
4848

4949
print("Waiting for operation to complete...")
5050

51-
response = await operation.result()
51+
response = (await operation).result()
5252

5353
# Handle the response
5454
print(response)

speech/generated_samples/speech_v2_generated_speech_create_recognizer_async.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ async def sample_create_recognizer():
5353

5454
print("Waiting for operation to complete...")
5555

56-
response = await operation.result()
56+
response = (await operation).result()
5757

5858
# Handle the response
5959
print(response)

speech/generated_samples/speech_v2_generated_speech_delete_custom_class_async.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ async def sample_delete_custom_class():
4848

4949
print("Waiting for operation to complete...")
5050

51-
response = await operation.result()
51+
response = (await operation).result()
5252

5353
# Handle the response
5454
print(response)

speech/generated_samples/speech_v2_generated_speech_delete_phrase_set_async.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ async def sample_delete_phrase_set():
4848

4949
print("Waiting for operation to complete...")
5050

51-
response = await operation.result()
51+
response = (await operation).result()
5252

5353
# Handle the response
5454
print(response)

speech/generated_samples/speech_v2_generated_speech_delete_recognizer_async.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ async def sample_delete_recognizer():
4848

4949
print("Waiting for operation to complete...")
5050

51-
response = await operation.result()
51+
response = (await operation).result()
5252

5353
# Handle the response
5454
print(response)

speech/generated_samples/speech_v2_generated_speech_undelete_custom_class_async.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ async def sample_undelete_custom_class():
4848

4949
print("Waiting for operation to complete...")
5050

51-
response = await operation.result()
51+
response = (await operation).result()
5252

5353
# Handle the response
5454
print(response)

speech/generated_samples/speech_v2_generated_speech_undelete_phrase_set_async.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ async def sample_undelete_phrase_set():
4848

4949
print("Waiting for operation to complete...")
5050

51-
response = await operation.result()
51+
response = (await operation).result()
5252

5353
# Handle the response
5454
print(response)

speech/generated_samples/speech_v2_generated_speech_undelete_recognizer_async.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ async def sample_undelete_recognizer():
4848

4949
print("Waiting for operation to complete...")
5050

51-
response = await operation.result()
51+
response = (await operation).result()
5252

5353
# Handle the response
5454
print(response)

speech/generated_samples/speech_v2_generated_speech_update_custom_class_async.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ async def sample_update_custom_class():
4747

4848
print("Waiting for operation to complete...")
4949

50-
response = await operation.result()
50+
response = (await operation).result()
5151

5252
# Handle the response
5353
print(response)

speech/generated_samples/speech_v2_generated_speech_update_phrase_set_async.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ async def sample_update_phrase_set():
4747

4848
print("Waiting for operation to complete...")
4949

50-
response = await operation.result()
50+
response = (await operation).result()
5151

5252
# Handle the response
5353
print(response)

speech/generated_samples/speech_v2_generated_speech_update_recognizer_async.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ async def sample_update_recognizer():
5252

5353
print("Waiting for operation to complete...")
5454

55-
response = await operation.result()
55+
response = (await operation).result()
5656

5757
# Handle the response
5858
print(response)

speech/microphone/noxfile.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ def blacken(session: nox.sessions.Session) -> None:
160160
# format = isort + black
161161
#
162162

163+
163164
@nox.session
164165
def format(session: nox.sessions.Session) -> None:
165166
"""
@@ -187,7 +188,9 @@ def _session_tests(
187188
session: nox.sessions.Session, post_install: Callable = None
188189
) -> None:
189190
# check for presence of tests
190-
test_list = glob.glob("**/*_test.py", recursive=True) + glob.glob("**/test_*.py", recursive=True)
191+
test_list = glob.glob("**/*_test.py", recursive=True) + glob.glob(
192+
"**/test_*.py", recursive=True
193+
)
191194
test_list.extend(glob.glob("**/tests", recursive=True))
192195

193196
if len(test_list) == 0:
@@ -209,9 +212,7 @@ def _session_tests(
209212

210213
if os.path.exists("requirements-test.txt"):
211214
if os.path.exists("constraints-test.txt"):
212-
session.install(
213-
"-r", "requirements-test.txt", "-c", "constraints-test.txt"
214-
)
215+
session.install("-r", "requirements-test.txt", "-c", "constraints-test.txt")
215216
else:
216217
session.install("-r", "requirements-test.txt")
217218
with open("requirements-test.txt") as rtfile:
@@ -224,9 +225,9 @@ def _session_tests(
224225
post_install(session)
225226

226227
if "pytest-parallel" in packages:
227-
concurrent_args.extend(['--workers', 'auto', '--tests-per-worker', 'auto'])
228+
concurrent_args.extend(["--workers", "auto", "--tests-per-worker", "auto"])
228229
elif "pytest-xdist" in packages:
229-
concurrent_args.extend(['-n', 'auto'])
230+
concurrent_args.extend(["-n", "auto"])
230231

231232
session.run(
232233
"pytest",
@@ -256,7 +257,7 @@ def py(session: nox.sessions.Session) -> None:
256257

257258

258259
def _get_repo_root() -> Optional[str]:
259-
""" Returns the root folder of the project. """
260+
"""Returns the root folder of the project."""
260261
# Get root of this repository. Assume we don't have directories nested deeper than 10 items.
261262
p = Path(os.getcwd())
262263
for i in range(10):

speech/snippets/adaptation_v2_custom_class_reference.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@
2020
from google.cloud.speech_v2.types import cloud_speech
2121

2222

23-
def adaptation_v2_custom_class_reference(project_id, recognizer_id, phrase_set_id, custom_class_id, audio_file):
23+
def adaptation_v2_custom_class_reference(
24+
project_id, recognizer_id, phrase_set_id, custom_class_id, audio_file
25+
):
2426
# Instantiates a client
2527
client = SpeechClient()
2628

@@ -44,7 +46,8 @@ def adaptation_v2_custom_class_reference(project_id, recognizer_id, phrase_set_i
4446
request = cloud_speech.CreateCustomClassRequest(
4547
parent=f"projects/{project_id}/locations/global",
4648
custom_class_id=custom_class_id,
47-
custom_class=cloud_speech.CustomClass(items=[{"value": "fare"}]))
49+
custom_class=cloud_speech.CustomClass(items=[{"value": "fare"}]),
50+
)
4851

4952
operation = client.create_custom_class(request=request)
5053
custom_class = operation.result()
@@ -53,7 +56,10 @@ def adaptation_v2_custom_class_reference(project_id, recognizer_id, phrase_set_i
5356
request = cloud_speech.CreatePhraseSetRequest(
5457
parent=f"projects/{project_id}/locations/global",
5558
phrase_set_id=phrase_set_id,
56-
phrase_set=cloud_speech.PhraseSet(phrases=[{"value": f"${{{custom_class.name}}}", "boost": 20}]))
59+
phrase_set=cloud_speech.PhraseSet(
60+
phrases=[{"value": f"${{{custom_class.name}}}", "boost": 20}]
61+
),
62+
)
5763

5864
operation = client.create_phrase_set(request=request)
5965
phrase_set = operation.result()
@@ -81,6 +87,8 @@ def adaptation_v2_custom_class_reference(project_id, recognizer_id, phrase_set_i
8187
print("Transcript: {}".format(result.alternatives[0].transcript))
8288

8389
return response
90+
91+
8492
# [END speech_adaptation_v2_custom_class_reference]
8593

8694

speech/snippets/adaptation_v2_custom_class_reference_test.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,14 @@ def test_adaptation_v2_custom_class_reference(capsys):
4747
recognizer_id = "recognizer-" + str(uuid4())
4848
phrase_set_id = "phrase-set-" + str(uuid4())
4949
custom_class_id = "custom-class-" + str(uuid4())
50-
response = adaptation_v2_custom_class_reference.adaptation_v2_custom_class_reference(
51-
project_id, recognizer_id, phrase_set_id, custom_class_id, os.path.join(RESOURCES, "fair.wav")
50+
response = (
51+
adaptation_v2_custom_class_reference.adaptation_v2_custom_class_reference(
52+
project_id,
53+
recognizer_id,
54+
phrase_set_id,
55+
custom_class_id,
56+
os.path.join(RESOURCES, "fair.wav"),
57+
)
5258
)
5359

5460
assert re.search(

speech/snippets/adaptation_v2_inline_custom_class.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def adaptation_v2_inline_custom_class(project_id, recognizer_id, audio_file):
4949
inline_phrase_set=phrase_set
5050
)
5151
],
52-
custom_classes=[custom_class]
52+
custom_classes=[custom_class],
5353
)
5454
config = cloud_speech.RecognitionConfig(
5555
auto_decoding_config={}, adaptation=adaptation
@@ -66,6 +66,8 @@ def adaptation_v2_inline_custom_class(project_id, recognizer_id, audio_file):
6666
print("Transcript: {}".format(result.alternatives[0].transcript))
6767

6868
return response
69+
70+
6971
# [END speech_adaptation_v2_inline_custom_class]
7072

7173

speech/snippets/adaptation_v2_inline_phrase_set.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ def adaptation_v2_inline_phrase_set(project_id, recognizer_id, audio_file):
6464
print("Transcript: {}".format(result.alternatives[0].transcript))
6565

6666
return response
67+
68+
6769
# [END speech_adaptation_v2_inline_phrase_set]
6870

6971

speech/snippets/adaptation_v2_phrase_set_reference.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@
2020
from google.cloud.speech_v2.types import cloud_speech
2121

2222

23-
def adaptation_v2_phrase_set_reference(project_id, recognizer_id, phrase_set_id, audio_file):
23+
def adaptation_v2_phrase_set_reference(
24+
project_id, recognizer_id, phrase_set_id, audio_file
25+
):
2426
# Instantiates a client
2527
client = SpeechClient()
2628

@@ -44,7 +46,8 @@ def adaptation_v2_phrase_set_reference(project_id, recognizer_id, phrase_set_id,
4446
request = cloud_speech.CreatePhraseSetRequest(
4547
parent=f"projects/{project_id}/locations/global",
4648
phrase_set_id=phrase_set_id,
47-
phrase_set=cloud_speech.PhraseSet(phrases=[{"value": "fare", "boost": 10}]))
49+
phrase_set=cloud_speech.PhraseSet(phrases=[{"value": "fare", "boost": 10}]),
50+
)
4851

4952
operation = client.create_phrase_set(request=request)
5053
phrase_set = operation.result()
@@ -72,6 +75,8 @@ def adaptation_v2_phrase_set_reference(project_id, recognizer_id, phrase_set_id,
7275
print("Transcript: {}".format(result.alternatives[0].transcript))
7376

7477
return response
78+
79+
7580
# [END speech_adaptation_v2_phrase_set_reference]
7681

7782

0 commit comments

Comments
 (0)