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

Commit 9b9083c

Browse files
fix(deps): Require google-api-core >=1.34.0, >=2.11.0 (#160)
* 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 <[email protected]>
1 parent 153af10 commit 9b9083c

File tree

23 files changed

+139
-205
lines changed

23 files changed

+139
-205
lines changed

.coveragerc

-5
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
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__ = "0.6.2" # {x-release-please-version}

google/cloud/dataflow_v1beta3/services/flex_templates_service/async_client.py

+6-10
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@
3434
from google.api_core.client_options import ClientOptions
3535
from google.auth import credentials as ga_credentials # type: ignore
3636
from google.oauth2 import service_account # type: ignore
37-
import pkg_resources
37+
38+
from google.cloud.dataflow_v1beta3 import gapic_version as package_version
3839

3940
try:
4041
OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault]
@@ -218,7 +219,7 @@ async def launch_flex_template(
218219
request: Optional[Union[templates.LaunchFlexTemplateRequest, dict]] = None,
219220
*,
220221
retry: OptionalRetry = gapic_v1.method.DEFAULT,
221-
timeout: Optional[float] = None,
222+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
222223
metadata: Sequence[Tuple[str, str]] = (),
223224
) -> templates.LaunchFlexTemplateResponse:
224225
r"""Launch a job with a FlexTemplate.
@@ -304,14 +305,9 @@ async def __aexit__(self, exc_type, exc, tb):
304305
await self.transport.close()
305306

306307

307-
try:
308-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
309-
gapic_version=pkg_resources.get_distribution(
310-
"google-cloud-dataflow-client",
311-
).version,
312-
)
313-
except pkg_resources.DistributionNotFound:
314-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
308+
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
309+
gapic_version=package_version.__version__
310+
)
315311

316312

317313
__all__ = ("FlexTemplatesServiceAsyncClient",)

google/cloud/dataflow_v1beta3/services/flex_templates_service/client.py

+6-10
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.dataflow_v1beta3 import gapic_version as package_version
4243

4344
try:
4445
OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault]
@@ -426,7 +427,7 @@ def launch_flex_template(
426427
request: Optional[Union[templates.LaunchFlexTemplateRequest, dict]] = None,
427428
*,
428429
retry: OptionalRetry = gapic_v1.method.DEFAULT,
429-
timeout: Optional[float] = None,
430+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
430431
metadata: Sequence[Tuple[str, str]] = (),
431432
) -> templates.LaunchFlexTemplateResponse:
432433
r"""Launch a job with a FlexTemplate.
@@ -520,14 +521,9 @@ def __exit__(self, type, value, traceback):
520521
self.transport.close()
521522

522523

523-
try:
524-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
525-
gapic_version=pkg_resources.get_distribution(
526-
"google-cloud-dataflow-client",
527-
).version,
528-
)
529-
except pkg_resources.DistributionNotFound:
530-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
524+
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
525+
gapic_version=package_version.__version__
526+
)
531527

532528

533529
__all__ = ("FlexTemplatesServiceClient",)

google/cloud/dataflow_v1beta3/services/flex_templates_service/transports/base.py

+4-9
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,13 @@
2323
import google.auth # type: ignore
2424
from google.auth import credentials as ga_credentials # type: ignore
2525
from google.oauth2 import service_account # type: ignore
26-
import pkg_resources
2726

27+
from google.cloud.dataflow_v1beta3 import gapic_version as package_version
2828
from google.cloud.dataflow_v1beta3.types import templates
2929

30-
try:
31-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
32-
gapic_version=pkg_resources.get_distribution(
33-
"google-cloud-dataflow-client",
34-
).version,
35-
)
36-
except pkg_resources.DistributionNotFound:
37-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
30+
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
31+
gapic_version=package_version.__version__
32+
)
3833

3934

4035
class FlexTemplatesServiceTransport(abc.ABC):

google/cloud/dataflow_v1beta3/services/jobs_v1_beta3/async_client.py

+12-16
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@
3434
from google.api_core.client_options import ClientOptions
3535
from google.auth import credentials as ga_credentials # type: ignore
3636
from google.oauth2 import service_account # type: ignore
37-
import pkg_resources
37+
38+
from google.cloud.dataflow_v1beta3 import gapic_version as package_version
3839

