Skip to content
Permalink
Browse files
chore: upgrade gapic-generator-python to 0.46.3 (#141)
PiperOrigin-RevId: 373649163

Source-Link: googleapis/googleapis@7e1b14e

Source-Link: googleapis/googleapis-gen@0a3c7d2

fix: add async client to %name_%version/init.py
chore: add autogenerated snippets
chore: remove auth, policy, and options from the reserved names list
feat: support self-signed JWT flow for service accounts
chore: enable GAPIC metadata generation
chore: sort subpackages in %namespace/%name/init.py
  • Loading branch information
gcf-owl-bot committed May 21, 2021
1 parent af6c210 commit 8a08836487c1b7e4e58d3c07a4e26005d40793f0
Showing with 996 additions and 490 deletions.
  1. +10 −10 google/cloud/texttospeech/__init__.py
  2. +6 −5 google/cloud/texttospeech_v1/__init__.py
  3. +43 −0 google/cloud/texttospeech_v1/gapic_metadata.json
  4. +0 −1 google/cloud/texttospeech_v1/services/__init__.py
  5. +0 −2 google/cloud/texttospeech_v1/services/text_to_speech/__init__.py
  6. +12 −21 google/cloud/texttospeech_v1/services/text_to_speech/async_client.py
  7. +30 −33 google/cloud/texttospeech_v1/services/text_to_speech/client.py
  8. +0 −2 google/cloud/texttospeech_v1/services/text_to_speech/transports/__init__.py
  9. +88 −28 google/cloud/texttospeech_v1/services/text_to_speech/transports/base.py
  10. +11 −11 google/cloud/texttospeech_v1/services/text_to_speech/transports/grpc.py
  11. +11 −12 google/cloud/texttospeech_v1/services/text_to_speech/transports/grpc_asyncio.py
  12. +0 −2 google/cloud/texttospeech_v1/types/__init__.py
  13. +14 −33 google/cloud/texttospeech_v1/types/cloud_tts.py
  14. +6 −5 google/cloud/texttospeech_v1beta1/__init__.py
  15. +43 −0 google/cloud/texttospeech_v1beta1/gapic_metadata.json
  16. +0 −1 google/cloud/texttospeech_v1beta1/services/__init__.py
  17. +0 −2 google/cloud/texttospeech_v1beta1/services/text_to_speech/__init__.py
  18. +8 −19 google/cloud/texttospeech_v1beta1/services/text_to_speech/async_client.py
  19. +30 −33 google/cloud/texttospeech_v1beta1/services/text_to_speech/client.py
  20. +0 −2 google/cloud/texttospeech_v1beta1/services/text_to_speech/transports/__init__.py
  21. +84 −26 google/cloud/texttospeech_v1beta1/services/text_to_speech/transports/base.py
  22. +11 −11 google/cloud/texttospeech_v1beta1/services/text_to_speech/transports/grpc.py
  23. +11 −12 google/cloud/texttospeech_v1beta1/services/text_to_speech/transports/grpc_asyncio.py
  24. +0 −2 google/cloud/texttospeech_v1beta1/types/__init__.py
  25. +16 −39 google/cloud/texttospeech_v1beta1/types/cloud_tts.py
  26. +3 −6 scripts/fixup_texttospeech_v1_keywords.py
  27. +3 −6 scripts/fixup_texttospeech_v1beta1_keywords.py
  28. +1 −0 setup.py
  29. +2 −0 testing/constraints-3.6.txt
  30. +15 −0 tests/__init__.py
  31. +15 −0 tests/unit/__init__.py
  32. +15 −0 tests/unit/gapic/__init__.py
  33. +0 −1 tests/unit/gapic/texttospeech_v1/__init__.py
  34. +254 −82 tests/unit/gapic/texttospeech_v1/test_text_to_speech.py
  35. +0 −1 tests/unit/gapic/texttospeech_v1beta1/__init__.py
  36. +254 −82 tests/unit/gapic/texttospeech_v1beta1/test_text_to_speech.py
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-

# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -15,34 +14,35 @@
# limitations under the License.
#

from google.cloud.texttospeech_v1.services.text_to_speech.async_client import (
TextToSpeechAsyncClient,
)
from google.cloud.texttospeech_v1.services.text_to_speech.client import (
TextToSpeechClient,
)
from google.cloud.texttospeech_v1.services.text_to_speech.async_client import (
TextToSpeechAsyncClient,
)

from google.cloud.texttospeech_v1.types.cloud_tts import AudioConfig
from google.cloud.texttospeech_v1.types.cloud_tts import AudioEncoding
from google.cloud.texttospeech_v1.types.cloud_tts import ListVoicesRequest
from google.cloud.texttospeech_v1.types.cloud_tts import ListVoicesResponse
from google.cloud.texttospeech_v1.types.cloud_tts import SsmlVoiceGender
from google.cloud.texttospeech_v1.types.cloud_tts import SynthesisInput
from google.cloud.texttospeech_v1.types.cloud_tts import SynthesizeSpeechRequest
from google.cloud.texttospeech_v1.types.cloud_tts import SynthesizeSpeechResponse
from google.cloud.texttospeech_v1.types.cloud_tts import Voice
from google.cloud.texttospeech_v1.types.cloud_tts import VoiceSelectionParams
from google.cloud.texttospeech_v1.types.cloud_tts import AudioEncoding
from google.cloud.texttospeech_v1.types.cloud_tts import SsmlVoiceGender

__all__ = (
"TextToSpeechClient",
"TextToSpeechAsyncClient",
"AudioConfig",
"AudioEncoding",
"ListVoicesRequest",
"ListVoicesResponse",
"SsmlVoiceGender",
"SynthesisInput",
"SynthesizeSpeechRequest",
"SynthesizeSpeechResponse",
"TextToSpeechAsyncClient",
"TextToSpeechClient",
"Voice",
"VoiceSelectionParams",
"AudioEncoding",
"SsmlVoiceGender",
)
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-

# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -16,19 +15,21 @@
#

from .services.text_to_speech import TextToSpeechClient
from .services.text_to_speech import TextToSpeechAsyncClient

from .types.cloud_tts import AudioConfig
from .types.cloud_tts import AudioEncoding
from .types.cloud_tts import ListVoicesRequest
from .types.cloud_tts import ListVoicesResponse
from .types.cloud_tts import SsmlVoiceGender
from .types.cloud_tts import SynthesisInput
from .types.cloud_tts import SynthesizeSpeechRequest
from .types.cloud_tts import SynthesizeSpeechResponse
from .types.cloud_tts import Voice
from .types.cloud_tts import VoiceSelectionParams

from .types.cloud_tts import AudioEncoding
from .types.cloud_tts import SsmlVoiceGender

__all__ = (
"TextToSpeechAsyncClient",
"AudioConfig",
"AudioEncoding",
"ListVoicesRequest",
@@ -37,7 +38,7 @@
"SynthesisInput",
"SynthesizeSpeechRequest",
"SynthesizeSpeechResponse",
"TextToSpeechClient",
"Voice",
"VoiceSelectionParams",
"TextToSpeechClient",
)
@@ -0,0 +1,43 @@
{
"comment": "This file maps proto services/RPCs to the corresponding library clients/methods",
"language": "python",
"libraryPackage": "google.cloud.texttospeech_v1",
"protoPackage": "google.cloud.texttospeech.v1",
"schema": "1.0",
"services": {
"TextToSpeech": {
"clients": {
"grpc": {
"libraryClient": "TextToSpeechClient",
"rpcs": {
"ListVoices": {
"methods": [
"list_voices"
]
},
"SynthesizeSpeech": {
"methods": [
"synthesize_speech"
]
}
}
},
"grpc-async": {
"libraryClient": "TextToSpeechAsyncClient",
"rpcs": {
"ListVoices": {
"methods": [
"list_voices"
]
},
"SynthesizeSpeech": {
"methods": [
"synthesize_speech"
]
}
}
}
}
}
}
}
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-

# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-

# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,7 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#

from .client import TextToSpeechClient
from .async_client import TextToSpeechAsyncClient

@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-

# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,22 +13,20 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#

from collections import OrderedDict
import functools
import re
from typing import Dict, Sequence, Tuple, Type, Union
import pkg_resources

import google.api_core.client_options as ClientOptions # type: ignore
from google.api_core import exceptions # type: ignore
from google.api_core import exceptions as core_exceptions # type: ignore
from google.api_core import gapic_v1 # type: ignore
from google.api_core import retry as retries # type: ignore
from google.auth import credentials # type: ignore
from google.auth import credentials as ga_credentials # type: ignore
from google.oauth2 import service_account # type: ignore

from google.cloud.texttospeech_v1.types import cloud_tts

from .transports.base import TextToSpeechTransport, DEFAULT_CLIENT_INFO
from .transports.grpc_asyncio import TextToSpeechGrpcAsyncIOTransport
from .client import TextToSpeechClient
@@ -49,28 +46,25 @@ class TextToSpeechAsyncClient:
parse_common_billing_account_path = staticmethod(
TextToSpeechClient.parse_common_billing_account_path
)

common_folder_path = staticmethod(TextToSpeechClient.common_folder_path)
parse_common_folder_path = staticmethod(TextToSpeechClient.parse_common_folder_path)

common_organization_path = staticmethod(TextToSpeechClient.common_organization_path)
parse_common_organization_path = staticmethod(
TextToSpeechClient.parse_common_organization_path
)

common_project_path = staticmethod(TextToSpeechClient.common_project_path)
parse_common_project_path = staticmethod(
TextToSpeechClient.parse_common_project_path
)

common_location_path = staticmethod(TextToSpeechClient.common_location_path)
parse_common_location_path = staticmethod(
TextToSpeechClient.parse_common_location_path
)

@classmethod
def from_service_account_info(cls, info: dict, *args, **kwargs):
"""Creates an instance of this client using the provided credentials info.
"""Creates an instance of this client using the provided credentials
info.
Args:
info (dict): The service account private key info.
@@ -85,7 +79,7 @@ def from_service_account_info(cls, info: dict, *args, **kwargs):
@classmethod
def from_service_account_file(cls, filename: str, *args, **kwargs):
"""Creates an instance of this client using the provided credentials
file.
file.
Args:
filename (str): The path to the service account private key json
@@ -102,7 +96,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs):

@property
def transport(self) -> TextToSpeechTransport:
"""Return the transport used by the client instance.
"""Returns the transport used by the client instance.
Returns:
TextToSpeechTransport: The transport used by the client instance.
@@ -116,12 +110,12 @@ def transport(self) -> TextToSpeechTransport:
def __init__(
self,
*,
credentials: credentials.Credentials = None,
credentials: ga_credentials.Credentials = None,
transport: Union[str, TextToSpeechTransport] = "grpc_asyncio",
client_options: ClientOptions = None,
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
) -> None:
"""Instantiate the text to speech client.
"""Instantiates the text to speech client.
Args:
credentials (Optional[google.auth.credentials.Credentials]): The
@@ -153,7 +147,6 @@ def __init__(
google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport
creation failed for any reason.
"""

self._client = TextToSpeechClient(
credentials=credentials,
transport=transport,
@@ -191,7 +184,6 @@ async def list_voices(
This corresponds to the ``language_code`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
@@ -218,7 +210,6 @@ async def list_voices(

# If we have keyword arguments corresponding to fields on the
# request, apply these.

if language_code is not None:
request.language_code = language_code

@@ -231,7 +222,8 @@ async def list_voices(
maximum=60.0,
multiplier=1.3,
predicate=retries.if_exception_type(
exceptions.DeadlineExceeded, exceptions.ServiceUnavailable,
core_exceptions.DeadlineExceeded,
core_exceptions.ServiceUnavailable,
),
deadline=600.0,
),
@@ -284,7 +276,6 @@ async def synthesize_speech(
This corresponds to the ``audio_config`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
@@ -311,7 +302,6 @@ async def synthesize_speech(

# If we have keyword arguments corresponding to fields on the
# request, apply these.

if input is not None:
request.input = input
if voice is not None:
@@ -328,7 +318,8 @@ async def synthesize_speech(
maximum=60.0,
multiplier=1.3,
predicate=retries.if_exception_type(
exceptions.DeadlineExceeded, exceptions.ServiceUnavailable,
core_exceptions.DeadlineExceeded,
core_exceptions.ServiceUnavailable,
),
deadline=600.0,
),
Loading

0 comments on commit 8a08836

Please sign in to comment.