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

Commit a2eb0d7

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

File tree

11 files changed

+51
-52
lines changed

11 files changed

+51
-52
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.4.3" # {x-release-please-version}

google/cloud/service_usage_v1/services/service_usage/async_client.py

Lines changed: 14 additions & 18 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.service_usage_v1 import gapic_version as package_version
3839

3940
try:
4041
OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault]
@@ -221,7 +222,7 @@ async def enable_service(
221222
request: Optional[Union[serviceusage.EnableServiceRequest, dict]] = None,
222223
*,
223224
retry: OptionalRetry = gapic_v1.method.DEFAULT,
224-
timeout: Optional[float] = None,
225+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
225226
metadata: Sequence[Tuple[str, str]] = (),
226227
) -> operation_async.AsyncOperation:
227228
r"""Enable a service so that it can be used with a
@@ -251,7 +252,7 @@ async def sample_enable_service():
251252
252253
print("Waiting for operation to complete...")
253254
254-
response = await operation.result()
255+
response = (await operation).result()
255256
256257
# Handle the response
257258
print(response)
@@ -317,7 +318,7 @@ async def disable_service(
317318
request: Optional[Union[serviceusage.DisableServiceRequest, dict]] = None,
318319
*,
319320
retry: OptionalRetry = gapic_v1.method.DEFAULT,
320-
timeout: Optional[float] = None,
321+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
321322
metadata: Sequence[Tuple[str, str]] = (),
322323
) -> operation_async.AsyncOperation:
323324
r"""Disable a service so that it can no longer be used with a
@@ -353,7 +354,7 @@ async def sample_disable_service():
353354
354355
print("Waiting for operation to complete...")
355356
356-
response = await operation.result()
357+
response = (await operation).result()
357358
358359
# Handle the response
359360
print(response)
@@ -419,7 +420,7 @@ async def get_service(
419420
request: Optional[Union[serviceusage.GetServiceRequest, dict]] = None,
420421
*,
421422
retry: OptionalRetry = gapic_v1.method.DEFAULT,
422-
timeout: Optional[float] = None,
423+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
423424
metadata: Sequence[Tuple[str, str]] = (),
424425
) -> resources.Service:
425426
r"""Returns the service configuration and enabled state
@@ -499,7 +500,7 @@ async def list_services(
499500
request: Optional[Union[serviceusage.ListServicesRequest, dict]] = None,
500501
*,
501502
retry: OptionalRetry = gapic_v1.method.DEFAULT,
502-
timeout: Optional[float] = None,
503+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
503504
metadata: Sequence[Tuple[str, str]] = (),
504505
) -> pagers.ListServicesAsyncPager:
505506
r"""List all services available to the specified project, and the
@@ -603,7 +604,7 @@ async def batch_enable_services(
603604
request: Optional[Union[serviceusage.BatchEnableServicesRequest, dict]] = None,
604605
*,
605606
retry: OptionalRetry = gapic_v1.method.DEFAULT,
606-
timeout: Optional[float] = None,
607+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
607608
metadata: Sequence[Tuple[str, str]] = (),
608609
) -> operation_async.AsyncOperation:
609610
r"""Enable multiple services on a project. The operation is atomic:
@@ -635,7 +636,7 @@ async def sample_batch_enable_services():
635636
636637
print("Waiting for operation to complete...")
637638
638-
response = await operation.result()
639+
response = (await operation).result()
639640
640641
# Handle the response
641642
print(response)
@@ -701,7 +702,7 @@ async def batch_get_services(
701702
request: Optional[Union[serviceusage.BatchGetServicesRequest, dict]] = None,
702703
*,
703704
retry: OptionalRetry = gapic_v1.method.DEFAULT,
704-
timeout: Optional[float] = None,
705+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
705706
metadata: Sequence[Tuple[str, str]] = (),
706707
) -> serviceusage.BatchGetServicesResponse:
707708
r"""Returns the service configurations and enabled states
@@ -781,14 +782,9 @@ async def __aexit__(self, exc_type, exc, tb):
781782
await self.transport.close()
782783

783784

784-
try:
785-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
786-
gapic_version=pkg_resources.get_distribution(
787-
"google-cloud-service-usage",
788-
).version,
789-
)
790-
except pkg_resources.DistributionNotFound:
791-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
785+
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
786+
gapic_version=package_version.__version__
787+
)
792788

793789

794790
__all__ = ("ServiceUsageAsyncClient",)

google/cloud/service_usage_v1/services/service_usage/client.py

Lines changed: 11 additions & 15 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.service_usage_v1 import gapic_version as package_version
4243

