8000 chore: Use gapic-generator-python 0.65.0 (#283) · googleapis/google-cloud-python@2e903f9 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2e903f9

Browse files
chore: Use gapic-generator-python 0.65.0 (#283)
* 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>
1 parent 69a26a3 commit 2e903f9

File tree

10 files changed

+138
-42
lines changed

10 files changed

+138
-42
lines changed

packages/google-cloud-texttospeech/google/cloud/texttospeech_v1/services/text_to_speech/async_client.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
from collections import OrderedDict
1717
import functools
1818
import re
19-
from typing import Dict, Optional, Sequence, Tuple, Type, Union
19+
from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union
2020
import pkg_resources
2121

2222
from google.api_core.client_options import ClientOptions
@@ -306,7 +306,6 @@ async def synthesize_speech(
306306
r"""Synthesizes speech synchronously: receive results
307307
after all text input has been processed.
308308
309-
310309
.. code-block:: python
311310
312311
from google.cloud import texttospeech_v1

packages/google-cloud-texttospeech/google/cloud/texttospeech_v1/services/text_to_speech/client.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
from collections import OrderedDict
1717
import os
1818
import re
19-
from typing import Dict, Optional, Sequence, Tuple, Type, Union
19+
from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union
2020
import pkg_resources
2121

2222
from google.api_core import client_options as client_options_lib
@@ -532,7 +532,6 @@ def synthesize_speech(
532532
r"""Synthesizes speech synchronously: receive results
533533
after all text input has been processed.
534534
535-
536535
.. code-block:: python
537536
538537
from google.cloud import texttospeech_v1

packages/google-cloud-texttospeech/google/cloud/texttospeech_v1/services/text_to_speech/transports/base.py

Lines changed: 5 additions & 0 deletions
< 6D40 div data-testid="addition diffstat" class="DiffSquares-module__diffSquare--h5kjy DiffSquares-module__addition--jeNtt">
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ def __init__(
8080
always_use_jwt_access (Optional[bool]): Whether self signed JWT should
8181
be used for service account credentials.
8282
"""
83+
8384
# Save the hostname. Default to port 443 (HTTPS) if none is specified.
8485
if ":" not in host:
8586
host += ":443"
@@ -162,5 +163,9 @@ def synthesize_speech(
162163
]:
163164
raise NotImplementedError()
164165

166+
@property
167+
def kind(self) -> str:
168+
raise NotImplementedError()
169+
165170

166171
__all__ = ("TextToSpeechTransport",)

packages/google-cloud-texttospeech/google/cloud/texttospeech_v1/services/text_to_speech/transports/grpc.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,5 +285,9 @@ def synthesize_speech(
285285
def close(self):
286286
self.grpc_channel.close()
287287

288+
@property
289+
def kind(self) -> str:
290+
return "grpc"
291+
288292

289293
__all__ = ("TextToSpeechGrpcTransport",)

packages/google-cloud-texttospeech/google/cloud/texttospeech_v1beta1/services/text_to_speech/async_client.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
from collections import OrderedDict
1717
import functools
1818
import re
19-
from typing import Dict, Optional, Sequence, Tuple, Type, Union
19+
from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union
2020
import pkg_resources
2121

2222
from google.api_core.client_options import ClientOptions
@@ -306,7 +306,6 @@ async def synthesize_speech(
306306
r"""Synthesizes speech synchronously: receive results
307307
after all text input has been processed.
308308
309-
310309
.. code-block:: python
311310
312311
from google.cloud import texttospeech_v1beta1

packages/google-cloud-texttospeech/google/cloud/texttospeech_v1beta1/services/text_to_speech/client.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
from collections import OrderedDict
1717
import os
1818
import re
19-
from typing import Dict, Optional, Sequence, Tuple, Type, Union
19+
from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union
2020
import pkg_resources
2121

2222
from google.api_core import client_options as client_options_lib
@@ -532,7 +532,6 @@ def synthesize_speech(
532532
r"""Synthesizes speech synchronously: receive results
533533
after all text input has been processed.
534534
535-
536535
.. code-block:: python
537536
538537
from google.cloud import texttospeech_v1beta1

packages/google-cloud-texttospeech/google/cloud/texttospeech_v1beta1/services/text_to_speech/transports/base.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ def __init__(
8080
always_use_jwt_access (Optional[bool]): Whether self signed JWT should
8181
be used for service account credentials.
8282
"""
83+
8384
# Save the hostname. Default to port 443 (HTTPS) if none is specified.
8485
if ":" not in host:
8586
host += ":443"
@@ -162,5 +163,9 @@ def synthesize_speech(
162163
]:
163164
raise NotImplementedError()
164165

166+
@property
167+
def kind(self) -> str:
168+
raise NotImplementedError()
169+
165170

166171
__all__ = ("TextToSpeechTransport",)

packages/google-cloud-texttospeech/google/cloud/texttospeech_v1beta1/services/text_to_speech/transports/grpc.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,5 +285,9 @@ def synthesize_speech(
285285
def close(self):
286286
self.grpc_channel.close()
287287

288+
@property
289+
def kind(self) -> str:
290+
return "grpc"
291+
288292

289293
__all__ = ("TextToSpeechGrpcTransport",)

packages/google-cloud-texttospeech/tests/unit/gapic/texttospeech_v1/test_text_to_speech.py

Lines changed: 58 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -81,24 +81,24 @@ def test__get_default_mtls_endpoint():
8181

8282

8383
@pytest.mark.parametrize(
84-
"client_class",
84+
"client_class,transport_name",
8585
[
86-
TextToSpeechClient,
87-
TextToSpeechAsyncClient,
86+
(TextToSpeechClient, "grpc"),
87+
(TextToSpeechAsyncClient, "grpc_asyncio"),
8888
],
8989
)
90-
def test_text_to_speech_client_from_service_account_info(client_class):
90+
def test_text_to_speech_client_from_service_account_info(client_class, transport_name):
9191
creds = ga_credentials.AnonymousCredentials()
9292
with mock.patch.object(
9393
service_account.Credentials, "from_service_account_info"
9494
) as factory:
9595
factory.return_value = creds
9696
info = {"valid": True}
97-
client = client_class.from_service_account_info(info)
97+
client = client_class.from_service_account_info(info, transport=transport_name)
9898
assert client.transport._credentials == creds
9999
assert isinstance(client, client_class)
100100

101-
assert client.transport._host == "texttospeech.googleapis.com:443"
101+
assert client.transport._host == ("texttospeech.googleapis.com:443")
102102

103103

104104
@pytest.mark.parametrize(
@@ -127,27 +127,31 @@ def test_text_to_speech_client_service_account_always_use_jwt(
127127

128128

129129
@pytest.mark.parametrize(
130-
"client_class",
130+
"client_class,transport_name",
131131
[
132-
TextToSpeechClient,
133-
TextToSpeechAsyncClient,
132+
(TextToSpeechClient, "grpc"),
133+
(TextToSpeechAsyncClient, "grpc_asyncio"),
134134
],
135135
)
136-
def test_text_to_speech_client_from_service_account_file(client_class):
136+
def test_text_to_speech_client_from_service_account_file(client_class, transport_name):
137137
creds = ga_credentials.AnonymousCredentials()
138138
with mock.patch.object(
139139
service_account.Credentials, "from_service_account_file"
140140
) as factory:
141141
factory.return_value = creds
142-
client = client_class.from_service_account_file("dummy/file/path.json")
142+
client = client_class.from_service_account_file(
143+
"dummy/file/path.json", transport=transport_name
144+
)
143145
assert client.transport._credentials == creds
144146
assert isinstance(client, client_class)
145147

146-
client = client_class.from_service_account_json("dummy/file/path.json")
148+
client = client_class.from_service_account_json(
149+
"dummy/file/path.json", transport=transport_name
150+
)
147151
assert client.transport._credentials == creds
148152
assert isinstance(client, client_class)
149153

150-
assert client.transport._host == "texttospeech.googleapis.com:443"
154+
assert client.transport._host == ("texttospeech.googleapis.com:443")
151155

152156

153157
def test_text_to_speech_client_get_transport_class():
@@ -1096,6 +1100,19 @@ def test_transport_adc(transport_class):
10961100
adc.assert_called_once()
10971101

10981102

1103+
@pytest.mark.parametrize(
1104+
"transport_name",
1105+
[
1106+
"grpc",
1107+
],
1108+
)
1109+
def test_transport_kind(transport_name):
1110+
transport = TextToSpeechClient.get_transport_class(transport_name)(
1111+
credentials=ga_credentials.AnonymousCredentials(),
1112+
)
1113+
assert transport.kind == transport_name
1114+
1115+
10991116
def test_transport_grpc_default():
11001117
# A client should use the gRPC transport by default.
11011118
client = TextToSpeechClient(
@@ -1139,6 +1156,14 @@ def test_text_to_speech_base_transport():
11391156
with pytest.raises(NotImplementedError):
11401157
transport.close()
11411158

1159+
# Catch all for all remaining methods and properties
1160+
remainder = [
1161+
"kind",
1162+
]
1163+
for r in remainder:
1164+
with pytest.raises(NotImplementedError):
1165+
getattr(transport, r)()
1166+
11421167

11431168
def test_text_to_speech_base_transport_with_credentials_file():
11441169
# Instantiate the base transport with a credentials file
@@ -1281,24 +1306,40 @@ def test_text_to_speech_grpc_transport_client_cert_source_for_mtls(transport_cla
12811306
)
12821307

12831308

1284-
def test_text_to_speech_host_no_port():
1309+
@pytest.mark.parametrize(
1310+
"transport_name",
1311+
[
1312+
"grpc",
1313+
"grpc_asyncio",
1314+
],
1315+
)
1316+
def test_text_to_speech_host_no_port(transport_name):
12851317
client = TextToSpeechClient(
12861318
credentials=ga_credentials.AnonymousCredentials(),
12871319
client_options=client_options.ClientOptions(
12881320
api_endpoint="texttospeech.googleapis.com"
12891321
),
1322+
transport=transport_name,
12901323
)
1291-
assert client.transport._host == "texttospeech.googleapis.com:443"
1324+
assert client.transport._host == ("texttospeech.googleapis.com:443")
12921325

12931326

1294-
def test_text_to_speech_host_with_port():
1327+
@pytest.mark.parametrize(
1328+
"transport_name",
1329+
[
1330+
"grpc",
1331+
"grpc_asyncio",
1332+
],
1333+
)
1334+
def test_text_to_speech_host_with_port(transport_name):
12951335
client = TextToSpeechClient(
12961336
credentials=ga_credentials.AnonymousCredentials(),
12971337
client_options=client_options.ClientOptions(
12981338
api_endpoint="texttospeech.googleapis.com:8000"
12991339
),
1340+
transport=transport_name,
13001341
)
1301-
assert client.transport._host == "texttospeech.googleapis.com:8000"
1342+
assert client.transport._host == ("texttospeech.googleapis.com:8000")
13021343

13031344

13041345
def test_text_to_speech_grpc_transport_channel():

0 commit comments

Comments
 (0)
0