Skip to content
This repository was archived by the owner on Dec 31, 2023. It is now read-only.

Commit ad2a2d7

Browse files
fix(deps): Require google-api-core >=1.34.0, >=2.11.0 (#457)
* fix(deps): Require google-api-core >=1.34.0, >=2.11.0 fix: Drop usage of pkg_resources fix: Fix timeout default values docs(samples): Snippetgen should call await on the operation coroutine before calling result PiperOrigin-RevId: 493260409 Source-Link: googleapis/googleapis@fea4387 Source-Link: https://github.com/googleapis/googleapis-gen/commit/387b7344c7529ee44be84e613b19a820508c612b Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMzg3YjczNDRjNzUyOWVlNDRiZTg0ZTYxM2IxOWE4MjA1MDhjNjEyYiJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * add gapic_version.py Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Anthonios Partheniou <partheniou@google.com>
1 parent ea81cb4 commit ad2a2d7

File tree

36 files changed

+226
-245
lines changed

36 files changed

+226
-245
lines changed

.coveragerc

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,3 @@ exclude_lines =
1010
pragma: NO COVER
1111
# Ignore debug-only repr
1212
def __repr__
13-
# Ignore pkg_resources exceptions.
14-
# This is added at the module level as a safeguard for if someone
15-
# generates the code and tries to run it without pip installing. This
16-
# makes it virtually impossible to test properly.
17-
except pkg_resources.DistributionNotFound
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# -*- coding: utf-8 -*-
2+
# Copyright 2022 Google LLC
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
__version__ = "2.8.3" # {x-release-please-version}

google/cloud/automl_v1/services/auto_ml/async_client.py

Lines changed: 32 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@
2727
Type,
2828
Union,
2929
)
30-
import pkg_resources
30+
31+
from google.cloud.automl_v1 import gapic_version as package_version
3132

