Skip to content
This repository has been archived by the owner on Nov 29, 2023. It is now read-only.

Commit

Permalink
chore: upgrade gapic-generator-python to 0.46.3 (#141)
Browse files Browse the repository at this point in the history
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[bot] committed May 21, 2021
1 parent af6c210 commit 8a08836
Show file tree
Hide file tree
Showing 36 changed files with 996 additions and 490 deletions.
20 changes: 10 additions & 10 deletions google/cloud/texttospeech/__init__.py
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-

# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -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",
)
11 changes: 6 additions & 5 deletions google/cloud/texttospeech_v1/__init__.py
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-

# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -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",
Expand All @@ -37,7 +38,7 @@
"SynthesisInput",
"SynthesizeSpeechRequest",
"SynthesizeSpeechResponse",
"TextToSpeechClient",
"Voice",
"VoiceSelectionParams",
"TextToSpeechClient",
)
43 changes: 43 additions & 0 deletions google/cloud/texttospeech_v1/gapic_metadata.json
@@ -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 change: 0 additions & 1 deletion google/cloud/texttospeech_v1/services/__init__.py
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-

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

# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -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

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

# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -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
Expand All @@ -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.
Expand All @@ -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
Expand All @@ -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.
Expand All @@ -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
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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.
Expand All @@ -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

Expand All @@ -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,
),
Expand Down Expand Up @@ -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.
Expand All @@ -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:
Expand All @@ -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,
),
Expand Down

0 comments on commit 8a08836

Please sign in to comment.