8000 fix(deps): Require google-api-core >=1.34.0, >=2.11.0 (#320) · googleapis/google-cloud-python@b1ebc84 · GitHub
[go: up one dir, main page]

Skip to content

Commit b1ebc84

Browse files
fix(deps): Require google-api-core >=1.34.0, >=2.11.0 (#320)
* 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 <partheniou@google.com>
1 parent 282b8ec commit b1ebc84

File tree

16 files changed

+199
-192
lines changed

16 files changed

+199
-192
lines changed

packages/google-cloud-tasks/.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.10.4" # {x-release-please-version}

packages/google-cloud-tasks/google/cloud/tasks_v2/services/cloud_tasks/async_client.py

Lines changed: 21 additions & 25 deletions
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.tasks_v2 import gapic_version as package_version
3839

3940
try:
4041
OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault]
@@ -228,7 +229,7 @@ async def list_queues(
228229
*,
229230
parent: Optional[str] = None,
230231
retry: OptionalRetry = gapic_v1.method.DEFAULT,
231-
timeout: Optional[float] = None,
232+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
232233
metadata: Sequence[Tuple[str, str]] = (),
233234
) -> pagers.ListQueuesAsyncPager:
234235
r"""Lists queues.
@@ -354,7 +355,7 @@ async def get_queue(
354355
*,
355356
name: Optional[str] = None,
356357
retry: OptionalRetry = gapic_v1.method.DEFAULT,
357-
timeout: Optional[float] = None,
358+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
358359
metadata: Sequence[Tuple[str, str]] = (),
359360
) -> queue.Queue:
360361
r"""Gets a queue.
@@ -471,7 +472,7 @@ async def create_queue(
471472
parent: Optional[str] = None,
472473
queue: Optional[gct_queue.Queue] = None,
473474
retry: OptionalRetry = gapic_v1.method.DEFAULT,
474-
timeout: Optional[float] = None,
475+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
475476
metadata: Sequence[Tuple[str, str]] = (),
476477
) -> gct_queue.Queue:
477478
r"""Creates a queue.
@@ -604,7 +605,7 @@ async def update_queue(
604605
queue: Optional[gct_queue.Queue] = None,
605606
update_mask: Optional[field_mask_pb2.FieldMask] = None,
606607
retry: OptionalRetry = gapic_v1.method.DEFAULT,
607-
timeout: Optional[float] = None,
608+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
608609
metadata: Sequence[Tuple[str, str]] = (),
609610
) -> gct_queue.Queue:
610611
r"""Updates a queue.
@@ -743,7 +744,7 @@ async def delete_queue(
743744
*,
744745
name: Optional[str] = None,
745746
retry: OptionalRetry = gapic_v1.method.DEFAULT,
746-
timeout: Optional[float] = None,
747+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
747748
metadata: Sequence[Tuple[str, str]] = (),
748749
) -> None:
749750
r"""Deletes a queue.
@@ -854,7 +855,7 @@ async def purge_queue(
854855
*,
855856
name: Optional[str] = None,
856857
retry: OptionalRetry = gapic_v1.method.DEFAULT,
857-
timeout: Optional[float] = None,
858+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
858859
metadata: Sequence[Tuple[str, str]] = (),
859860
) -> queue.Queue:
860861
r"""Purges a queue by deleting all of its tasks.
@@ -965,7 +966,7 @@ async def pause_queue(
965966
*,
966967
name: Optional[str] = None,
967968
retry: OptionalRetry = gapic_v1.method.DEFAULT,
968-
timeout: Optional[float] = None,
969+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
969970
metadata: Sequence[Tuple[str, str]] = (),
970971
) -> queue.Queue:
971972
r"""Pauses the queue.
@@ -1078,7 +1079,7 @@ async def resume_queue(
10781079
*,
10791080
name: Optional[str] = None,
10801081
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1081-
timeout: Optional[float] = None,
1082+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
10821083
metadata: Sequence[Tuple[str, str]] = (),
10831084
) -> queue.Queue:
10841085
r"""Resume a queue.
@@ -1198,7 +1199,7 @@ async def get_iam_policy(
11981199
*,
11991200
resource: Optional[str] = None,
12001201
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1201-
timeout: Optional[float] = None,
1202+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
12021203
metadata: Sequence[Tuple[str, str]] = (),
12031204
) -> policy_pb2.Policy:
12041205
r"""Gets the access control policy for a
@@ -1382,7 +1383,7 @@ async def set_iam_policy(
13821383
*,
13831384
resource: Optional[str] = None,
13841385
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1385-
timeout: Optional[float] = None,
1386+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
13861387
metadata: Sequence[Tuple[str, str]] = (),
13871388
) -> policy_pb2.Policy:
13881389
r"""Sets the access control policy for a
@@ -1561,7 +1562,7 @@ async def test_iam_permissions(
15611562
resource: Optional[str] = None,
15621563
permissions: Optional[MutableSequence[str]] = None,
15631564
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1564-
timeout: Optional[float] = None,
1565+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
15651566
metadata: Sequence[Tuple[str, str]] = (),
15661567
) -> iam_policy_pb2.TestIamPermissionsResponse:
15671568
r"""Returns permissions that a caller has on a
@@ -1695,7 +1696,7 @@ async def list_tasks(
16951696
*,
16961697
parent: Optional[str] = None,
16971698
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1698-
timeout: Optional[float] = None,
1699+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
16991700
metadata: Sequence[Tuple[str, str]] = (),
17001701
) -> pagers.ListTasksAsyncPager:
17011702
r"""Lists the tasks in a queue.
@@ -1830,7 +1831,7 @@ async def get_task(
18301831
*,
18311832
name: Optional[str] = None,
18321833
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1833-
timeout: Optional[float] = None,
1834+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
18341835
metadata: Sequence[Tuple[str, str]] = (),
18351836
) -> task.Task:
18361837
r"""Gets a task.
@@ -1942,7 +1943,7 @@ async def create_task(
19421943
parent: Optional[str] = None,
19431944
task: Optional[gct_task.Task] = None,
19441945
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1945-
timeout: Optional[float] = None,
1946+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
19461947
metadata: Sequence[Tuple[str, str]] = (),
19471948
) -> gct_task.Task:
19481949
r"""Creates a task and adds it to a queue.
@@ -2097,7 +2098,7 @@ async def delete_task(
20972098
*,
20982099
name: Optional[str] = None,
20992100
retry: OptionalRetry = gapic_v1.method.DEFAULT,
2100-
timeout: Optional[float] = None,
2101+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
21012102
metadata: Sequence[Tuple[str, str]] = (),
21022103
) -> None:
21032104
r"""Deletes a task.
@@ -2201,7 +2202,7 @@ async def run_task(
22012202
*,
22022203
name: Optional[str] = None,
22032204
retry: OptionalRetry = gapic_v1.method.DEFAULT,
2204-
timeout: Optional[float] = None,
2205+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
22052206
metadata: Sequence[Tuple[str, str]] = (),
22062207
) -> task.Task:
22072208
r"""Forces a task to run now.
@@ -2329,14 +2330,9 @@ async def __aexit__(self, exc_type, exc, tb):
23292330
await self.transport.close()
23302331

23312332

2332-
try:
2333-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
2334-
gapic_version=pkg_resources.get_distribution(
2335-
"google-cloud-tasks",
2336-
).version,
2337-
)
2338-
except pkg_resources.DistributionNotFound:
2339-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
2333+
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
2334+
gapic_version=package_version.__version__
2335+
)
23402336

