Skip to content

Commit 9bfb5f0

Browse files
fix(deps): Require google-api-core >=1.34.0, >=2.11.0 (#292)
* 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: googleapis/googleapis-gen@387b734 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 <[email protected]>
1 parent 6b62f3c commit 9bfb5f0

14 files changed

+113
-114
lines changed

packages/google-cloud-datalabeling/.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__ = "1.6.3" # {x-release-please-version}

packages/google-cloud-datalabeling/google/cloud/datalabeling_v1beta1/services/data_labeling_service/async_client.py

Lines changed: 45 additions & 49 deletions
Large diffs are not rendered by default.

packages/google-cloud-datalabeling/google/cloud/datalabeling_v1beta1/services/data_labeling_service/client.py

Lines changed: 39 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@
3838
from google.auth.transport import mtls # type: ignore
3939
from google.auth.transport.grpc import SslCredentials # type: ignore
4040
from google.oauth2 import service_account # type: ignore
41-
import pkg_resources
41+
42+
from google.cloud.datalabeling_v1beta1 import gapic_version as package_version
4243

4344
try:
4445
OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault]
@@ -611,7 +612,7 @@ def create_dataset(
611612
parent: Optional[str] = None,
612613
dataset: Optional[gcd_dataset.Dataset] = None,
613614
retry: OptionalRetry = gapic_v1.method.DEFAULT,
614-
timeout: Optional[float] = None,
615+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
615616
metadata: Sequence[Tuple[str, str]] = (),
616617
) -> gcd_dataset.Dataset:
617618
r"""Creates dataset. If success return a Dataset
@@ -722,7 +723,7 @@ def get_dataset(
722723
*,
723724
name: Optional[str] = None,
724725
retry: OptionalRetry = gapic_v1.method.DEFAULT,
725-
timeout: Optional[float] = None,
726+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
726727
metadata: Sequence[Tuple[str, str]] = (),
727728
) -> dataset.Dataset:
728729
r"""Gets dataset by resource name.
@@ -828,7 +829,7 @@ def list_datasets(
828829
parent: Optional[str] = None,
829830
filter: Optional[str] = None,
830831
retry: OptionalRetry = gapic_v1.method.DEFAULT,
831-
timeout: Optional[float] = None,
832+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
832833
metadata: Sequence[Tuple[str, str]] = (),
833834
) -> pagers.ListDatasetsPager:
834835
r"""Lists datasets under a project. Pagination is
@@ -954,7 +955,7 @@ def delete_dataset(
954955
*,
955956
name: Optional[str] = None,
956957
retry: OptionalRetry = gapic_v1.method.DEFAULT,
957-
timeout: Optional[float] = None,
958+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
958959
metadata: Sequence[Tuple[str, str]] = (),
959960
) -> None:
960961
r"""Deletes a dataset by resource name.
@@ -1044,7 +1045,7 @@ def import_data(
10441045
name: Optional[str] = None,
10451046
input_config: Optional[dataset.InputConfig] = None,
10461047
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1047-
timeout: Optional[float] = None,
1048+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
10481049
metadata: Sequence[Tuple[str, str]] = (),
10491050
) -> operation.Operation:
10501051
r"""Imports data into dataset based on source locations
@@ -1177,7 +1178,7 @@ def export_data(
11771178
filter: Optional[str] = None,
11781179
output_config: Optional[dataset.OutputConfig] = None,
11791180
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1180-
timeout: Optional[float] = None,
1181+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
11811182
metadata: Sequence[Tuple[str, str]] = (),
11821183
) -> operation.Operation:
11831184
r"""Exports data and annotations from dataset.
@@ -1324,7 +1325,7 @@ def get_data_item(
13241325
*,
13251326
name: Optional[str] = None,
13261327
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1327-
timeout: Optional[float] = None,
1328+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
13281329
metadata: Sequence[Tuple[str, str]] = (),
13291330
) -> dataset.DataItem:
13301331
r"""Gets a data item in a dataset by resource name. This
@@ -1429,7 +1430,7 @@ def list_data_items(
14291430
parent: Optional[str] = None,
14301431
filter: Optional[str] = None,
14311432
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1432-
timeout: Optional[float] = None,
1433+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
14331434
metadata: Sequence[Tuple[str, str]] = (),
14341435
) -> pagers.ListDataItemsPager:
14351436
r"""Lists data items in a dataset. This API can be called
@@ -1556,7 +1557,7 @@ def get_annotated_dataset(
15561557
*,
15571558
name: Optional[str] = None,
15581559
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1559-
timeout: Optional[float] = None,
1560+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
15601561
metadata: Sequence[Tuple[str, str]] = (),
15611562
) -> dataset.AnnotatedDataset:
15621563
r"""Gets an annotated dataset by resource name.
@@ -1665,7 +1666,7 @@ def list_annotated_datasets(
16651666
parent: Optional[str] = None,
16661667
filter: Optional[str] = None,
16671668
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1668-
timeout: Optional[float] = None,
1669+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
16691670
metadata: Sequence[Tuple[str, str]] = (),
16701671
) -> pagers.ListAnnotatedDatasetsPager:
16711672
r"""Lists annotated datasets for a dataset. Pagination is
@@ -1792,7 +1793,7 @@ def delete_annotated_dataset(
17921793
] = None,
17931794
*,
17941795
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1795-
timeout: Optional[float] = None,
1796+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
17961797
metadata: Sequence[Tuple[str, str]] = (),
17971798
) -> None:
17981799
r"""Deletes an annotated dataset by resource name.
@@ -1864,7 +1865,7 @@ def label_image(
18641865
basic_config: Optional[human_annotation_config.HumanAnnotationConfig] = None,
18651866
feature: Optional[data_labeling_service.LabelImageRequest.Feature] = None,
18661867
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1867-
timeout: Optional[float] = None,
1868+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
18681869
metadata: Sequence[Tuple[str, str]] = (),
18691870
) -> operation.Operation:
18701871
r"""Starts a labeling task for image. The type of image
@@ -2012,7 +2013,7 @@ def label_video(
20122013
basic_config: Optional[human_annotation_config.HumanAnnotationConfig] = None,
20132014
feature: Optional[data_labeling_service.LabelVideoRequest.Feature] = None,
20142015
retry: OptionalRetry = gapic_v1.method.DEFAULT,
2015-
timeout: Optional[float] = None,
2016+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
20162017
metadata: Sequence[Tuple[str, str]] = (),
20172018
) -> operation.Operation:
20182019
r"""Starts a labeling task for video. The type of video
@@ -2159,7 +2160,7 @@ def label_text(
21592160
basic_config: Optional[human_annotation_config.HumanAnnotationConfig] = None,
21602161
feature: Optional[data_labeling_service.LabelTextRequest.Feature] = None,
21612162
retry: OptionalRetry = gapic_v1.method.DEFAULT,
2162-
timeout: Optional[float] = None,
2163+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
21632164
metadata: Sequence[Tuple[str, str]] = (),
21642165
) -> operation.Operation:
21652166
r"""Starts a labeling task for text. The type of text
@@ -2305,7 +2306,7 @@ def get_example(
23052306
name: Optional[str] = None,
23062307
filter: Optional[str] = None,
23072308
retry: OptionalRetry = gapic_v1.method.DEFAULT,
2308-
timeout: Optional[float] = None,
2309+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
23092310
metadata: Sequence[Tuple[str, str]] = (),
23102311
) -> dataset.Example:
23112312
r"""Gets an example by resource name, including both data
@@ -2422,7 +2423,7 @@ def list_examples(
24222423
parent: Optional[str] = None,
24232424
filter: Optional[str] = None,
24242425
retry: OptionalRetry = gapic_v1.method.DEFAULT,
2425-
timeout: Optional[float] = None,
2426+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
24262427
metadata: Sequence[Tuple[str, str]] = (),
24272428
) -> pagers.ListExamplesPager:
24282429
r"""Lists examples in an annotated dataset. Pagination is
@@ -2549,7 +2550,7 @@ def create_annotation_spec_set(
25492550
parent: Optional[str] = None,
25502551
annotation_spec_set: Optional[gcd_annotation_spec_set.AnnotationSpecSet] = None,
25512552
retry: OptionalRetry = gapic_v1.method.DEFAULT,
2552-
timeout: Optional[float] = None,
2553+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
25532554
metadata: Sequence[Tuple[str, str]] = (),
25542555
) -> gcd_annotation_spec_set.AnnotationSpecSet:
25552556
r"""Creates an annotation spec set by providing a set of
@@ -2672,7 +2673,7 @@ def get_annotation_spec_set(
26722673
*,
26732674
name: Optional[str] = None,
26742675
retry: OptionalRetry = gapic_v1.method.DEFAULT,
2675-
timeout: Optional[float] = None,
2676+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
26762677
metadata: Sequence[Tuple[str, str]] = (),
26772678
) -> annotation_spec_set.AnnotationSpecSet:
26782679
r"""Gets an annotation spec set by resource name.
@@ -2781,7 +2782,7 @@ def list_annotation_spec_sets(
27812782
parent: Optional[str] = None,
27822783
filter: Optional[str] = None,
27832784
retry: OptionalRetry = gapic_v1.method.DEFAULT,
2784-
timeout: Optional[float] = None,
2785+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
27852786
metadata: Sequence[Tuple[str, str]] = (),
27862787
) -> pagers.ListAnnotationSpecSetsPager:
27872788
r"""Lists annotation spec sets for a project. Pagination
@@ -2910,7 +2911,7 @@ def delete_annotation_spec_set(
29102911
*,
29112912
name: Optional[str] = None,
29122913
retry: OptionalRetry = gapic_v1.method.DEFAULT,
2913-
timeout: Optional[float] = None,
2914+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
29142915
metadata: Sequence[Tuple[str, str]] = (),
29152916
) -> None:
29162917
r"""Deletes an annotation spec set by resource name.
@@ -3007,7 +3008,7 @@ def create_instruction(
30073008
parent: Optional[str] = None,
30083009
instruction: Optional[gcd_instruction.Instruction] = None,
30093010
retry: OptionalRetry = gapic_v1.method.DEFAULT,
3010-
timeout: Optional[float] = None,
3011+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
30113012
metadata: Sequence[Tuple[str, str]] = (),
30123013
) -> operation.Operation:
30133014
r"""Creates an instruction for how data should be
@@ -3135,7 +3136,7 @@ def get_instruction(
31353136
*,
31363137
name: Optional[str] = None,
31373138
retry: OptionalRetry = gapic_v1.method.DEFAULT,
3138-
timeout: Optional[float] = None,
3139+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
31393140
metadata: Sequence[Tuple[str, str]] = (),
31403141
) -> instruction.Instruction:
31413142
r"""Gets an instruction by resource name.
@@ -3241,7 +3242,7 @@ def list_instructions(
32413242
parent: Optional[str] = None,
32423243
filter: Optional[str] = None,
32433244
retry: OptionalRetry = gapic_v1.method.DEFAULT,
3244-
timeout: Optional[float] = None,
3245+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
32453246
metadata: Sequence[Tuple[str, str]] = (),
32463247
) -> pagers.ListInstructionsPager:
32473248
r"""Lists instructions for a project. Pagination is
@@ -3368,7 +3369,7 @@ def delete_instruction(
33683369
*,
33693370
name: Optional[str] = None,
33703371
retry: OptionalRetry = gapic_v1.method.DEFAULT,
3371-
timeout: Optional[float] = None,
3372+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
33723373
metadata: Sequence[Tuple[str, str]] = (),
33733374
) -> None:
33743375
r"""Deletes an instruction object by resource name.
@@ -3460,7 +3461,7 @@ def get_evaluation(
34603461
*,
34613462
name: Optional[str] = None,
34623463
retry: OptionalRetry = gapic_v1.method.DEFAULT,
3463-
timeout: Optional[float] = None,
3464+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
34643465
metadata: Sequence[Tuple[str, str]] = (),
34653466
) -> evaluation.Evaluation:
34663467
r"""Gets an evaluation by resource name (to search, use
@@ -3568,7 +3569,7 @@ def search_evaluations(
35683569
parent: Optional[str] = None,
35693570
filter: Optional[str] = None,
35703571
retry: OptionalRetry = gapic_v1.method.DEFAULT,
3571-
timeout: Optional[float] = None,
3572+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
35723573
metadata: Sequence[Tuple[str, str]] = (),
35733574
) -> pagers.SearchEvaluationsPager:
35743575
r"""Searches
@@ -3726,7 +3727,7 @@ def search_example_comparisons(
37263727
*,
37273728
parent: Optional[str] = None,
37283729
retry: OptionalRetry = gapic_v1.method.DEFAULT,
3729-
timeout: Optional[float] = None,
3730+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
37303731
metadata: Sequence[Tuple[str, str]] = (),
37313732
) -> pagers.SearchExampleComparisonsPager:
37323733
r"""Searches example comparisons from an evaluation. The
@@ -3854,7 +3855,7 @@ def create_evaluation_job(
38543855
parent: Optional[str] = None,
38553856
job: Optional[evaluation_job.EvaluationJob] = None,
38563857
retry: OptionalRetry = gapic_v1.method.DEFAULT,
3857-
timeout: Optional[float] = None,
3858+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
38583859
metadata: Sequence[Tuple[str, str]] = (),
38593860
) -> evaluation_job.EvaluationJob:
38603861
r"""Creates an evaluation job.
@@ -3972,7 +3973,7 @@ def update_evaluation_job(
39723973
evaluation_job: Optional[gcd_evaluation_job.EvaluationJob] = None,
39733974
update_mask: Optional[field_mask_pb2.FieldMask] = None,
39743975
retry: OptionalRetry = gapic_v1.method.DEFAULT,
3975-
timeout: Optional[float] = None,
3976+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
39763977
metadata: Sequence[Tuple[str, str]] = (),
39773978
) -> gcd_evaluation_job.EvaluationJob:
39783979
r"""Updates an evaluation job. You can only update certain fields of
@@ -4104,7 +4105,7 @@ def get_evaluation_job(
41044105
*,
41054106
name: Optional[str] = None,
41064107
retry: OptionalRetry = gapic_v1.method.DEFAULT,
4107-
timeout: Optional[float] = None,
4108+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
41084109
metadata: Sequence[Tuple[str, str]] = (),
41094110
) -> evaluation_job.EvaluationJob:
41104111
r"""Gets an evaluation job by resource name.
@@ -4213,7 +4214,7 @@ def pause_evaluation_job(
42134214
*,
42144215
name: Optional[str] = None,
42154216
retry: OptionalRetry = gapic_v1.method.DEFAULT,
4216-
timeout: Optional[float] = None,
4217+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
42174218
metadata: Sequence[Tuple[str, str]] = (),
42184219
) -> None:
42194220
r"""Pauses an evaluation job. Pausing an evaluation job that is
@@ -4308,7 +4309,7 @@ def resume_evaluation_job(
43084309
*,
43094310
name: Optional[str] = None,
43104311
retry: OptionalRetry = gapic_v1.method.DEFAULT,
4311-
timeout: Optional[float] = None,
4312+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
43124313
metadata: Sequence[Tuple[str, str]] = (),
43134314
) -> None:
43144315
r"""Resumes a paused evaluation job. A deleted evaluation
@@ -4403,7 +4404,7 @@ def delete_evaluation_job(
44034404
*,
44044405
name: Optional[str] = None,
44054406
retry: OptionalRetry = gapic_v1.method.DEFAULT,
4406-
timeout: Optional[float] = None,
4407+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
44074408
metadata: Sequence[Tuple[str, str]] = (),
44084409
) -> None:
44094410
r"""Stops and deletes an evaluation job.
@@ -4497,7 +4498,7 @@ def list_evaluation_jobs(
44974498
parent: Optional[str] = None,
44984499
filter: Optional[str] = None,
44994500
retry: OptionalRetry = gapic_v1.method.DEFAULT,
4500-
timeout: Optional[float] = None,
4501+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
45014502
metadata: Sequence[Tuple[str, str]] = (),
45024503
) -> pagers.ListEvaluationJobsPager:
45034504
r"""Lists all evaluation jobs within a project with
@@ -4637,14 +4638,9 @@ def __exit__(self, type, value, traceback):
46374638
self.transport.close()
46384639