3940
try:
4041
OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault]
@@ -218,7 +219,7 @@ async def create_job(
218219
request: Optional[Union[jobs.CreateJobRequest, dict]] = None,
219220
*,
220221
retry: OptionalRetry = gapic_v1.method.DEFAULT,
221-
timeout: Optional[float] = None,
222+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
222223
metadata: Sequence[Tuple[str, str]] = (),
223224
) -> jobs.Job:
224225
r"""Creates a Cloud Dataflow job.
@@ -308,7 +309,7 @@ async def get_job(
308309
request: Optional[Union[jobs.GetJobRequest, dict]] = None,
309310
*,
310311
retry: OptionalRetry = gapic_v1.method.DEFAULT,
311-
timeout: Optional[float] = None,
312+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
312313
metadata: Sequence[Tuple[str, str]] = (),
313314
) -> jobs.Job:
314315
r"""Gets the state of the specified Cloud Dataflow job.
@@ -399,7 +400,7 @@ async def update_job(
399400
request: Optional[Union[jobs.UpdateJobRequest, dict]] = None,
400401
*,
401402
retry: OptionalRetry = gapic_v1.method.DEFAULT,
402-
timeout: Optional[float] = None,
403+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
403404
metadata: Sequence[Tuple[str, str]] = (),
404405
) -> jobs.Job:
405406
r"""Updates the state of an existing Cloud Dataflow job.
@@ -491,7 +492,7 @@ async def list_jobs(
491492
request: Optional[Union[jobs.ListJobsRequest, dict]] = None,
492493
*,
493494
retry: OptionalRetry = gapic_v1.method.DEFAULT,
494-
timeout: Optional[float] = None,
495+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
495496
metadata: Sequence[Tuple[str, str]] = (),
496497
) -> pagers.ListJobsAsyncPager:
497498
r"""List the jobs of a project.
@@ -602,7 +603,7 @@ async def aggregated_list_jobs(
602603
request: Optional[Union[jobs.ListJobsRequest, dict]] = None,
603604
*,
604605
retry: OptionalRetry = gapic_v1.method.DEFAULT,
605-
timeout: Optional[float] = None,
606+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
606607
metadata: Sequence[Tuple[str, str]] = (),
607608
) -> pagers.AggregatedListJobsAsyncPager:
608609
r"""List the jobs of a project across all regions.
@@ -702,7 +703,7 @@ async def check_active_jobs(
702703
request: Optional[Union[jobs.CheckActiveJobsRequest, dict]] = None,
703704
*,
704705
retry: OptionalRetry = gapic_v1.method.DEFAULT,
705-
timeout: Optional[float] = None,
706+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
706707
metadata: Sequence[Tuple[str, str]] = (),
707708
) -> jobs.CheckActiveJobsResponse:
708709
r"""Check for existence of active jobs in the given
@@ -774,7 +775,7 @@ async def snapshot_job(
774775
request: Optional[Union[jobs.SnapshotJobRequest, dict]] = None,
775776
*,
776777
retry: OptionalRetry = gapic_v1.method.DEFAULT,
777-
timeout: Optional[float] = None,
778+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
778779
metadata: Sequence[Tuple[str, str]] = (),
779780
) -> snapshots.Snapshot:
780781
r"""Snapshot the state of a streaming job.
@@ -859,14 +860,9 @@ async def __aexit__(self, exc_type, exc, tb):
859860
await self.transport.close()
860861

861862

862-
try:
863-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
864-
gapic_version=pkg_resources.get_distribution(
865-
"google-cloud-dataflow-client",
866-
).version,
867-
)
868-
except pkg_resources.DistributionNotFound:
869-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
863+
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
864+
gapic_version=package_version.__version__
865+
)
870866

871867

872868
__all__ = ("JobsV1Beta3AsyncClient",)

google/cloud/dataflow_v1beta3/services/jobs_v1_beta3/client.py

+12-16
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.dataflow_v1beta3 import gapic_version as package_version
4243

4344
try:
4445
OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault]
@@ -429,7 +430,7 @@ def create_job(
429430
request: Optional[Union[jobs.CreateJobRequest, dict]] = None,
430431
*,
431432
retry: OptionalRetry = gapic_v1.method.DEFAULT,
432-
timeout: Optional[float] = None,
433+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
433434
metadata: Sequence[Tuple[str, str]] = (),
434435
) -> jobs.Job:
435436
r"""Creates a Cloud Dataflow job.
@@ -520,7 +521,7 @@ def get_job(
520521
request: Optional[Union[jobs.GetJobRequest, dict]] = None,
521522
*,
522523
retry: OptionalRetry = gapic_v1.method.DEFAULT,
523-
timeout: Optional[float] = None,
524+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
524525
metadata: Sequence[Tuple[str, str]] = (),
525526
) -> jobs.Job:
526527
r"""Gets the state of the specified Cloud Dataflow job.
@@ -612,7 +613,7 @@ def update_job(
612613
request: Optional[Union[jobs.UpdateJobRequest, dict]] = None,
613614
*,
614615
retry: OptionalRetry = gapic_v1.method.DEFAULT,
615-
timeout: Optional[float] = None,
616+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
616617
metadata: Sequence[Tuple[str, str]] = (),
617618
) -> jobs.Job:
618619
r"""Updates the state of an existing Cloud Dataflow job.
@@ -705,7 +706,7 @@ def list_jobs(
705706
request: Optional[Union[jobs.ListJobsRequest, dict]] = None,
706707
*,
707708
retry: OptionalRetry = gapic_v1.method.DEFAULT,
708-
timeout: Optional[float] = None,
709+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
709710
metadata: Sequence[Tuple[str, str]] = (),
710711
) -> pagers.ListJobsPager:
711712
r"""List the jobs of a project.
@@ -817,7 +818,7 @@ def aggregated_list_jobs(
817818
request: Optional[Union[jobs.ListJobsRequest, dict]] = None,
818819
*,
819820
retry: OptionalRetry = gapic_v1.method.DEFAULT,
820-
timeout: Optional[float] = None,
821+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
821822
metadata: Sequence[Tuple[str, str]] = (),
822823
) -> pagers.AggregatedListJobsPager:
823824
r"""List the jobs of a project across all regions.
@@ -918,7 +919,7 @@ def check_active_jobs(
918919
request: Optional[Union[jobs.CheckActiveJobsRequest, dict]] = None,
919920
*,
920921
retry: OptionalRetry = gapic_v1.method.DEFAULT,
921-
timeout: Optional[float] = None,
922+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
922923
metadata: Sequence[Tuple[str, str]] = (),
923924
) -> jobs.CheckActiveJobsResponse:
924925
r"""Check for existence of active jobs in the given
@@ -991,7 +992,7 @@ def snapshot_job(
991992
request: Optional[Union[jobs.SnapshotJobRequest, dict]] = None,
992993
*,
993994
retry: OptionalRetry = gapic_v1.method.DEFAULT,
994-
timeout: Optional[float] = None,
995+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
995996
metadata: Sequence[Tuple[str, str]] = (),
996997
) -> snapshots.Snapshot:
997998
r"""Snapshot the state of a streaming job.
@@ -1084,14 +1085,9 @@ def __exit__(self, type, value, traceback):
10841085
self.transport.close()
10851086