23412337

23422338
__all__ = ("CloudTasksAsyncClient",)

packages/google-cloud-tasks/google/cloud/tasks_v2/services/cloud_tasks/client.py

Lines changed: 21 additions & 25 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.tasks_v2 import gapic_version as package_version
4243

4344
try:
4445
OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault]
@@ -481,7 +482,7 @@ def list_queues(
481482
*,
482483
parent: Optional[str] = None,
483484
retry: OptionalRetry = gapic_v1.method.DEFAULT,
484-
timeout: Optional[float] = None,
485+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
485486
metadata: Sequence[Tuple[str, str]] = (),
486487
) -> pagers.ListQueuesPager:
487488
r"""Lists queues.
@@ -597,7 +598,7 @@ def get_queue(
597598
*,
598599
name: Optional[str] = None,
599600
retry: OptionalRetry = gapic_v1.method.DEFAULT,
600-
timeout: Optional[float] = None,
601+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
601602
metadata: Sequence[Tuple[str, str]] = (),
602603
) -> queue.Queue:
603604
r"""Gets a queue.
@@ -704,7 +705,7 @@ def create_queue(
704705
parent: Optional[str] = None,
705706
queue: Optional[gct_queue.Queue] = None,
706707
retry: OptionalRetry = gapic_v1.method.DEFAULT,
707-
timeout: Optional[float] = None,
708+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
708709
metadata: Sequence[Tuple[str, str]] = (),
709710
) -> gct_queue.Queue:
710711
r"""Creates a queue.
@@ -837,7 +838,7 @@ def update_queue(
837838
queue: Optional[gct_queue.Queue] = None,
838839
update_mask: Optional[field_mask_pb2.FieldMask] = None,
839840
retry: OptionalRetry = gapic_v1.method.DEFAULT,
840-
timeout: Optional[float] = None,
841+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
841842
metadata: Sequence[Tuple[str, str]] = (),
842843
) -> gct_queue.Queue:
843844
r"""Updates a queue.
@@ -976,7 +977,7 @@ def delete_queue(
976977
*,
977978
name: Optional[str] = None,
978979
retry: OptionalRetry = gapic_v1.method.DEFAULT,
979-
timeout: Optional[float] = None,
980+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
980981
metadata: Sequence[Tuple[str, str]] = (),
981982
) -> None:
982983
r"""Deletes a queue.
@@ -1077,7 +1078,7 @@ def purge_queue(
10771078
*,
10781079
name: Optional[str] = None,
10791080
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1080-
timeout: Optional[float] = None,
1081+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
10811082
metadata: Sequence[Tuple[str, str]] = (),
10821083
) -> queue.Queue:
10831084
r"""Purges a queue by deleting all of its tasks.
@@ -1188,7 +1189,7 @@ def pause_queue(
11881189
*,
11891190
name: Optional[str] = None,
11901191
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1191-
timeout: Optional[float] = None,
1192+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
11921193
metadata: Sequence[Tuple[str, str]] = (),
11931194
) -> queue.Queue:
11941195
r"""Pauses the queue.
@@ -1301,7 +1302,7 @@ def resume_queue(
13011302
*,
13021303
name: Optional[str] = None,
13031304
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1304-
timeout: Optional[float] = None,
1305+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
13051306
metadata: Sequence[Tuple[str, str]] = (),
13061307
) -> queue.Queue:
13071308
r"""Resume a queue.
@@ -1421,7 +1422,7 @@ def get_iam_policy(
14211422
*,
14221423
resource: Optional[str] = None,
14231424
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1424-
timeout: Optional[float] = None,
1425+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
14251426
metadata: Sequence[Tuple[str, str]] = (),
14261427
) -> policy_pb2.Policy:
14271428
r"""Gets the access control policy for a
@@ -1592,7 +1593,7 @@ def set_iam_policy(
15921593
*,
15931594
resource: Optional[str] = None,
15941595
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1595-
timeout: Optional[float] = None,
1596+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
15961597
metadata: Sequence[Tuple[str, str]] = (),
15971598
) -> policy_pb2.Policy:
15981599
r"""Sets the access control policy for a
@@ -1768,7 +1769,7 @@ def test_iam_permissions(
17681769
resource: Optional[str] = None,
17691770
permissions: Optional[MutableSequence[str]] = None,
17701771
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1771-
timeout: Optional[float] = None,
1772+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
17721773
metadata: Sequence[Tuple[str, str]] = (),
17731774
) -> iam_policy_pb2.TestIamPermissionsResponse:
17741775
r"""Returns permissions that a caller has on a
@@ -1890,7 +1891,7 @@ def list_tasks(
18901891
*,
18911892
parent: 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
) -> pagers.ListTasksPager:
18961897
r"""Lists the tasks in a queue.
@@ -2015,7 +2016,7 @@ def get_task(
20152016
*,
20162017
name: Optional[str] = None,
20172018
retry: OptionalRetry = gapic_v1.method.DEFAULT,
2018-
timeout: Optional[float] = None,
2019+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
20192020
metadata: Sequence[Tuple[str, str]] = (),
20202021
) -> task.Task:
20212022
r"""Gets a task.
@@ -2117,7 +2118,7 @@ def create_task(
21172118
parent: Optional[str] = None,
21182119
task: Optional[gct_task.Task] = None,
21192120
retry: OptionalRetry = gapic_v1.method.DEFAULT,
2120-
timeout: Optional[float] = None,
2121+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
21212122
metadata: Sequence[Tuple[str, str]] = (),
21222123
) -> gct_task.Task:
21232124
r"""Creates a task and adds it to a queue.
@@ -2272,7 +2273,7 @@ def delete_task(
22722273
*,
22732274
name: Optional[str] = None,
22742275
retry: OptionalRetry = gapic_v1.method.DEFAULT,
2275-
timeout: Optional[float] = None,
2276+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
22762277
metadata: Sequence[Tuple[str, str]] = (),
22772278
) -> None:
22782279
r"""Deletes a task.
@@ -2366,7 +2367,7 @@ def run_task(
23662367
*,
23672368
name: Optional[str] = None,
23682369
retry: OptionalRetry = gapic_v1.method.DEFAULT,
2369-
timeout: Optional[float] = None,
2370+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
23702371
metadata: Sequence[Tuple[str, str]] = (),
23712372
) -> task.Task:
23722373
r"""Forces a task to run now.
@@ -2501,14 +2502,9 @@ def __exit__(self, type, value, traceback):
25012502
self.transport.close()
25022503

