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

Commit 7fb1fd0

Browse files
fix(deps): Require google-api-core >=1.34.0, >=2.11.0 (#216)
* 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 0eb8ef8 commit 7fb1fd0

23 files changed

Lines changed: 183 additions & 197 deletions

.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.10.0" # {x-release-please-version}

google/cloud/channel_v1/services/cloud_channel_reports_service/async_client.py

Lines changed: 13 additions & 17 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.channel_v1 import gapic_version as package_version
3839

3940
try:
4041
OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault]
@@ -237,7 +238,7 @@ async def run_report_job(
237238
request: Optional[Union[reports_service.RunReportJobRequest, dict]] = None,
238239
*,
239240
retry: OptionalRetry = gapic_v1.method.DEFAULT,
240-
timeout: Optional[float] = None,
241+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
241242
metadata: Sequence[Tuple[str, str]] = (),
242243
) -> operation_async.AsyncOperation:
243244
r"""Begins generation of data for a given report. The report
@@ -292,7 +293,7 @@ async def sample_run_report_job():
292293
293294
print("Waiting for operation to complete...")
294295
295-
response = await operation.result()
296+
response = (await operation).result()
296297
297298
# Handle the response
298299
print(response)
@@ -361,7 +362,7 @@ async def fetch_report_results(
361362
*,
362363
report_job: Optional[str] = None,
363364
retry: OptionalRetry = gapic_v1.method.DEFAULT,
364-
timeout: Optional[float] = None,
365+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
365366
metadata: Sequence[Tuple[str, str]] = (),
366367
) -> pagers.FetchReportResultsAsyncPager:
367368
r"""Retrieves data generated by
@@ -482,7 +483,7 @@ async def list_reports(
482483
*,
483484
parent: Optional[str] = None,
484485
retry: OptionalRetry = gapic_v1.method.DEFAULT,
485-
timeout: Optional[float] = None,
486+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
486487
metadata: Sequence[Tuple[str, str]] = (),
487488
) -> pagers.ListReportsAsyncPager:
488489
r"""Lists the reports that RunReportJob can run. These
@@ -599,7 +600,7 @@ async def list_operations(
599600
request: Optional[operations_pb2.ListOperationsRequest] = None,
600601
*,
601602
retry: OptionalRetry = gapic_v1.method.DEFAULT,
602-
timeout: Optional[float] = None,
603+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
603604
metadata: Sequence[Tuple[str, str]] = (),
604605
) -> operations_pb2.ListOperationsResponse:
605606
r"""Lists operations that match the specified filter in the request.
@@ -653,7 +654,7 @@ async def get_operation(
653654
request: Optional[operations_pb2.GetOperationRequest] = None,
654655
*,
655656
retry: OptionalRetry = gapic_v1.method.DEFAULT,
656-
timeout: Optional[float] = None,
657+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
657658
metadata: Sequence[Tuple[str, str]] = (),
658659
) -> operations_pb2.Operation:
659660
r"""Gets the latest state of a long-running operation.
@@ -707,7 +708,7 @@ async def delete_operation(
707708
request: Optional[operations_pb2.DeleteOperationRequest] = None,
708709
*,
709710
retry: OptionalRetry = gapic_v1.method.DEFAULT,
710-
timeout: Optional[float] = None,
711+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
711712
metadata: Sequence[Tuple[str, str]] = (),
712713
) -> None:
713714
r"""Deletes a long-running operation.
@@ -762,7 +763,7 @@ async def cancel_operation(
762763
request: Optional[operations_pb2.CancelOperationRequest] = None,
763764
*,
764765
retry: OptionalRetry = gapic_v1.method.DEFAULT,
765-
timeout: Optional[float] = None,
766+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
766767
metadata: Sequence[Tuple[str, str]] = (),
767768
) -> None:
768769
r"""Starts asynchronous cancellation on a long-running operation.
@@ -818,14 +819,9 @@ async def __aexit__(self, exc_type, exc, tb):
818819
await self.transport.close()
819820

820821

821-
try:
822-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
823-
gapic_version=pkg_resources.get_distribution(
824-
"google-cloud-channel",
825-
).version,
826-
)
827-
except pkg_resources.DistributionNotFound:
828-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
822+
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
823+
gapic_version=package_version.__version__
824+
)
829825

830826

831827
__all__ = ("CloudChannelReportsServiceAsyncClient",)

google/cloud/channel_v1/services/cloud_channel_reports_service/client.py

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

4344
try:
4445
OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault]
@@ -467,7 +468,7 @@ def run_report_job(
467468
request: Optional[Union[reports_service.RunReportJobRequest, dict]] = None,
468469
*,
469470
retry: OptionalRetry = gapic_v1.method.DEFAULT,
470-
timeout: Optional[float] = None,
471+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
471472
metadata: Sequence[Tuple[str, str]] = (),
472473
) -> operation.Operation:
473474
r"""Begins generation of data for a given report. The report
@@ -592,7 +593,7 @@ def fetch_report_results(
592593
*,
593594
report_job: Optional[str] = None,
594595
retry: OptionalRetry = gapic_v1.method.DEFAULT,
595-
timeout: Optional[float] = None,
596+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
596597
metadata: Sequence[Tuple[str, str]] = (),
597598
) -> pagers.FetchReportResultsPager:
598599
r"""Retrieves data generated by
@@ -713,7 +714,7 @@ def list_reports(
713714
*,
714715
parent: Optional[str] = None,
715716
retry: OptionalRetry = gapic_v1.method.DEFAULT,
716-
timeout: Optional[float] = None,
717+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
717718
metadata: Sequence[Tuple[str, str]] = (),
718719
) -> pagers.ListReportsPager:
719720
r"""Lists the reports that RunReportJob can run. These
@@ -843,7 +844,7 @@ def list_operations(
843844
request: Optional[operations_pb2.ListOperationsRequest] = None,
844845
*,
845846
retry: OptionalRetry = gapic_v1.method.DEFAULT,
846-
timeout: Optional[float] = None,
847+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
847848
metadata: Sequence[Tuple[str, str]] = (),
848849
) -> operations_pb2.ListOperationsResponse:
849850
r"""Lists operations that match the specified filter in the request.
@@ -897,7 +898,7 @@ def get_operation(
897898
request: Optional[operations_pb2.GetOperationRequest] = None,
898899
*,
899900
retry: OptionalRetry = gapic_v1.method.DEFAULT,
900-
timeout: Optional[float] = None,
901+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
901902
metadata: Sequence[Tuple[str, str]] = (),
902903
) -> operations_pb2.Operation:
903904
r"""Gets the latest state of a long-running operation.
@@ -951,7 +952,7 @@ def delete_operation(
951952
request: Optional[operations_pb2.DeleteOperationRequest] = None,
952953
*,
953954
retry: OptionalRetry = gapic_v1.method.DEFAULT,
954-
timeout: Optional[float] = None,
955+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
955956
metadata: Sequence[Tuple[str, str]] = (),
956957
) -> None:
957958
r"""Deletes a long-running operation.
@@ -1006,7 +1007,7 @@ def cancel_operation(
10061007
request: Optional[operations_pb2.CancelOperationRequest] = None,
10071008
*,
10081009
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1009-
timeout: Optional[float] = None,
1010+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
10101011
metadata: Sequence[Tuple[str, str]] = (),
10111012
) -> None:
10121013
r"""Starts asynchronous cancellation on a long-running operation.
@@ -1056,14 +1057,9 @@ def cancel_operation(
10561057
)
10571058

10581059

1059-
try:
1060-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
1061-
gapic_version=pkg_resources.get_distribution(
1062-
"google-cloud-channel",
1063-
).version,
1064-
)
1065-
except pkg_resources.DistributionNotFound:
1066-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
1060+
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
1061+
gapic_version=package_version.__version__
1062+
)
10671063

10681064

10691065
__all__ = ("CloudChannelReportsServiceClient",)

google/cloud/channel_v1/services/cloud_channel_reports_service/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.channel_v1 import gapic_version as package_version
2929
from google.cloud.channel_v1.types import reports_service
3030

31-
try:
32-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
33-
gapic_version=pkg_resources.get_distribution(
34-
"google-cloud-channel",
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 CloudChannelReportsServiceTransport(abc.ABC):

0 commit comments

Comments
 (0)