Skip to content

Commit

Permalink
chore: Use gapic-generator-python 0.65.0 (#359)
Browse files Browse the repository at this point in the history
* chore: Use gapic-generator-python 0.65.0

PiperOrigin-RevId: 440970084

Source-Link: googleapis/googleapis@5e0a3d5

Source-Link: googleapis/googleapis-gen@b0c628a
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYjBjNjI4YTNmYWRlNzY4ZjIyNWQ3Njk5Mjc5MWVhMWJhMmE4ODFiZSJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
  • Loading branch information
gcf-owl-bot[bot] and gcf-owl-bot[bot] authored Apr 11, 2022
1 parent 2daaf49 commit 1e757fe
Show file tree
Hide file tree
Showing 15 changed files with 124 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import re
from typing import (
Dict,
Mapping,
Optional,
AsyncIterable,
Awaitable,
Expand Down Expand Up @@ -220,7 +221,6 @@ async def recognize(
r"""Performs synchronous speech recognition: receive
results after all audio has been sent and processed.
.. code-block:: python
from google.cloud import speech_v1
Expand Down Expand Up @@ -307,8 +307,7 @@ def sample_recognize():
maximum=60.0,
multiplier=1.3,
predicate=retries.if_exception_type(
core_exceptions.DeadlineExceeded,
core_exceptions.ServiceUnavailable,
core_exceptions.GoogleAPICallError,
),
deadline=5000.0,
),
Expand Down Expand Up @@ -344,7 +343,6 @@ async def long_running_recognize(
on asynchronous speech recognition, see the
`how-to <https://cloud.google.com/speech-to-text/docs/async-recognize>`__.
.. code-block:: python
from google.cloud import speech_v1
Expand Down Expand Up @@ -470,7 +468,6 @@ def streaming_recognize(
receive results while sending audio. This method is only
available via the gRPC API (not REST).
.. code-block:: python
from google.cloud import speech_v1
Expand Down Expand Up @@ -593,8 +590,7 @@ def request_generator():
maximum=60.0,
multiplier=1.3,
predicate=retries.if_exception_type(
core_exceptions.DeadlineExceeded,
core_exceptions.ServiceUnavailable,
core_exceptions.GoogleAPICallError,
),
deadline=5000.0,
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,17 @@
from collections import OrderedDict
import os
import re
from typing import Dict, Optional, Iterable, Iterator, Sequence, Tuple, Type, Union
from typing import (
Dict,
Mapping,
Optional,
Iterable,
Iterator,
Sequence,
Tuple,
Type,
Union,
)
import pkg_resources

from google.api_core import client_options as client_options_lib
Expand Down Expand Up @@ -462,7 +472,6 @@ def recognize(
r"""Performs synchronous speech recognition: receive
results after all audio has been sent and processed.
.. code-block:: python
from google.cloud import speech_v1
Expand Down Expand Up @@ -576,7 +585,6 @@ def long_running_recognize(
on asynchronous speech recognition, see the
`how-to <https://cloud.google.com/speech-to-text/docs/async-recognize>`__.
.. code-block:: python
from google.cloud import speech_v1
Expand Down Expand Up @@ -702,7 +710,6 @@ def streaming_recognize(
receive results while sending audio. This method is only
available via the gRPC API (not REST).
.. code-block:: python
from google.cloud import speech_v1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ def __init__(
always_use_jwt_access (Optional[bool]): Whether self signed JWT should
be used for service account credentials.
"""

# Save the hostname. Default to port 443 (HTTPS) if none is specified.
if ":" not in host:
host += ":443"
Expand Down Expand Up @@ -129,8 +130,7 @@ def _prep_wrapped_messages(self, client_info):
maximum=60.0,
multiplier=1.3,
predicate=retries.if_exception_type(
core_exceptions.DeadlineExceeded,
core_exceptions.ServiceUnavailable,
core_exceptions.GoogleAPICallError,
),
deadline=5000.0,
),
Expand All @@ -149,8 +149,7 @@ def _prep_wrapped_messages(self, client_info):
maximum=60.0,
multiplier=1.3,
predicate=retries.if_exception_type(
core_exceptions.DeadlineExceeded,
core_exceptions.ServiceUnavailable,
core_exceptions.GoogleAPICallError,
),
deadline=5000.0,
),
Expand Down Expand Up @@ -205,5 +204,9 @@ def streaming_recognize(
]:
raise NotImplementedError()

@property
def kind(self) -> str:
raise NotImplementedError()


__all__ = ("SpeechTransport",)
Original file line number Diff line number Diff line change
Expand Up @@ -336,5 +336,9 @@ def streaming_recognize(
def close(self):
self.grpc_channel.close()

@property
def kind(self) -> str:
return "grpc"


__all__ = ("SpeechGrpcTransport",)
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from collections import OrderedDict
import functools
import re
from typing import Dict, Optional, Sequence, Tuple, Type, Union
from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union
import pkg_resources

from google.api_core.client_options import ClientOptions
Expand Down Expand Up @@ -216,7 +216,6 @@ async def create_phrase_set(
in the PhraseSet are favored by the recognition model
when you send a call that includes the PhraseSet.
.. code-block:: python
from google.cloud import speech_v1p1beta1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from collections import OrderedDict
import os
import re
from typing import Dict, Optional, Sequence, Tuple, Type, Union
from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union
import pkg_resources

from google.api_core import client_options as client_options_lib
Expand Down Expand Up @@ -464,7 +464,6 @@ def create_phrase_set(
in the PhraseSet are favored by the recognition model
when you send a call that includes the PhraseSet.
.. code-block:: python
from google.cloud import speech_v1p1beta1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ def __init__(
always_use_jwt_access (Optional[bool]): Whether self signed JWT should
be used for service account credentials.
"""

# Save the hostname. Default to port 443 (HTTPS) if none is specified.
if ":" not in host:
host += ":443"
Expand Down Expand Up @@ -279,5 +280,9 @@ def delete_custom_class(
]:
raise NotImplementedError()

@property
def kind(self) -> str:
raise NotImplementedError()


__all__ = ("AdaptationTransport",)
Original file line number Diff line number Diff line change
Expand Up @@ -507,5 +507,9 @@ def delete_custom_class(
def close(self):
self.grpc_channel.close()

@property
def kind(self) -> str:
return "grpc"


__all__ = ("AdaptationGrpcTransport",)
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import re
from typing import (
Dict,
Mapping,
Optional,
AsyncIterable,
Awaitable,
Expand Down Expand Up @@ -220,7 +221,6 @@ async def recognize(
r"""Performs synchronous speech recognition: receive
results after all audio has been sent and processed.
.. code-block:: python
from google.cloud import speech_v1p1beta1
Expand Down Expand Up @@ -307,8 +307,7 @@ def sample_recognize():
maximum=60.0,
multiplier=1.3,
predicate=retries.if_exception_type(
core_exceptions.DeadlineExceeded,
core_exceptions.ServiceUnavailable,
core_exceptions.GoogleAPICallError,
),
deadline=5000.0,
),
Expand Down Expand Up @@ -344,7 +343,6 @@ async def long_running_recognize(
on asynchronous speech recognition, see the
`how-to <https://cloud.google.com/speech-to-text/docs/async-recognize>`__.
.. code-block:: python
from google.cloud import speech_v1p1beta1
Expand Down Expand Up @@ -470,7 +468,6 @@ def streaming_recognize(
receive results while sending audio. This method is only
available via the gRPC API (not REST).
.. code-block:: python
from google.cloud import speech_v1p1beta1
Expand Down Expand Up @@ -593,8 +590,7 @@ def request_generator():
maximum=60.0,
multiplier=1.3,
predicate=retries.if_exception_type(
core_exceptions.DeadlineExceeded,
core_exceptions.ServiceUnavailable,
core_exceptions.GoogleAPICallError,
),
deadline=5000.0,
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,17 @@
from collections import OrderedDict
import os
import re
from typing import Dict, Optional, Iterable, Iterator, Sequence, Tuple, Type, Union
from typing import (
Dict,
Mapping,
Optional,
Iterable,
Iterator,
Sequence,
Tuple,
Type,
Union,
)
import pkg_resources

from google.api_core import client_options as client_options_lib
Expand Down Expand Up @@ -462,7 +472,6 @@ def recognize(
r"""Performs synchronous speech recognition: receive
results after all audio has been sent and processed.
.. code-block:: python
from google.cloud import speech_v1p1beta1
Expand Down Expand Up @@ -576,7 +585,6 @@ def long_running_recognize(
on asynchronous speech recognition, see the
`how-to <https://cloud.google.com/speech-to-text/docs/async-recognize>`__.
.. code-block:: python
from google.cloud import speech_v1p1beta1
Expand Down Expand Up @@ -702,7 +710,6 @@ def streaming_recognize(
receive results while sending audio. This method is only
available via the gRPC API (not REST).
.. code-block:: python
from google.cloud import speech_v1p1beta1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ def __init__(
always_use_jwt_access (Optional[bool]): Whether self signed JWT should
be used for service account credentials.
"""

# Save the hostname. Default to port 443 (HTTPS) if none is specified.
if ":" not in host:
host += ":443"
Expand Down Expand Up @@ -129,8 +130,7 @@ def _prep_wrapped_messages(self, client_info):
maximum=60.0,
multiplier=1.3,
predicate=retries.if_exception_type(
core_exceptions.DeadlineExceeded,
core_exceptions.ServiceUnavailable,
core_exceptions.GoogleAPICallError,
),
deadline=5000.0,
),
Expand All @@ -149,8 +149,7 @@ def _prep_wrapped_messages(self, client_info):
maximum=60.0,
multiplier=1.3,
predicate=retries.if_exception_type(
core_exceptions.DeadlineExceeded,
core_exceptions.ServiceUnavailable,
core_exceptions.GoogleAPICallError,
),
deadline=5000.0,
),
Expand Down Expand Up @@ -205,5 +204,9 @@ def streaming_recognize(
]:
raise NotImplementedError()

@property
def kind(self) -> str:
raise NotImplementedError()


__all__ = ("SpeechTransport",)
Original file line number Diff line number Diff line change
Expand Up @@ -336,5 +336,9 @@ def streaming_recognize(
def close(self):
self.grpc_channel.close()

@property
def kind(self) -> str:
return "grpc"


__all__ = ("SpeechGrpcTransport",)
Original file line number Diff line number Diff line change
Expand Up @@ -1161,6 +1161,19 @@ def test_transport_adc(transport_class):
adc.assert_called_once()


@pytest.mark.parametrize(
"transport_name",
[
"grpc",
],
)
def test_transport_kind(transport_name):
transport = SpeechClient.get_transport_class(transport_name)(
credentials=ga_credentials.AnonymousCredentials(),
)
assert transport.kind == transport_name


def test_transport_grpc_default():
# A client should use the gRPC transport by default.
client = SpeechClient(
Expand Down Expand Up @@ -1210,6 +1223,14 @@ def test_speech_base_transport():
with pytest.raises(NotImplementedError):
transport.operations_client

# Catch all for all remaining methods and properties
remainder = [
"kind",
]
for r in remainder:
with pytest.raises(NotImplementedError):
getattr(transport, r)()


def test_speech_base_transport_with_credentials_file():
# Instantiate the base transport with a credentials file
Expand Down
Loading

0 comments on commit 1e757fe

Please sign in to comment.