Skip to content

Commit

Permalink
feat: Added new fields to facilitate debugging (#465)
Browse files Browse the repository at this point in the history
* 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: googleapis/googleapis-gen@c8aa327
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: googleapis/googleapis-gen@61ef576
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: googleapis/googleapis-gen@ab0e217
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: googleapis/googleapis-gen@555c094
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: 4922767

Source-Link: googleapis/googleapis@4c25335

Source-Link: googleapis/googleapis-gen@f15b9ac
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: googleapis/googleapis-gen@387b734
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: googleapis/googleapis-gen@d63ac84
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]>
  • Loading branch information
3 people authored and dandhlee committed Feb 9, 2023
1 parent 647f43b commit eb6f4d1
Show file tree
Hide file tree
Showing 43 changed files with 119 additions and 75 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
}
],
"language": "PYTHON",
"name": "google-cloud-speech"
"name": "google-cloud-speech",
"version": "0.1.0"
},
"snippets": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
}
],
"language": "PYTHON",
"name": "google-cloud-speech"
"name": "google-cloud-speech",
"version": "0.1.0"
},
"snippets": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
}
],
"language": "PYTHON",
"name": "google-cloud-speech"
"name": "google-cloud-speech",
"version": "0.1.0"
},
"snippets": [
{
Expand Down Expand Up @@ -46,7 +47,7 @@
},
{
"name": "files",
"type": "Sequence[google.cloud.speech_v2.types.BatchRecognizeFileMetadata]"
"type": "MutableSequence[google.cloud.speech_v2.types.BatchRecognizeFileMetadata]"
},
{
"name": "retry",
Expand Down Expand Up @@ -138,7 +139,7 @@
},
{
"name": "files",
"type": "Sequence[google.cloud.speech_v2.types.BatchRecognizeFileMetadata]"
"type": "MutableSequence[google.cloud.speech_v2.types.BatchRecognizeFileMetadata]"
},
{
"name": "retry",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ async def sample_long_running_recognize():

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

response = await operation.result()
response = (await operation).result()

# Handle the response
print(response)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ async def sample_long_running_recognize():

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

response = await operation.result()
response = (await operation).result()

# Handle the response
print(response)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ async def sample_batch_recognize():

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

response = await operation.result()
response = (await operation).result()

# Handle the response
print(response)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ async def sample_create_custom_class():

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

response = await operation.result()
response = (await operation).result()

# Handle the response
print(response)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ async def sample_create_phrase_set():

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

response = await operation.result()
response = (await operation).result()

# Handle the response
print(response)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ async def sample_create_recognizer():

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

response = await operation.result()
response = (await operation).result()

# Handle the response
print(response)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ async def sample_delete_custom_class():

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

response = await operation.result()
response = (await operation).result()

# Handle the response
print(response)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ async def sample_delete_phrase_set():

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

response = await operation.result()
response = (await operation).result()

# Handle the response
print(response)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ async def sample_delete_recognizer():

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

response = await operation.result()
response = (await operation).result()

# Handle the response
print(response)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ async def sample_undelete_custom_class():

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

response = await operation.result()
response = (await operation).result()

# Handle the response
print(response)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ async def sample_undelete_phrase_set():

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

response = await operation.result()
response = (await operation).result()

# Handle the response
print(response)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ async def sample_undelete_recognizer():

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

response = await operation.result()
response = (await operation).result()

# Handle the response
print(response)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ async def sample_update_custom_class():

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

response = await operation.result()
response = (await operation).result()

# Handle the response
print(response)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ async def sample_update_phrase_set():

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

response = await operation.result()
response = (await operation).result()

# Handle the response
print(response)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ async def sample_update_recognizer():

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

response = await operation.result()
response = (await operation).result()

# Handle the response
print(response)
Expand Down
15 changes: 8 additions & 7 deletions speech/microphone/noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ def blacken(session: nox.sessions.Session) -> None:
# format = isort + black
#


@nox.session
def format(session: nox.sessions.Session) -> None:
"""
Expand Down Expand Up @@ -187,7 +188,9 @@ def _session_tests(
session: nox.sessions.Session, post_install: Callable = None
) -> None:
# check for presence of tests
test_list = glob.glob("**/*_test.py", recursive=True) + glob.glob("**/test_*.py", recursive=True)
test_list = glob.glob("**/*_test.py", recursive=True) + glob.glob(
"**/test_*.py", recursive=True
)
test_list.extend(glob.glob("**/tests", recursive=True))

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

if os.path.exists("requirements-test.txt"):
if os.path.exists("constraints-test.txt"):
session.install(
"-r", "requirements-test.txt", "-c", "constraints-test.txt"
)
session.install("-r", "requirements-test.txt", "-c", "constraints-test.txt")
else:
session.install("-r", "requirements-test.txt")
with open("requirements-test.txt") as rtfile:
Expand All @@ -224,9 +225,9 @@ def _session_tests(
post_install(session)

if "pytest-parallel" in packages:
concurrent_args.extend(['--workers', 'auto', '--tests-per-worker', 'auto'])
concurrent_args.extend(["--workers", "auto", "--tests-per-worker", "auto"])
elif "pytest-xdist" in packages:
concurrent_args.extend(['-n', 'auto'])
concurrent_args.extend(["-n", "auto"])

session.run(
"pytest",
Expand Down Expand Up @@ -256,7 +257,7 @@ def py(session: nox.sessions.Session) -> None:


def _get_repo_root() -> Optional[str]:
""" Returns the root folder of the project. """
"""Returns the root folder of the project."""
# Get root of this repository. Assume we don't have directories nested deeper than 10 items.
p = Path(os.getcwd())
for i in range(10):
Expand Down
14 changes: 11 additions & 3 deletions speech/snippets/adaptation_v2_custom_class_reference.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
from google.cloud.speech_v2.types import cloud_speech


def adaptation_v2_custom_class_reference(project_id, recognizer_id, phrase_set_id, custom_class_id, audio_file):
def adaptation_v2_custom_class_reference(
project_id, recognizer_id, phrase_set_id, custom_class_id, audio_file
):
# Instantiates a client
client = SpeechClient()

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

operation = client.create_custom_class(request=request)
custom_class = operation.result()
Expand All @@ -53,7 +56,10 @@ def adaptation_v2_custom_class_reference(project_id, recognizer_id, phrase_set_i
request = cloud_speech.CreatePhraseSetRequest(
parent=f"projects/{project_id}/locations/global",
phrase_set_id=phrase_set_id,
phrase_set=cloud_speech.PhraseSet(phrases=[{"value": f"${{{custom_class.name}}}", "boost": 20}]))
phrase_set=cloud_speech.PhraseSet(
phrases=[{"value": f"${{{custom_class.name}}}", "boost": 20}]
),
)

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

return response


# [END speech_adaptation_v2_custom_class_reference]


Expand Down
10 changes: 8 additions & 2 deletions speech/snippets/adaptation_v2_custom_class_reference_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,14 @@ def test_adaptation_v2_custom_class_reference(capsys):
recognizer_id = "recognizer-" + str(uuid4())
phrase_set_id = "phrase-set-" + str(uuid4())
custom_class_id = "custom-class-" + str(uuid4())
response = adaptation_v2_custom_class_reference.adaptation_v2_custom_class_reference(
project_id, recognizer_id, phrase_set_id, custom_class_id, os.path.join(RESOURCES, "fair.wav")
response = (
adaptation_v2_custom_class_reference.adaptation_v2_custom_class_reference(
project_id,
recognizer_id,
phrase_set_id,
custom_class_id,
os.path.join(RESOURCES, "fair.wav"),
)
)

assert re.search(
Expand Down
4 changes: 3 additions & 1 deletion speech/snippets/adaptation_v2_inline_custom_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def adaptation_v2_inline_custom_class(project_id, recognizer_id, audio_file):
inline_phrase_set=phrase_set
)
],
custom_classes=[custom_class]
custom_classes=[custom_class],
)
config = cloud_speech.RecognitionConfig(
auto_decoding_config={}, adaptation=adaptation
Expand All @@ -66,6 +66,8 @@ def adaptation_v2_inline_custom_class(project_id, recognizer_id, audio_file):
print("Transcript: {}".format(result.alternatives[0].transcript))

return response


# [END speech_adaptation_v2_inline_custom_class]


Expand Down
2 changes: 2 additions & 0 deletions speech/snippets/adaptation_v2_inline_phrase_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ def adaptation_v2_inline_phrase_set(project_id, recognizer_id, audio_file):
print("Transcript: {}".format(result.alternatives[0].transcript))

return response


# [END speech_adaptation_v2_inline_phrase_set]


Expand Down
9 changes: 7 additions & 2 deletions speech/snippets/adaptation_v2_phrase_set_reference.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
from google.cloud.speech_v2.types import cloud_speech


def adaptation_v2_phrase_set_reference(project_id, recognizer_id, phrase_set_id, audio_file):
def adaptation_v2_phrase_set_reference(
project_id, recognizer_id, phrase_set_id, audio_file
):
# Instantiates a client
client = SpeechClient()

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

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

return response


# [END speech_adaptation_v2_phrase_set_reference]


Expand Down
Loading

0 comments on commit eb6f4d1

Please sign in to comment.