3233
from google.api_core.client_options import ClientOptions
3334
from google.api_core import exceptions as core_exceptions
@@ -250,7 +251,7 @@ async def create_dataset(
250251
parent: Optional[str] = None,
251252
dataset: Optional[gca_dataset.Dataset] = None,
252253
retry: OptionalRetry = gapic_v1.method.DEFAULT,
253-
timeout: Optional[float] = None,
254+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
254255
metadata: Sequence[Tuple[str, str]] = (),
255256
) -> operation_async.AsyncOperation:
256257
r"""Creates a dataset.
@@ -285,7 +286,7 @@ async def sample_create_dataset():
285286
286287
print("Waiting for operation to complete...")
287288
288-
response = await operation.result()
289+
response = (await operation).result()
289290
290291
# Handle the response
291292
print(response)
@@ -378,7 +379,7 @@ async def get_dataset(
378379
*,
379380
name: Optional[str] = None,
380381
retry: OptionalRetry = gapic_v1.method.DEFAULT,
381-
timeout: Optional[float] = None,
382+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
382383
metadata: Sequence[Tuple[str, str]] = (),
383384
) -> dataset.Dataset:
384385
r"""Gets a dataset.
@@ -492,7 +493,7 @@ async def list_datasets(
492493
*,
493494
parent: Optional[str] = None,
494495
retry: OptionalRetry = gapic_v1.method.DEFAULT,
495-
timeout: Optional[float] = None,
496+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
496497
metadata: Sequence[Tuple[str, str]] = (),
497498
) -> pagers.ListDatasetsAsyncPager:
498499
r"""Lists datasets in a project.
@@ -618,7 +619,7 @@ async def update_dataset(
618619
dataset: Optional[gca_dataset.Dataset] = None,
619620
update_mask: Optional[field_mask_pb2.FieldMask] = None,
620621
retry: OptionalRetry = gapic_v1.method.DEFAULT,
621-
timeout: Optional[float] = None,
622+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
622623
metadata: Sequence[Tuple[str, str]] = (),
623624
) -> gca_dataset.Dataset:
624625
r"""Updates a dataset.
@@ -737,7 +738,7 @@ async def delete_dataset(
737738
*,
738739
name: Optional[str] = None,
739740
retry: OptionalRetry = gapic_v1.method.DEFAULT,
740-
timeout: Optional[float] = None,
741+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
741742
metadata: Sequence[Tuple[str, str]] = (),
742743
) -> operation_async.AsyncOperation:
743744
r"""Deletes a dataset and all of its contents. Returns empty
@@ -771,7 +772,7 @@ async def sample_delete_dataset():
771772
772773
print("Waiting for operation to complete...")
773774
774-
response = await operation.result()
775+
response = (await operation).result()
775776
776777
# Handle the response
777778
print(response)
@@ -876,7 +877,7 @@ async def import_data(
876877
name: Optional[str] = None,
877878
input_config: Optional[io.InputConfig] = None,
878879
retry: OptionalRetry = gapic_v1.method.DEFAULT,
879-
timeout: Optional[float] = None,
880+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
880881
metadata: Sequence[Tuple[str, str]] = (),
881882
) -> operation_async.AsyncOperation:
882883
r"""Imports data into a dataset. For Tables this method can only be
@@ -919,7 +920,7 @@ async def sample_import_data():
919920
920921
print("Waiting for operation to complete...")
921922
922-
response = await operation.result()
923+
response = (await operation).result()
923924
924925
# Handle the response
925926
print(response)
@@ -1025,7 +1026,7 @@ async def export_data(
10251026
name: Optional[str] = None,
10261027
output_config: Optional[io.OutputConfig] = None,
10271028
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1028-
timeout: Optional[float] = None,
1029+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
10291030
metadata: Sequence[Tuple[str, str]] = (),
10301031
) -> operation_async.AsyncOperation:
10311032
r"""Exports dataset's data to the provided output location. Returns
@@ -1062,7 +1063,7 @@ async def sample_export_data():
10621063
10631064
print("Waiting for operation to complete...")
10641065
1065-
response = await operation.result()
1066+
response = (await operation).result()
10661067
10671068
# Handle the response
10681069
print(response)
@@ -1165,7 +1166,7 @@ async def get_annotation_spec(
11651166
*,
11661167
name: Optional[str] = None,
11671168
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1168-
timeout: Optional[float] = None,
1169+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
11691170
metadata: Sequence[Tuple[str, str]] = (),
11701171
) -> annotation_spec.AnnotationSpec:
11711172
r"""Gets an annotation spec.
@@ -1276,7 +1277,7 @@ async def create_model(
12761277
parent: Optional[str] = None,
12771278
model: Optional[gca_model.Model] = None,
12781279
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1279-
timeout: Optional[float] = None,
1280+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
12801281
metadata: Sequence[Tuple[str, str]] = (),
12811282
) -> operation_async.AsyncOperation:
12821283
r"""Creates a model. Returns a Model in the
@@ -1310,7 +1311,7 @@ async def sample_create_model():
13101311
13111312
print("Waiting for operation to complete...")
13121313
1313-
response = await operation.result()
1314+
response = (await operation).result()
13141315
13151316
# Handle the response
13161317
print(response)
@@ -1405,7 +1406,7 @@ async def get_model(
14051406
*,
14061407
name: Optional[str] = None,
14071408
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1408-
timeout: Optional[float] = None,
1409+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
14091410
metadata: Sequence[Tuple[str, str]] = (),
14101411
) -> model.Model:
14111412
r"""Gets a model.
@@ -1515,7 +1516,7 @@ async def list_models(
15151516
*,
15161517
parent: Optional[str] = None,
15171518
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1518-
timeout: Optional[float] = None,
1519+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
15191520
metadata: Sequence[Tuple[str, str]] = (),
15201521
) -> pagers.ListModelsAsyncPager:
15211522
r"""Lists models.
@@ -1640,7 +1641,7 @@ async def delete_model(
16401641
*,
16411642
name: Optional[str] = None,
16421643
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1643-
timeout: Optional[float] = None,
1644+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
16441645
metadata: Sequence[Tuple[str, str]] = (),
16451646
) -> operation_async.AsyncOperation:
16461647
r"""Deletes a model. Returns ``google.protobuf.Empty`` in the
@@ -1673,7 +1674,7 @@ async def sample_delete_model():
16731674
16741675
print("Waiting for operation to complete...")
16751676
1676-
response = await operation.result()
1677+
response = (await operation).result()
16771678
16781679
# Handle the response
16791680
print(response)
@@ -1778,7 +1779,7 @@ async def update_model(
17781779
model: Optional[gca_model.Model] = None,
17791780
update_mask: Optional[field_mask_pb2.FieldMask] = None,
17801781
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1781-
timeout: Optional[float] = None,
1782+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
17821783
metadata: Sequence[Tuple[str, str]] = (),
17831784
) -> gca_model.Model:
17841785
r"""Updates a model.
@@ -1890,7 +1891,7 @@ async def deploy_model(
18901891
*,
18911892
name: Optional[str] = None,
18921893
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1893-
timeout: Optional[float] = None,
1894+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
18941895
metadata: Sequence[Tuple[str, str]] = (),
18951896
) -> operation_async.AsyncOperation:
18961897
r"""Deploys a model. If a model is already deployed, deploying it
@@ -1933,7 +1934,7 @@ async def sample_deploy_model():
19331934
19341935
print("Waiting for operation to complete...")
19351936
1936-
response = await operation.result()
1937+
response = (await operation).result()
19371938
19381939
# Handle the response
19391940
print(response)
@@ -2027,7 +2028,7 @@ async def undeploy_model(
20272028
*,
20282029
name: Optional[str] = None,
20292030
retry: OptionalRetry = gapic_v1.method.DEFAULT,
2030-
timeout: Optional[float] = None,
2031+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
20312032
metadata: Sequence[Tuple[str, str]] = (),
20322033
) -> operation_async.AsyncOperation:
20332034
r"""Undeploys a model. If the model is not deployed this method has
@@ -2065,7 +2066,7 @@ async def sample_undeploy_model():
20652066
20662067
print("Waiting for operation to complete...")
20672068
2068-
response = await operation.result()
2069+
response = (await operation).result()
20692070
20702071
# Handle the response
20712072
print(response)
@@ -2160,7 +2161,7 @@ async def export_model(
21602161
name: Optional[str] = None,
21612162
output_config: Optional[io.ModelExportOutputConfig] = None,
21622163
retry: OptionalRetry = gapic_v1.method.DEFAULT,
2163-
timeout: Optional[float] = None,
2164+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
21642165
metadata: Sequence[Tuple[str, str]] = (),
21652166
) -> operation_async.AsyncOperation:
21662167
r"""Exports a trained, "export-able", model to a user specified
@@ -2201,7 +2202,7 @@ async def sample_export_model():
22012202
22022203
print("Waiting for operation to complete...")
22032204
2204-
response = await operation.result()
2205+
response = (await operation).result()
22052206
22062207
# Handle the response
22072208
print(response)
@@ -2306,7 +2307,7 @@ async def get_model_evaluation(
23062307
*,
23072308
name: Optional[str] = None,
23082309
retry: OptionalRetry = gapic_v1.method.DEFAULT,
2309-
timeout: Optional[float] = None,
2310+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
23102311
metadata: Sequence[Tuple[str, str]] = (),
23112312
) -> model_evaluation.ModelEvaluation:
23122313
r"""Gets a model evaluation.
@@ -2417,7 +2418,7 @@ async def list_model_evaluations(
24172418
parent: Optional[str] = None,
24182419
filter: Optional[str] = None,
24192420
retry: OptionalRetry = gapic_v1.method.DEFAULT,
2420-
timeout: Optional[float] = None,
2421+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
24212422
metadata: Sequence[Tuple[str, str]] = (),
24222423
) -> pagers.ListModelEvaluationsAsyncPager:
24232424
r"""Lists model evaluations.
@@ -2567,14 +2568,9 @@ async def __aexit__(self, exc_type, exc, tb):
25672568
await self.transport.close()
25682569

25692570

2570-
try:
2571-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
2572-
gapic_version=pkg_resources.get_distribution(
2573-
"google-cloud-automl",
2574-
).version,
2575-
)
2576-
except pkg_resources.DistributionNotFound:
2577-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
2571+
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
2572+
gapic_version=package_version.__version__
2573+
)
25782574

25792575

25802576
__all__ = ("AutoMlAsyncClient",)

0 commit comments

Comments
 (0)