Skip to content

Commit

Permalink
chore: update to gapic-generator-python 0.46.3 (#162)
Browse files Browse the repository at this point in the history
* chore: update to gapic-generator-python 0.46.3

* 🦉 Updates from OwlBot

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>

feat: add webm opus support
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
busunkim96 authored May 22, 2021
1 parent 8a7fa69 commit 1c5cf3f
Show file tree
Hide file tree
Showing 48 changed files with 1,811 additions and 1,247 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ Adaptation
:members:
:inherited-members:


.. automodule:: google.cloud.speech_v1p1beta1.services.adaptation.pagers
:members:
:inherited-members:
8 changes: 4 additions & 4 deletions packages/google-cloud-speech/google/cloud/speech/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-

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

from google.cloud.speech_v1.services.speech.async_client import SpeechAsyncClient
from google.cloud.speech_v1 import SpeechClient
from google.cloud.speech_v1.services.speech.async_client import SpeechAsyncClient

from google.cloud.speech_v1.types.cloud_speech import LongRunningRecognizeMetadata
from google.cloud.speech_v1.types.cloud_speech import LongRunningRecognizeRequest
from google.cloud.speech_v1.types.cloud_speech import LongRunningRecognizeResponse
Expand All @@ -36,6 +36,8 @@
from google.cloud.speech_v1.types.cloud_speech import WordInfo

__all__ = (
"SpeechClient",
"SpeechAsyncClient",
"LongRunningRecognizeMetadata",
"LongRunningRecognizeRequest",
"LongRunningRecognizeResponse",
Expand All @@ -45,8 +47,6 @@
"RecognizeRequest",
"RecognizeResponse",
"SpeakerDiarizationConfig",
"SpeechAsyncClient",
"SpeechClient",
"SpeechContext",
"SpeechRecognitionAlternative",
"SpeechRecognitionResult",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-

# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -16,6 +15,8 @@
#

from .services.speech import SpeechClient
from .services.speech import SpeechAsyncClient

from .types.cloud_speech import LongRunningRecognizeMetadata
from .types.cloud_speech import LongRunningRecognizeRequest
from .types.cloud_speech import LongRunningRecognizeResponse
Expand All @@ -34,7 +35,6 @@
from .types.cloud_speech import StreamingRecognizeResponse
from .types.cloud_speech import WordInfo


from google.cloud.speech_v1.helpers import SpeechHelpers


Expand All @@ -43,6 +43,7 @@ class SpeechClient(SpeechHelpers, SpeechClient):


__all__ = (
"SpeechAsyncClient",
"LongRunningRecognizeMetadata",
"LongRunningRecognizeRequest",
"LongRunningRecognizeResponse",
Expand All @@ -52,6 +53,7 @@ class SpeechClient(SpeechHelpers, SpeechClient):
"RecognizeRequest",
"RecognizeResponse",
"SpeakerDiarizationConfig",
"SpeechClient",
"SpeechContext",
"SpeechRecognitionAlternative",
"SpeechRecognitionResult",
Expand All @@ -60,5 +62,4 @@ class SpeechClient(SpeechHelpers, SpeechClient):
"StreamingRecognizeRequest",
"StreamingRecognizeResponse",
"WordInfo",
"SpeechClient",
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
"comment": "This file maps proto services/RPCs to the corresponding library clients/methods",
"language": "python",
"libraryPackage": "google.cloud.speech_v1",
"protoPackage": "google.cloud.speech.v1",
"schema": "1.0",
"services": {
"Speech": {
"clients": {
"grpc": {
"libraryClient": "SpeechClient",
"rpcs": {
"LongRunningRecognize": {
"methods": [
"long_running_recognize"
]
},
"Recognize": {
"methods": [
"recognize"
]
},
"StreamingRecognize": {
"methods": [
"streaming_recognize"
]
}
}
},
"grpc-async": {
"libraryClient": "SpeechAsyncClient",
"rpcs": {
"LongRunningRecognize": {
"methods": [
"long_running_recognize"
]
},
"Recognize": {
"methods": [
"recognize"
]
},
"StreamingRecognize": {
"methods": [
"streaming_recognize"
]
}
}
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-

# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
Original file line number Diff line number Diff line change
@@ -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 SpeechClient
from .async_client import SpeechAsyncClient

Expand Down
Original file line number Diff line number Diff line change
@@ -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 collections import OrderedDict
import functools
import re
Expand All @@ -31,17 +29,16 @@
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.api_core import operation # type: ignore
from google.api_core import operation_async # type: ignore
from google.cloud.speech_v1.types import cloud_speech
from google.rpc import status_pb2 as status # type: ignore

from google.rpc import status_pb2 # type: ignore
from .transports.base import SpeechTransport, DEFAULT_CLIENT_INFO
from .transports.grpc_asyncio import SpeechGrpcAsyncIOTransport
from .client import SpeechClient
Expand All @@ -59,24 +56,21 @@ class SpeechAsyncClient:
parse_common_billing_account_path = staticmethod(
SpeechClient.parse_common_billing_account_path
)

common_folder_path = staticmethod(SpeechClient.common_folder_path)
parse_common_folder_path = staticmethod(SpeechClient.parse_common_folder_path)

common_organization_path = staticmethod(SpeechClient.common_organization_path)
parse_common_organization_path = staticmethod(
SpeechClient.parse_common_organization_path
)

common_project_path = staticmethod(SpeechClient.common_project_path)
parse_common_project_path = staticmethod(SpeechClient.parse_common_project_path)

common_location_path = staticmethod(SpeechClient.common_location_path)
parse_common_location_path = staticmethod(SpeechClient.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 @@ -91,7 +85,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 @@ -108,7 +102,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs):

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

self._client = SpeechClient(
credentials=credentials,
transport=transport,
Expand Down Expand Up @@ -199,7 +192,6 @@ async def recognize(
This corresponds to the ``audio`` 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 Down Expand Up @@ -227,7 +219,6 @@ async def recognize(

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

if config is not None:
request.config = config
if audio is not None:
Expand All @@ -242,7 +233,8 @@ async def recognize(
maximum=60.0,
multiplier=1.3,
predicate=retries.if_exception_type(
exceptions.DeadlineExceeded, exceptions.ServiceUnavailable,
core_exceptions.DeadlineExceeded,
core_exceptions.ServiceUnavailable,
),
deadline=5000.0,
),
Expand Down Expand Up @@ -292,7 +284,6 @@ async def long_running_recognize(
This corresponds to the ``audio`` 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 Down Expand Up @@ -325,7 +316,6 @@ async def long_running_recognize(

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

if config is not None:
request.config = config
if audio is not None:
Expand Down Expand Up @@ -454,7 +444,8 @@ def streaming_recognize(
maximum=60.0,
multiplier=1.3,
predicate=retries.if_exception_type(
exceptions.DeadlineExceeded, exceptions.ServiceUnavailable,
core_exceptions.DeadlineExceeded,
core_exceptions.ServiceUnavailable,
),
deadline=5000.0,
),
Expand Down
Loading

0 comments on commit 1c5cf3f

Please sign in to comment.