27
27
Type ,
28
28
Union ,
29
29
)
30
- import pkg_resources
30
+
31
+ from google .cloud .automl_v1 import gapic_version as package_version
31
32
32
33
from google .api_core .client_options import ClientOptions
33
34
from google .api_core import exceptions as core_exceptions
@@ -250,7 +251,7 @@ async def create_dataset(
250
251
parent : Optional [str ] = None ,
251
252
dataset : Optional [gca_dataset .Dataset ] = None ,
252
253
retry : OptionalRetry = gapic_v1 .method .DEFAULT ,
253
- timeout : Optional [float ] = None ,
254
+ timeout : Union [float , object ] = gapic_v1 . method . DEFAULT ,
254
255
metadata : Sequence [Tuple [str , str ]] = (),
255
256
) -> operation_async .AsyncOperation :
256
257
r"""Creates a dataset.
@@ -285,7 +286,7 @@ async def sample_create_dataset():
285
286
286
287
print("Waiting for operation to complete...")
287
288
288
- response = await operation.result()
289
+ response = ( await operation) .result()
289
290
290
291
# Handle the response
291
292
print(response)
@@ -378,7 +379,7 @@ async def get_dataset(
378
379
* ,
379
380
name : Optional [str ] = None ,
380
381
retry : OptionalRetry = gapic_v1 .method .DEFAULT ,
381
- timeout : Optional [float ] = None ,
382
+ timeout : Union [float , object ] = gapic_v1 . method . DEFAULT ,
382
383
metadata : Sequence [Tuple [str , str ]] = (),
383
384
) -> dataset .Dataset :
384
385
r"""Gets a dataset.
@@ -492,7 +493,7 @@ async def list_datasets(
492
493
* ,
493
494
parent : Optional [str ] = None ,
494
495
retry : OptionalRetry = gapic_v1 .method .DEFAULT ,
495
- timeout : Optional [float ] = None ,
496
+ timeout : Union [float , object ] = gapic_v1 . method . DEFAULT ,
496
497
metadata : Sequence [Tuple [str , str ]] = (),
497
498
) -> pagers .ListDatasetsAsyncPager :
498
499
r"""Lists datasets in a project.
@@ -618,7 +619,7 @@ async def update_dataset(
618
619
dataset : Optional [gca_dataset .Dataset ] = None ,
619
620
update_mask : Optional [field_mask_pb2 .FieldMask ] = None ,
620
621
retry : OptionalRetry = gapic_v1 .method .DEFAULT ,
621
- timeout : Optional [float ] = None ,
622
+ timeout : Union [float , object ] = gapic_v1 . method . DEFAULT ,
622
623
metadata : Sequence [Tuple [str , str ]] = (),
623
624
) -> gca_dataset .Dataset :
624
625
r"""Updates a dataset.
@@ -737,7 +738,7 @@ async def delete_dataset(
737
738
* ,
738
739
name : Optional [str ] = None ,
739
740
retry : OptionalRetry = gapic_v1 .method .DEFAULT ,
740
- timeout : Optional [float ] = None ,
741
+ timeout : Union [float , object ] = gapic_v1 . method . DEFAULT ,
741
742
metadata : Sequence [Tuple [str , str ]] = (),
742
743
) -> operation_async .AsyncOperation :
743
744
r"""Deletes a dataset and all of its contents. Returns empty
@@ -771,7 +772,7 @@ async def sample_delete_dataset():
771
772
772
773
print("Waiting for operation to complete...")
773
774
774
- response = await operation.result()
775
+ response = ( await operation) .result()
775
776
776
777
# Handle the response
777
778
print(response)
@@ -876,7 +877,7 @@ async def import_data(
876
877
name : Optional [str ] = None ,
877
878
input_config : Optional [io .InputConfig ] = None ,
878
879
retry : OptionalRetry = gapic_v1 .method .DEFAULT ,
879
- timeout : Optional [float ] = None ,
880
+ timeout : Union [float , object ] = gapic_v1 . method . DEFAULT ,
880
881
metadata : Sequence [Tuple [str , str ]] = (),
881
882
) -> operation_async .AsyncOperation :
882
883
r"""Imports data into a dataset. For Tables this method can only be
@@ -919,7 +920,7 @@ async def sample_import_data():
919
920
920
921
print("Waiting for operation to complete...")
921
922
922
- response = await operation.result()
923
+ response = ( await operation) .result()
923
924
924
925
# Handle the response
925
926
print(response)
@@ -1025,7 +1026,7 @@ async def export_data(
1025
1026
name : Optional [str ] = None ,
1026
1027
output_config : Optional [io .OutputConfig ] = None ,
1027
1028
retry : OptionalRetry = gapic_v1 .method .DEFAULT ,
1028
- timeout : Optional [float ] = None ,
1029
+ timeout : Union [float , object ] = gapic_v1 . method . DEFAULT ,
1029
1030
metadata : Sequence [Tuple [str , str ]] = (),
1030
1031
) -> operation_async .AsyncOperation :
1031
1032
r"""Exports dataset's data to the provided output location. Returns
@@ -1062,7 +1063,7 @@ async def sample_export_data():
1062
1063
1063
1064
print("Waiting for operation to complete...")
1064
1065
1065
- response = await operation.result()
1066
+ response = ( await operation) .result()
1066
1067
1067
1068
# Handle the response
1068
1069
print(response)
@@ -1165,7 +1166,7 @@ async def get_annotation_spec(
1165
1166
* ,
1166
1167
name : Optional [str ] = None ,
1167
1168
retry : OptionalRetry = gapic_v1 .method .DEFAULT ,
1168
- timeout : Optional [float ] = None ,
1169
+ timeout : Union [float , object ] = gapic_v1 . method . DEFAULT ,
1169
1170
metadata : Sequence [Tuple [str , str ]] = (),
1170
1171
) -> annotation_spec .AnnotationSpec :
1171
1172
r"""Gets an annotation spec.
@@ -1276,7 +1277,7 @@ async def create_model(
1276
1277
parent : Optional [str ] = None ,
1277
1278
model : Optional [gca_model .Model ] = None ,
1278
1279
retry : OptionalRetry = gapic_v1 .method .DEFAULT ,
1279
- timeout : Optional [float ] = None ,
1280
+ timeout : Union [float , object ] = gapic_v1 . method . DEFAULT ,
1280
1281
metadata : Sequence [Tuple [str , str ]] = (),
1281
1282
) -> operation_async .AsyncOperation :
1282
1283
r"""Creates a model. Returns a Model in the
@@ -1310,7 +1311,7 @@ async def sample_create_model():
1310
1311
1311
1312
print("Waiting for operation to complete...")
1312
1313
1313
- response = await operation.result()
1314
+ response = ( await operation) .result()
1314
1315
1315
1316
# Handle the response
1316
1317
print(response)
@@ -1405,7 +1406,7 @@ async def get_model(
1405
1406
* ,
1406
1407
name : Optional [str ] = None ,
1407
1408
retry : OptionalRetry = gapic_v1 .method .DEFAULT ,
1408
- timeout : Optional [float ] = None ,
1409
+ timeout : Union [float , object ] = gapic_v1 . method . DEFAULT ,
1409
1410
metadata : Sequence [Tuple [str , str ]] = (),
1410
1411
) -> model .Model :
1411
1412
r"""Gets a model.
@@ -1515,7 +1516,7 @@ async def list_models(
1515
1516
* ,
1516
1517
parent : Optional [str ] = None ,
1517
1518
retry : OptionalRetry = gapic_v1 .method .DEFAULT ,
1518
- timeout : Optional [float ] = None ,
1519
+ timeout : Union [float , object ] = gapic_v1 . method . DEFAULT ,
1519
1520
metadata : Sequence [Tuple [str , str ]] = (),
1520
1521
) -> pagers .ListModelsAsyncPager :
1521
1522
r"""Lists models.
@@ -1640,7 +1641,7 @@ async def delete_model(
1640
1641
* ,
1641
1642
name : Optional [str ] = None ,
1642
1643
retry : OptionalRetry = gapic_v1 .method .DEFAULT ,
1643
- timeout : Optional [float ] = None ,
1644
+ timeout : Union [float , object ] = gapic_v1 . method . DEFAULT ,
1644
1645
metadata : Sequence [Tuple [str , str ]] = (),
1645
1646
) -> operation_async .AsyncOperation :
1646
1647
r"""Deletes a model. Returns ``google.protobuf.Empty`` in the
@@ -1673,7 +1674,7 @@ async def sample_delete_model():
1673
1674
1674
1675
print("Waiting for operation to complete...")
1675
1676
1676
- response = await operation.result()
1677
+ response = ( await operation) .result()
1677
1678
1678
1679
# Handle the response
1679
1680
print(response)
@@ -1778,7 +1779,7 @@ async def update_model(
1778
1779
model : Optional [gca_model .Model ] = None ,
1779
1780
update_mask : Optional [field_mask_pb2 .FieldMask ] = None ,
1780
1781
retry : OptionalRetry = gapic_v1 .method .DEFAULT ,
1781
- timeout : Optional [float ] = None ,
1782
+ timeout : Union [float , object ] = gapic_v1 . method . DEFAULT ,
1782
1783
metadata : Sequence [Tuple [str , str ]] = (),
1783
1784
) -> gca_model .Model :
1784
1785
r"""Updates a model.
@@ -1890,7 +1891,7 @@ async def deploy_model(
1890
1891
* ,
1891
1892
name : Optional [str ] = None ,
1892
1893
retry : OptionalRetry = gapic_v1 .method .DEFAULT ,
1893
- timeout : Optional [float ] = None ,
1894
+ timeout : Union [float , object ] = gapic_v1 . method . DEFAULT ,
1894
1895
metadata : Sequence [Tuple [str , str ]] = (),
1895
1896
) -> operation_async .AsyncOperation :
1896
1897
r"""Deploys a model. If a model is already deployed, deploying it
@@ -1933,7 +1934,7 @@ async def sample_deploy_model():
1933
1934
1934
1935
print("Waiting for operation to complete...")
1935
1936
1936
- response = await operation.result()
1937
+ response = ( await operation) .result()
1937
1938
1938
1939
# Handle the response
1939
1940
print(response)
@@ -2027,7 +2028,7 @@ async def undeploy_model(
2027
2028
* ,
2028
2029
name : Optional [str ] = None ,
2029
2030
retry : OptionalRetry = gapic_v1 .method .DEFAULT ,
2030
- timeout : Optional [float ] = None ,
2031
+ timeout : Union [float , object ] = gapic_v1 . method . DEFAULT ,
2031
2032
metadata : Sequence [Tuple [str , str ]] = (),
2032
2033
) -> operation_async .AsyncOperation :
2033
2034
r"""Undeploys a model. If the model is not deployed this method has
@@ -2065,7 +2066,7 @@ async def sample_undeploy_model():
2065
2066
2066
2067
print("Waiting for operation to complete...")
2067
2068
2068
- response = await operation.result()
2069
+ response = ( await operation) .result()
2069
2070
2070
2071
# Handle the response
2071
2072
print(response)
@@ -2160,7 +2161,7 @@ async def export_model(
2160
2161
name : Optional [str ] = None ,
2161
2162
output_config : Optional [io .ModelExportOutputConfig ] = None ,
2162
2163
retry : OptionalRetry = gapic_v1 .method .DEFAULT ,
2163
- timeout : Optional [float ] = None ,
2164
+ timeout : Union [float , object ] = gapic_v1 . method . DEFAULT ,
2164
2165
metadata : Sequence [Tuple [str , str ]] = (),
2165
2166
) -> operation_async .AsyncOperation :
2166
2167
r"""Exports a trained, "export-able", model to a user specified
@@ -2201,7 +2202,7 @@ async def sample_export_model():
2201
2202
2202
2203
print("Waiting for operation to complete...")
2203
2204
2204
- response = await operation.result()
2205
+ response = ( await operation) .result()
2205
2206
2206
2207
# Handle the response
2207
2208
print(response)
@@ -2306,7 +2307,7 @@ async def get_model_evaluation(
2306
2307
* ,
2307
2308
name : Optional [str ] = None ,
2308
2309
retry : OptionalRetry = gapic_v1 .method .DEFAULT ,
2309
- timeout : Optional [float ] = None ,
2310
+ timeout : Union [float , object ] = gapic_v1 . method . DEFAULT ,
2310
2311
metadata : Sequence [Tuple [str , str ]] = (),
2311
2312
) -> model_evaluation .ModelEvaluation :
2312
2313
r"""Gets a model evaluation.
@@ -2417,7 +2418,7 @@ async def list_model_evaluations(
2417
2418
parent : Optional [str ] = None ,
2418
2419
filter : Optional [str ] = None ,
2419
2420
retry : OptionalRetry = gapic_v1 .method .DEFAULT ,
2420
- timeout : Optional [float ] = None ,
2421
+ timeout : Union [float , object ] = gapic_v1 . method . DEFAULT ,
2421
2422
metadata : Sequence [Tuple [str , str ]] = (),
2422
2423
) -> pagers .ListModelEvaluationsAsyncPager :
2423
2424
r"""Lists model evaluations.
@@ -2567,14 +2568,9 @@ async def __aexit__(self, exc_type, exc, tb):
2567
2568
await self .transport .close ()
2568
2569
2569
2570
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
+ )
2578
2574
2579
2575
2580
2576
__all__ = ("AutoMlAsyncClient" ,)
0 commit comments