4344
try:
4445
OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault]
@@ -430,7 +431,7 @@ def enable_service(
430431
request: Optional[Union[serviceusage.EnableServiceRequest, dict]] = None,
431432
*,
432433
retry: OptionalRetry = gapic_v1.method.DEFAULT,
433-
timeout: Optional[float] = None,
434+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
434435
metadata: Sequence[Tuple[str, str]] = (),
435436
) -> operation.Operation:
436437
r"""Enable a service so that it can be used with a
@@ -527,7 +528,7 @@ def disable_service(
527528
request: Optional[Union[serviceusage.DisableServiceRequest, dict]] = None,
528529
*,
529530
retry: OptionalRetry = gapic_v1.method.DEFAULT,
530-
timeout: Optional[float] = None,
531+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
531532
metadata: Sequence[Tuple[str, str]] = (),
532533
) -> operation.Operation:
533534
r"""Disable a service so that it can no longer be used with a
@@ -630,7 +631,7 @@ def get_service(
630631
request: Optional[Union[serviceusage.GetServiceRequest, dict]] = None,
631632
*,
632633
retry: OptionalRetry = gapic_v1.method.DEFAULT,
633-
timeout: Optional[float] = None,
634+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
634635
metadata: Sequence[Tuple[str, str]] = (),
635636
) -> resources.Service:
636637
r"""Returns the service configuration and enabled state
@@ -711,7 +712,7 @@ def list_services(
711712
request: Optional[Union[serviceusage.ListServicesRequest, dict]] = None,
712713
*,
713714
retry: OptionalRetry = gapic_v1.method.DEFAULT,
714-
timeout: Optional[float] = None,
715+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
715716
metadata: Sequence[Tuple[str, str]] = (),
716717
) -> pagers.ListServicesPager:
717718
r"""List all services available to the specified project, and the
@@ -816,7 +817,7 @@ def batch_enable_services(
816817
request: Optional[Union[serviceusage.BatchEnableServicesRequest, dict]] = None,
817818
*,
818819
retry: OptionalRetry = gapic_v1.method.DEFAULT,
819-
timeout: Optional[float] = None,
820+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
820821
metadata: Sequence[Tuple[str, str]] = (),
821822
) -> operation.Operation:
822823
r"""Enable multiple services on a project. The operation is atomic:
@@ -915,7 +916,7 @@ def batch_get_services(
915916
request: Optional[Union[serviceusage.BatchGetServicesRequest, dict]] = None,
916917
*,
917918
retry: OptionalRetry = gapic_v1.method.DEFAULT,
918-
timeout: Optional[float] = None,
919+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
919920
metadata: Sequence[Tuple[str, str]] = (),
920921
) -> serviceusage.BatchGetServicesResponse:
921922
r"""Returns the service configurations and enabled states
@@ -1003,14 +1004,9 @@ def __exit__(self, type, value, traceback):
10031004
self.transport.close()
10041005

10051006

1006-
try:
1007-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
1008-
gapic_version=pkg_resources.get_distribution(
1009-
"google-cloud-service-usage",
1010-
).version,
1011-
)
1012-
except pkg_resources.DistributionNotFound:
1013-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
1007+
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
1008+
gapic_version=package_version.__version__
1009+
)
10141010

10151011

10161012
__all__ = ("ServiceUsageClient",)

google/cloud/service_usage_v1/services/service_usage/transports/base.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,13 @@
2424
from google.auth import credentials as ga_credentials # type: ignore
2525
from google.longrunning import operations_pb2 # type: ignore
2626
from google.oauth2 import service_account # type: ignore
27-
import pkg_resources
2827

28+
from google.cloud.service_usage_v1 import gapic_version as package_version
2929
from google.cloud.service_usage_v1.types import resources, serviceusage
3030

31-
try:
32-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
33-
gapic_version=pkg_resources.get_distribution(
34-
"google-cloud-service-usage",
35-
).version,
36-
)
37-
except pkg_resources.DistributionNotFound:
38-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
31+
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
32+
gapic_version=package_version.__version__
33+
)
3934

4035

4136
class ServiceUsageTransport(abc.ABC):

release-please-config.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"release-type": "python",
66
"extra-files": [
77
"google/cloud/service_usage/gapic_version.py",
8+
"google/cloud/service_usage_v1/gapic_version.py",
89
{
910
"type": "json",
1011
"path": "samples/generated_samples/snippet_metadata_google.api.serviceusage.v1.json",

samples/generated_samples/serviceusage_v1_generated_service_usage_batch_enable_services_async.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ async def sample_batch_enable_services():
4747

4848
print("Waiting for operation to complete...")
4949

50-
response = await operation.result()
50+
response = (await operation).result()
5151

5252
# Handle the response
5353
print(response)

samples/generated_samples/serviceusage_v1_generated_service_usage_disable_service_async.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ async def sample_disable_service():
4747

4848
print("Waiting for operation to complete...")
4949

50-
response = await operation.result()
50+
response = (await operation).result()
5151

5252
# Handle the response
5353
print(response)

samples/generated_samples/serviceusage_v1_generated_service_usage_enable_service_async.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ async def sample_enable_service():
4747

4848
print("Waiting for operation to complete...")
4949

50-
response = await operation.result()
50+
response = (await operation).result()
5151

5252
# Handle the response
5353
print(response)

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
release_status = "Development Status :: 5 - Production/Stable"
3939

4040
dependencies = [
41-
"google-api-core[grpc] >= 1.33.2, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*",
41+
"google-api-core[grpc] >= 1.34.0, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,!=2.8.*,!=2.9.*,!=2.10.*",
4242
"proto-plus >= 1.22.0, <2.0.0dev",
4343
"protobuf>=3.19.5,<5.0.0dev,!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5",
4444
]

0 commit comments

Comments
 (0)