Skip to content

Commit 3ddc46d

Browse files
chore: [Many APIs] Update gapic-generator-python to v1.17.1 (#12636)
BEGIN_COMMIT_OVERRIDE chore: Update gapic-generator-python to v1.17.1 END_COMMIT_OVERRIDE - [ ] Regenerate this pull request now. PiperOrigin-RevId: 629071173 Source-Link: googleapis/googleapis@4afa392 Source-Link: googleapis/googleapis-gen@16dbbb4 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWF1dG9tbC8uT3dsQm90LnlhbWwiLCJoIjoiMTZkYmJiNGQwNDU3ZGI1ZTYxYWM5Zjk5YjBkNTJhNDYxNTQ0NTVhYyJ9 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWJhY2t1cGRyLy5Pd2xCb3QueWFtbCIsImgiOiIxNmRiYmI0ZDA0NTdkYjVlNjFhYzlmOTliMGQ1MmE0NjE1NDQ1NWFjIn0= Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWJhcmUtbWV0YWwtc29sdXRpb24vLk93bEJvdC55YW1sIiwiaCI6IjE2ZGJiYjRkMDQ1N2RiNWU2MWFjOWY5OWIwZDUyYTQ2MTU0NDU1YWMifQ== Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWJhdGNoLy5Pd2xCb3QueWFtbCIsImgiOiIxNmRiYmI0ZDA0NTdkYjVlNjFhYzlmOTliMGQ1MmE0NjE1NDQ1NWFjIn0= Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWJleW9uZGNvcnAtYXBwY29ubmVjdGlvbnMvLk93bEJvdC55YW1sIiwiaCI6IjE2ZGJiYjRkMDQ1N2RiNWU2MWFjOWY5OWIwZDUyYTQ2MTU0NDU1YWMifQ== Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWJleW9uZGNvcnAtYXBwY29ubmVjdG9ycy8uT3dsQm90LnlhbWwiLCJoIjoiMTZ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55YW1sIiwiaCI6IjE2ZGJiYjRkMDQ1N2RiNWU2MWFjOWY5OWIwZDUyYTQ2MTU0NDU1YWMifQ== Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWJpbmFyeS1hdXRob3JpemF0aW9uLy5Pd2xCb3QueWFtbCIsImgiOiIxNmRiYmI0ZDA0NTdkYjVlNjFhYzlmOTliMGQ1MmE0NjE1NDQ1NWFjIn0= --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: ohmayr <omairnaveed@ymail.com>
1 parent fd6e39c commit 3ddc46d

166 files changed

Lines changed: 45779 additions & 6174 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

packages/google-cloud-automl/google/cloud/automl_v1/services/auto_ml/async_client.py

Lines changed: 171 additions & 238 deletions
Large diffs are not rendered by default.

packages/google-cloud-automl/google/cloud/automl_v1/services/auto_ml/client.py

Lines changed: 90 additions & 114 deletions
Large diffs are not rendered by default.

packages/google-cloud-automl/google/cloud/automl_v1/services/auto_ml/transports/grpc.py

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def __init__(
6969
credentials: Optional[ga_credentials.Credentials] = None,
7070
credentials_file: Optional[str] = None,
7171
scopes: Optional[Sequence[str]] = None,
72-
channel: Optional[grpc.Channel] = None,
72+
channel: Optional[Union[grpc.Channel, Callable[..., grpc.Channel]]] = None,
7373
api_mtls_endpoint: Optional[str] = None,
7474
client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None,
7575
ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None,
@@ -89,14 +89,17 @@ def __init__(
8989
credentials identify the application to the service; if none
9090
are specified, the client will attempt to ascertain the
9191
credentials from the environment.
92-
This argument is ignored if ``channel`` is provided.
92+
This argument is ignored if a ``channel`` instance is provided.
9393
credentials_file (Optional[str]): A file with credentials that can
9494
be loaded with :func:`google.auth.load_credentials_from_file`.
95-
This argument is ignored if ``channel`` is provided.
95+
This argument is ignored if a ``channel`` instance is provided.
9696
scopes (Optional(Sequence[str])): A list of scopes. This argument is
97-
ignored if ``channel`` is provided.
98-
channel (Optional[grpc.Channel]): A ``Channel`` instance through
99-
which to make calls.
97+
ignored if a ``channel`` instance is provided.
98+
channel (Optional[Union[grpc.Channel, Callable[..., grpc.Channel]]]):
99+
A ``Channel`` instance through which to make calls, or a Callable
100+
that constructs and returns one. If set to None, ``self.create_channel``
101+
is used to create the channel. If a Callable is given, it will be called
102+
with the same arguments as used in ``self.create_channel``.
100103
api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint.
101104
If provided, it overrides the ``host`` argument and tries to create
102105
a mutual TLS channel with client SSL credentials from
@@ -106,11 +109,11 @@ def __init__(
106109
private key bytes, both in PEM format. It is ignored if
107110
``api_mtls_endpoint`` is None.
108111
ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials
109-
for the grpc channel. It is ignored if ``channel`` is provided.
112+
for the grpc channel. It is ignored if a ``channel`` instance is provided.
110113
client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]):
111114
A callback to provide client certificate bytes and private key bytes,
112115
both in PEM format. It is used to configure a mutual TLS channel. It is
113-
ignored if ``channel`` or ``ssl_channel_credentials`` is provided.
116+
ignored if a ``channel`` instance or ``ssl_channel_credentials`` is provided.
114117
quota_project_id (Optional[str]): An optional project to use for billing
115118
and quota.
116119
client_info (google.api_core.gapic_v1.client_info.ClientInfo):
@@ -137,7 +140,7 @@ def __init__(
137140
if client_cert_source:
138141
warnings.warn("client_cert_source is deprecated", DeprecationWarning)
139142

140-
if channel:
143+
if isinstance(channel, grpc.Channel):
141144
# Ignore credentials if a channel was passed.
142145
credentials = False
143146
# If a channel was explicitly provided, set it.
@@ -178,7 +181,9 @@ def __init__(
178181
)
179182

180183
if not self._grpc_channel:
181-
self._grpc_channel = type(self).create_channel(
184+
# initialize with the provided callable or the default channel
185+
channel_init = channel or type(self).create_channel
186+
self._grpc_channel = channel_init(
182187
self._host,
183188
# use the credentials which are saved
184189
credentials=self._credentials,

packages/google-cloud-automl/google/cloud/automl_v1/services/auto_ml/transports/grpc_asyncio.py

Lines changed: 201 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616
from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union
1717
import warnings
1818

19+
from google.api_core import exceptions as core_exceptions
1920
from google.api_core import gapic_v1, grpc_helpers_async, operations_v1
21+
from google.api_core import retry_async as retries
2022
from google.auth import credentials as ga_credentials # type: ignore
2123
from google.auth.transport.grpc import SslCredentials # type: ignore
2224
from google.longrunning import operations_pb2 # type: ignore
@@ -84,7 +86,6 @@ def create_channel(
8486
the credentials from the environment.
8587
credentials_file (Optional[str]): A file with credentials that can
8688
be loaded with :func:`google.auth.load_credentials_from_file`.
87-
This argument is ignored if ``channel`` is provided.
8889
scopes (Optional[Sequence[str]]): A optional list of scopes needed for this
8990
service. These are only used when credentials are not specified and
9091
are passed to :func:`google.auth.default`.
@@ -114,7 +115,7 @@ def __init__(
114115
credentials: Optional[ga_credentials.Credentials] = None,
115116
credentials_file: Optional[str] = None,
116117
scopes: Optional[Sequence[str]] = None,
117-
channel: Optional[aio.Channel] = None,
118+
channel: Optional[Union[aio.Channel, Callable[..., aio.Channel]]] = None,
118119
api_mtls_endpoint: Optional[str] = None,
119120
client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None,
120121
ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None,
@@ -134,15 +135,18 @@ def __init__(
134135
credentials identify the application to the service; if none
135136
are specified, the client will attempt to ascertain the
136137
credentials from the environment.
137-
This argument is ignored if ``channel`` is provided.
138+
This argument is ignored if a ``channel`` instance is provided.
138139
credentials_file (Optional[str]): A file with credentials that can
139140
be loaded with :func:`google.auth.load_credentials_from_file`.
140-
This argument is ignored if ``channel`` is provided.
141+
This argument is ignored if a ``channel`` instance is provided.
141142
scopes (Optional[Sequence[str]]): A optional list of scopes needed for this
142143
service. These are only used when credentials are not specified and
143144
are passed to :func:`google.auth.default`.
144-
channel (Optional[aio.Channel]): A ``Channel`` instance through
145-
which to make calls.
145+
channel (Optional[Union[aio.Channel, Callable[..., aio.Channel]]]):
146+
A ``Channel`` instance through which to make calls, or a Callable
147+
that constructs and returns one. If set to None, ``self.create_channel``
148+
is used to create the channel. If a Callable is given, it will be called
149+
with the same arguments as used in ``self.create_channel``.
146150
api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint.
147151
If provided, it overrides the ``host`` argument and tries to create
148152
a mutual TLS channel with client SSL credentials from
@@ -152,11 +156,11 @@ def __init__(
152156
private key bytes, both in PEM format. It is ignored if
153157
``api_mtls_endpoint`` is None.
154158
ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials
155-
for the grpc channel. It is ignored if ``channel`` is provided.
159+
for the grpc channel. It is ignored if a ``channel`` instance is provided.
156160
client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]):
157161
A callback to provide client certificate bytes and private key bytes,
158162
both in PEM format. It is used to configure a mutual TLS channel. It is
159-
ignored if ``channel`` or ``ssl_channel_credentials`` is provided.
163+
ignored if a ``channel`` instance or ``ssl_channel_credentials`` is provided.
160164
quota_project_id (Optional[str]): An optional project to use for billing
161165
and quota.
162166
client_info (google.api_core.gapic_v1.client_info.ClientInfo):
@@ -183,7 +187,7 @@ def __init__(
183187
if client_cert_source:
184188
warnings.warn("client_cert_source is deprecated", DeprecationWarning)
185189

186-
if channel:
190+
if isinstance(channel, aio.Channel):
187191
# Ignore credentials if a channel was passed.
188192
credentials = False
189193
# If a channel was explicitly provided, set it.
@@ -223,7 +227,9 @@ def __init__(
223227
)
224228

225229
if not self._grpc_channel:
226-
self._grpc_channel = type(self).create_channel(
230+
# initialize with the provided callable or the default channel
231+
channel_init = channel or type(self).create_channel
232+
self._grpc_channel = channel_init(
227233
self._host,
228234
# use the credentials which are saved
229235
credentials=self._credentials,
@@ -794,6 +800,191 @@ def list_model_evaluations(
794800
)
795801
return self._stubs["list_model_evaluations"]
796802

803+
def _prep_wrapped_messages(self, client_info):
804+
"""Precompute the wrapped methods, overriding the base class method to use async wrappers."""
805+
self._wrapped_methods = {
806+
self.create_dataset: gapic_v1.method_async.wrap_method(
807+
self.create_dataset,
808+
default_timeout=5.0,
809+
client_info=client_info,
810+
),
811+
self.get_dataset: gapic_v1.method_async.wrap_method(
812+
self.get_dataset,
813+
default_retry=retries.AsyncRetry(
814+
initial=0.1,
815+
maximum=60.0,
816+
multiplier=1.3,
817+
predicate=retries.if_exception_type(
818+
core_exceptions.DeadlineExceeded,
819+
core_exceptions.ServiceUnavailable,
820+
),
821+
deadline=5.0,
822+
),
823+
default_timeout=5.0,
824+
client_info=client_info,
825+
),
826+
self.list_datasets: gapic_v1.method_async.wrap_method(
827+
self.list_datasets,
828+
default_retry=retries.AsyncRetry(
829+
initial=0.1,
830+
maximum=60.0,
831+
multiplier=1.3,
832+
predicate=retries.if_exception_type(
833+
core_exceptions.DeadlineExceeded,
834+
core_exceptions.ServiceUnavailable,
835+
),
836+
deadline=5.0,
837+
),
838+
default_timeout=5.0,
839+
client_info=client_info,
840+
),
841+
self.update_dataset: gapic_v1.method_async.wrap_method(
842+
self.update_dataset,
843+
default_timeout=5.0,
844+
client_info=client_info,
845+
),
846+
self.delete_dataset: gapic_v1.method_async.wrap_method(
847+
self.delete_dataset,
848+
default_retry=retries.AsyncRetry(
849+
initial=0.1,
850+
maximum=60.0,
851+
multiplier=1.3,
852+
predicate=retries.if_exception_type(
853+
core_exceptions.DeadlineExceeded,
854+
core_exceptions.ServiceUnavailable,
855+
),
856+
deadline=5.0,
857+
),
858+
default_timeout=5.0,
859+
client_info=client_info,
860+
),
861+
self.import_data: gapic_v1.method_async.wrap_method(
862+
self.import_data,
863+
default_timeout=5.0,
864+
client_info=client_info,
865+
),
866+
self.export_data: gapic_v1.method_async.wrap_method(
867+
self.export_data,
868+
default_timeout=5.0,
869+
client_info=client_info,
870+
),
871+
self.get_annotation_spec: gapic_v1.method_async.wrap_method(
872+
self.get_annotation_spec,
873+
default_retry=retries.AsyncRetry(
874+
initial=0.1,
875+
maximum=60.0,
876+
multiplier=1.3,
877+
predicate=retries.if_exception_type(
878+
core_exceptions.DeadlineExceeded,
879+
core_exceptions.ServiceUnavailable,
880+
),
881+
deadline=5.0,
882+
),
883+
default_timeout=5.0,
884+
client_info=client_info,
885+
),
886+
self.create_model: gapic_v1.method_async.wrap_method(
887+
self.create_model,
888+
default_timeout=5.0,
889+
client_info=client_info,
890+
),
891+
self.get_model: gapic_v1.method_async.wrap_method(
892+
self.get_model,
893+
default_retry=retries.AsyncRetry(
894+
initial=0.1,
895+
maximum=60.0,
896+
multiplier=1.3,
897+
predicate=retries.if_exception_type(
898+
core_exceptions.DeadlineExceeded,
899+
core_exceptions.ServiceUnavailable,
900+
),
901+
deadline=5.0,
902+
),
903+
default_timeout=5.0,
904+
client_info=client_info,
905+
),
906+
self.list_models: gapic_v1.method_async.wrap_method(
907+
self.list_models,
908+
default_retry=retries.AsyncRetry(
909+
initial=0.1,
910+
maximum=60.0,
911+
multiplier=1.3,
912+
predicate=retries.if_exception_type(
913+
core_exceptions.DeadlineExceeded,
914+
core_exceptions.ServiceUnavailable,
915+
),
916+
deadline=5.0,
917+
),
918+
default_timeout=5.0,
919+
client_info=client_info,
920+
),
921+
self.delete_model: gapic_v1.method_async.wrap_method(
922+
self.delete_model,
923+
default_retry=retries.AsyncRetry(
924+
initial=0.1,
925+
maximum=60.0,
926+
multiplier=1.3,
927+
predicate=retries.if_exception_type(
928+
core_exceptions.DeadlineExceeded,
929+
core_exceptions.ServiceUnavailable,
930+
),
931+
deadline=5.0,
932+
),
933+
default_timeout=5.0,
934+
client_info=client_info,
935+
),
936+
self.update_model: gapic_v1.method_async.wrap_method(
937+
self.update_model,
938+
default_timeout=5.0,
939+
client_info=client_info,
940+
),
941+
self.deploy_model: gapic_v1.method_async.wrap_method(
942+
self.deploy_model,
943+
default_timeout=5.0,
944+
client_info=client_info,
945+
),
946+
self.undeploy_model: gapic_v1.method_async.wrap_method(
947+
self.undeploy_model,
948+
default_timeout=5.0,
949+
client_info=client_info,
950+
),
951+
self.export_model: gapic_v1.method_async.wrap_method(
952+
self.export_model,
953+
default_timeout=5.0,
954+
client_info=client_info,
955+
),
956+
self.get_model_evaluation: gapic_v1.method_async.wrap_method(
957+
self.get_model_evaluation,
958+
default_retry=retries.AsyncRetry(
959+
initial=0.1,
960+
maximum=60.0,
961+
multiplier=1.3,
962+
predicate=retries.if_exception_type(
963+
core_exceptions.DeadlineExceeded,
964+
core_exceptions.ServiceUnavailable,
965+
),
966+
deadline=5.0,
967+
),
968+
default_timeout=5.0,
969+
client_info=client_info,
970+
),
971+
self.list_model_evaluations: gapic_v1.method_async.wrap_method(
972+
self.list_model_evaluations,
973+
default_retry=retries.AsyncRetry(
974+
initial=0.1,
975+
maximum=60.0,
976+
multiplier=1.3,
977+
predicate=retries.if_exception_type(
978+
core_exceptions.DeadlineExceeded,
979+
core_exceptions.ServiceUnavailable,
980+
),
981+
deadline=5.0,
982+
),
983+
default_timeout=5.0,
984+
client_info=client_info,
985+
),
986+
}
987+
797988
def close(self):
798989
return self.grpc_channel.close()
799990

0 commit comments

Comments
 (0)