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

Commit 716d441

Browse files
fix(deps): Require google-api-core >=1.34.0, >=2.11.0 (#234)
* 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 * 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 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * 🦉 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 8fa10be commit 716d441

18 files changed

+126
-123
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__ = "1.8.3" # {x-release-please-version}

google/cloud/functions_v1/services/cloud_functions_service/async_client.py

Lines changed: 19 additions & 23 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.functions_v1 import gapic_version as package_version
3839

3940
try:
4041
OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault]
@@ -241,7 +242,7 @@ async def list_functions(
241242
request: Optional[Union[functions.ListFunctionsRequest, dict]] = None,
242243
*,
243244
retry: OptionalRetry = gapic_v1.method.DEFAULT,
244-
timeout: Optional[float] = None,
245+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
245246
metadata: Sequence[Tuple[str, str]] = (),
246247
) -> pagers.ListFunctionsAsyncPager:
247248
r"""Returns a list of functions that belong to the
@@ -344,7 +345,7 @@ async def get_function(
344345
*,
345346
name: Optional[str] = None,
346347
retry: OptionalRetry = gapic_v1.method.DEFAULT,
347-
timeout: Optional[float] = None,
348+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
348349
metadata: Sequence[Tuple[str, str]] = (),
349350
) -> functions.CloudFunction:
350351
r"""Returns a function with the given name from the
@@ -460,7 +461,7 @@ async def create_function(
460461
location: Optional[str] = None,
461462
function: Optional[functions.CloudFunction] = None,
462463
retry: OptionalRetry = gapic_v1.method.DEFAULT,
463-
timeout: Optional[float] = None,
464+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
464465
metadata: Sequence[Tuple[str, str]] = (),
465466
) -> operation_async.AsyncOperation:
466467
r"""Creates a new function. If a function with the given name
@@ -496,7 +497,7 @@ async def sample_create_function():
496497
497498
print("Waiting for operation to complete...")
498499
499-
response = await operation.result()
500+
response = (await operation).result()
500501
501502
# Handle the response
502503
print(response)
@@ -591,7 +592,7 @@ async def update_function(
591592
*,
592593
function: Optional[functions.CloudFunction] = None,
593594
retry: OptionalRetry = gapic_v1.method.DEFAULT,
594-
timeout: Optional[float] = None,
595+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
595596
metadata: Sequence[Tuple[str, str]] = (),
596597
) -> operation_async.AsyncOperation:
597598
r"""Updates existing function.
@@ -624,7 +625,7 @@ async def sample_update_function():
624625
625626
print("Waiting for operation to complete...")
626627
627-
response = await operation.result()
628+
response = (await operation).result()
628629
629630
# Handle the response
630631
print(response)
@@ -723,7 +724,7 @@ async def delete_function(
723724
*,
724725
name: Optional[str] = None,
725726
retry: OptionalRetry = gapic_v1.method.DEFAULT,
726-
timeout: Optional[float] = None,
727+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
727728
metadata: Sequence[Tuple[str, str]] = (),
728729
) -> operation_async.AsyncOperation:
729730
r"""Deletes a function with the given name from the
@@ -756,7 +757,7 @@ async def sample_delete_function():
756757
757758
print("Waiting for operation to complete...")
758759
759-
response = await operation.result()
760+
response = (await operation).result()
760761
761762
# Handle the response
762763
print(response)
@@ -861,7 +862,7 @@ async def call_function(
861862
name: Optional[str] = None,
862863
data: Optional[str] = None,
863864
retry: OptionalRetry = gapic_v1.method.DEFAULT,
864-
timeout: Optional[float] = None,
865+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
865866
metadata: Sequence[Tuple[str, str]] = (),
866867
) -> functions.CallFunctionResponse:
867868
r"""Synchronously invokes a deployed Cloud Function. To be used for
@@ -973,7 +974,7 @@ async def generate_upload_url(
973974
request: Optional[Union[functions.GenerateUploadUrlRequest, dict]] = None,
974975
*,
975976
retry: OptionalRetry = gapic_v1.method.DEFAULT,
976-
timeout: Optional[float] = None,
977+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
977978
metadata: Sequence[Tuple[str, str]] = (),
978979
) -> functions.GenerateUploadUrlResponse:
979980
r"""Returns a signed URL for uploading a function source code. For
@@ -1077,7 +1078,7 @@ async def generate_download_url(
10771078
request: Optional[Union[functions.GenerateDownloadUrlRequest, dict]] = None,
10781079
*,
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
) -> functions.GenerateDownloadUrlResponse:
10831084
r"""Returns a signed URL for downloading deployed
@@ -1159,7 +1160,7 @@ async def set_iam_policy(
11591160
request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None,
11601161
*,
11611162
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1162-
timeout: Optional[float] = None,
1163+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
11631164
metadata: Sequence[Tuple[str, str]] = (),
11641165
) -> policy_pb2.Policy:
11651166
r"""Sets the IAM access control policy on the specified
@@ -1303,7 +1304,7 @@ async def get_iam_policy(
13031304
request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None,
13041305
*,
13051306
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1306-
timeout: Optional[float] = None,
1307+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
13071308
metadata: Sequence[Tuple[str, str]] = (),
13081309
) -> policy_pb2.Policy:
13091310
r"""Gets the IAM access control policy for a function.
@@ -1448,7 +1449,7 @@ async def test_iam_permissions(
14481449
request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None,
14491450
*,
14501451
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1451-
timeout: Optional[float] = None,
1452+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
14521453
metadata: Sequence[Tuple[str, str]] = (),
14531454
) -> iam_policy_pb2.TestIamPermissionsResponse:
14541455
r"""Tests the specified permissions against the IAM access control
@@ -1535,14 +1536,9 @@ async def __aexit__(self, exc_type, exc, tb):
15351536
await self.transport.close()
15361537

15371538

1538-
try:
1539-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
1540-
gapic_version=pkg_resources.get_distribution(
1541-
"google-cloud-functions",
1542-
).version,
1543-
)
1544-
except pkg_resources.DistributionNotFound:
1545-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
1539+
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
1540+
gapic_version=package_version.__version__
1541+
)
15461542

15471543

15481544
__all__ = ("CloudFunctionsServiceAsyncClient",)

google/cloud/functions_v1/services/cloud_functions_service/client.py

Lines changed: 16 additions & 20 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.functions_v1 import gapic_version as package_version
4243

4344
try:
4445
OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault]
@@ -503,7 +504,7 @@ def list_functions(
503504
request: Optional[Union[functions.ListFunctionsRequest, dict]] = None,
504505
*,
505506
retry: OptionalRetry = gapic_v1.method.DEFAULT,
506-
timeout: Optional[float] = None,
507+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
507508
metadata: Sequence[Tuple[str, str]] = (),
508509
) -> pagers.ListFunctionsPager:
509510
r"""Returns a list of functions that belong to the
@@ -597,7 +598,7 @@ def get_function(
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
) -> functions.CloudFunction:
603604
r"""Returns a function with the given name from the
@@ -703,7 +704,7 @@ def create_function(
703704
location: Optional[str] = None,
704705
function: Optional[functions.CloudFunction] = None,
705706
retry: OptionalRetry = gapic_v1.method.DEFAULT,
706-
timeout: Optional[float] = None,
707+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
707708
metadata: Sequence[Tuple[str, str]] = (),
708709
) -> operation.Operation:
709710
r"""Creates a new function. If a function with the given name
@@ -834,7 +835,7 @@ def update_function(
834835
*,
835836
function: Optional[functions.CloudFunction] = None,
836837
retry: OptionalRetry = gapic_v1.method.DEFAULT,
837-
timeout: Optional[float] = None,
838+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
838839
metadata: Sequence[Tuple[str, str]] = (),
839840
) -> operation.Operation:
840841
r"""Updates existing function.
@@ -956,7 +957,7 @@ def delete_function(
956957
*,
957958
name: Optional[str] = None,
958959
retry: OptionalRetry = gapic_v1.method.DEFAULT,
959-
timeout: Optional[float] = None,
960+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
960961
metadata: Sequence[Tuple[str, str]] = (),
961962
) -> operation.Operation:
962963
r"""Deletes a function with the given name from the
@@ -1084,7 +1085,7 @@ def call_function(
10841085
name: Optional[str] = None,
10851086
data: Optional[str] = None,
10861087
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1087-
timeout: Optional[float] = None,
1088+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
10881089
metadata: Sequence[Tuple[str, str]] = (),
10891090
) -> functions.CallFunctionResponse:
10901091
r"""Synchronously invokes a deployed Cloud Function. To be used for
@@ -1196,7 +1197,7 @@ def generate_upload_url(
11961197
request: Optional[Union[functions.GenerateUploadUrlRequest, dict]] = None,
11971198
*,
11981199
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1199-
timeout: Optional[float] = None,
1200+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
12001201
metadata: Sequence[Tuple[str, str]] = (),
12011202
) -> functions.GenerateUploadUrlResponse:
12021203
r"""Returns a signed URL for uploading a function source code. For
@@ -1301,7 +1302,7 @@ def generate_download_url(
13011302
request: Optional[Union[functions.GenerateDownloadUrlRequest, dict]] = None,
13021303
*,
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
) -> functions.GenerateDownloadUrlResponse:
13071308
r"""Returns a signed URL for downloading deployed
@@ -1384,7 +1385,7 @@ def set_iam_policy(
13841385
request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = None,
13851386
*,
13861387
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1387-
timeout: Optional[float] = None,
1388+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
13881389
metadata: Sequence[Tuple[str, str]] = (),
13891390
) -> policy_pb2.Policy:
13901391
r"""Sets the IAM access control policy on the specified
@@ -1527,7 +1528,7 @@ def get_iam_policy(
15271528
request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = None,
15281529
*,
15291530
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1530-
timeout: Optional[float] = None,
1531+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
15311532
metadata: Sequence[Tuple[str, str]] = (),
15321533
) -> policy_pb2.Policy:
15331534
r"""Gets the IAM access control policy for a function.
@@ -1671,7 +1672,7 @@ def test_iam_permissions(
16711672
request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None,
16721673
*,
16731674
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1674-
timeout: Optional[float] = None,
1675+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
16751676
metadata: Sequence[Tuple[str, str]] = (),
16761677
) -> iam_policy_pb2.TestIamPermissionsResponse:
16771678
r"""Tests the specified permissions against the IAM access control
@@ -1764,14 +1765,9 @@ def __exit__(self, type, value, traceback):
17641765
self.transport.close()
17651766

17661767

1767-
try:
1768-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
1769-
gapic_version=pkg_resources.get_distribution(
1770-
"google-cloud-functions",
1771-
).version,
1772-
)
1773-
except pkg_resources.DistributionNotFound:
1774-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
1768+
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
1769+
gapic_version=package_version.__version__
1770+
)
17751771

17761772

17771773
__all__ = ("CloudFunctionsServiceClient",)

google/cloud/functions_v1/services/cloud_functions_service/transports/base.py

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

30+
from google.cloud.functions_v1 import gapic_version as package_version
3131
from google.cloud.functions_v1.types import functions
3232

33-
try:
34-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
35-
gapic_version=pkg_resources.get_distribution(
36-
"google-cloud-functions",
37-
).version,
38-
)
39-
except pkg_resources.DistributionNotFound:
40-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
33+
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
34+
gapic_version=package_version.__version__
35+
)
4136

4237

4338
class CloudFunctionsServiceTransport(abc.ABC):
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.8.3" # {x-release-please-version}

0 commit comments

Comments
 (0)