46394640

4640-
try:
4641-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
4642-
gapic_version=pkg_resources.get_distribution(
4643-
"google-cloud-datalabeling",
4644-
).version,
4645-
)
4646-
except pkg_resources.DistributionNotFound:
4647-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
4641+
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
4642+
gapic_version=package_version.__version__
4643+
)
46484644

46494645

46504646
__all__ = ("DataLabelingServiceClient",)

packages/google-cloud-datalabeling/google/cloud/datalabeling_v1beta1/services/data_labeling_service/transports/base.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
from google.longrunning import operations_pb2 # type: ignore
2626
from google.oauth2 import service_account # type: ignore
2727
from google.protobuf import empty_pb2 # type: ignore
28-
import pkg_resources
2928

29+
from google.cloud.datalabeling_v1beta1 import gapic_version as package_version
3030
from google.cloud.datalabeling_v1beta1.types import (
3131
annotation_spec_set as gcd_annotation_spec_set,
3232
)
@@ -39,14 +39,9 @@
3939
from google.cloud.datalabeling_v1beta1.types import evaluation_job
4040
from google.cloud.datalabeling_v1beta1.types import instruction
4141

42-
try:
43-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
44-
gapic_version=pkg_resources.get_distribution(
45-
"google-cloud-datalabeling",
46-
).version,
47-
)
48-
except pkg_resources.DistributionNotFound:
49-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
42+
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
43+
gapic_version=package_version.__version__
44+
)
5045

5146

5247
class DataLabelingServiceTransport(abc.ABC):

packages/google-cloud-datalabeling/release-please-config.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
".": {
55
"release-type": "python",
66
"extra-files": [
7+
"google/cloud/datalabeling_v1beta1/gapic_version.py",
78
"google/cloud/datalabeling/gapic_version.py",
89
{
910
"type": "json",

0 commit comments

Comments
 (0)