25032504

2504-
try:
2505-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
2506-
gapic_version=pkg_resources.get_distribution(
2507-
"google-cloud-tasks",
2508-
).version,
2509-
)
2510-
except pkg_resources.DistributionNotFound:
2511-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
2505+
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
2506+
gapic_version=package_version.__version__
2507+
)
25122508

25132509

25142510
__all__ = ("CloudTasksClient",)

packages/google-cloud-tasks/google/cloud/tasks_v2/services/cloud_tasks/transports/base.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,22 +26,17 @@
2626
from google.iam.v1 import policy_pb2 # type: ignore
2727
from google.oauth2 import service_account # type: ignore
2828
from google.protobuf import empty_pb2 # type: ignore
29-
import pkg_resources
3029

30+
from google.cloud.tasks_v2 import gapic_version as package_version
3131
from google.cloud.tasks_v2.types import cloudtasks
3232
from google.cloud.tasks_v2.types import queue
3333
from google.cloud.tasks_v2.types import queue as gct_queue
3434
from google.cloud.tasks_v2.types import task
3535
from google.cloud.tasks_v2.types import task as gct_task
3636

37-
try:
38-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
39-
gapic_version=pkg_resources.get_distribution(
40-
"google-cloud-tasks",
41-
).version,
42-
)
43-
except pkg_resources.DistributionNotFound:
44-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
37+
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
38+
gapic_version=package_version.__version__
39+
)
4540

4641

4742
class CloudTasksTransport(abc.ABC):

0 commit comments

Comments
 (0)
0