10861087

1087-
try:
1088-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
1089-
gapic_version=pkg_resources.get_distribution(
1090-
"google-cloud-dataflow-client",
1091-
).version,
1092-
)
1093-
except pkg_resources.DistributionNotFound:
1094-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
1088+
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
1089+
gapic_version=package_version.__version__
1090+
)
10951091

10961092

10971093
__all__ = ("JobsV1Beta3Client",)

google/cloud/dataflow_v1beta3/services/jobs_v1_beta3/transports/base.py

+4-9
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,13 @@
2323
import google.auth # type: ignore
2424
from google.auth import credentials as ga_credentials # type: ignore
2525
from google.oauth2 import service_account # type: ignore
26-
import pkg_resources
2726

27+
from google.cloud.dataflow_v1beta3 import gapic_version as package_version
2828
from google.cloud.dataflow_v1beta3.types import jobs, snapshots
2929

30-
try:
31-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
32-
gapic_version=pkg_resources.get_distribution(
33-
"google-cloud-dataflow-client",
34-
).version,
35-
)
36-
except pkg_resources.DistributionNotFound:
37-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
30+
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
31+
gapic_version=package_version.__version__
32+
)
3833

3934

4035
class JobsV1Beta3Transport(abc.ABC):

google/cloud/dataflow_v1beta3/services/messages_v1_beta3/async_client.py

+6-10
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@
3434
from google.api_core.client_options import ClientOptions
3535
from google.auth import credentials as ga_credentials # type: ignore
3636
from google.oauth2 import service_account # type: ignore
37-
import pkg_resources
37+
38+
from google.cloud.dataflow_v1beta3 import gapic_version as package_version
3839

3940
try:
4041
OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault]
@@ -218,7 +219,7 @@ async def list_job_messages(
218219
request: Optional[Union[messages.ListJobMessagesRequest, dict]] = None,
219220
*,
220221
retry: OptionalRetry = gapic_v1.method.DEFAULT,
221-
timeout: Optional[float] = None,
222+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
222223
metadata: Sequence[Tuple[str, str]] = (),
223224
) -> pagers.ListJobMessagesAsyncPager:
224225
r"""Request the job status.
@@ -329,14 +330,9 @@ async def __aexit__(self, exc_type, exc, tb):
329330
await self.transport.close()
330331

331332

332-
try:
333-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
334-
gapic_version=pkg_resources.get_distribution(
335-
"google-cloud-dataflow-client",
336-
).version,
337-
)
338-
except pkg_resources.DistributionNotFound:
339-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
333+
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
334+
gapic_version=package_version.__version__
335+
)
340336

341337

342338
__all__ = ("MessagesV1Beta3AsyncClient",)

0 commit comments

Comments
 (0)