Skip to content

Commit d6d7eeb

Browse files
fix(deps): Require google-api-core >=1.34.0, >=2.11.0 (#129)
* 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 <[email protected]>
1 parent 43efd83 commit d6d7eeb

16 files changed

+81
-82
lines changed

packages/google-cloud-video-live-stream/.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.0.4" # {x-release-please-version}

packages/google-cloud-video-live-stream/google/cloud/video/live_stream_v1/services/livestream_service/async_client.py

Lines changed: 29 additions & 33 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.video.live_stream_v1 import gapic_version as package_version
3839

3940
try:
4041
OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault]
@@ -238,7 +239,7 @@ async def create_channel(
238239
channel: Optional[resources.Channel] = None,
239240
channel_id: Optional[str] = None,
240241
retry: OptionalRetry = gapic_v1.method.DEFAULT,
241-
timeout: Optional[float] = None,
242+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
242243
metadata: Sequence[Tuple[str, str]] = (),
243244
) -> operation_async.AsyncOperation:
244245
r"""Creates a channel with the provided unique ID in the
@@ -270,7 +271,7 @@ async def sample_create_channel():
270271
271272
print("Waiting for operation to complete...")
272273
273-
response = await operation.result()
274+
response = (await operation).result()
274275
275276
# Handle the response
276277
print(response)
@@ -379,7 +380,7 @@ async def list_channels(
379380
*,
380381
parent: Optional[str] = None,
381382
retry: OptionalRetry = gapic_v1.method.DEFAULT,
382-
timeout: Optional[float] = None,
383+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
383384
metadata: Sequence[Tuple[str, str]] = (),
384385
) -> pagers.ListChannelsAsyncPager:
385386
r"""Returns a list of all channels in the specified
@@ -504,7 +505,7 @@ async def get_channel(
504505
*,
505506
name: Optional[str] = None,
506507
retry: OptionalRetry = gapic_v1.method.DEFAULT,
507-
timeout: Optional[float] = None,
508+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
508509
metadata: Sequence[Tuple[str, str]] = (),
509510
) -> resources.Channel:
510511
r"""Returns the specified channel.
@@ -622,7 +623,7 @@ async def delete_channel(
622623
*,
623624
name: Optional[str] = None,
624625
retry: OptionalRetry = gapic_v1.method.DEFAULT,
625-
timeout: Optional[float] = None,
626+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
626627
metadata: Sequence[Tuple[str, str]] = (),
627628
) -> operation_async.AsyncOperation:
628629
r"""Deletes the specified channel.
@@ -652,7 +653,7 @@ async def sample_delete_channel():
652653
653654
print("Waiting for operation to complete...")
654655
655-
response = await operation.result()
656+
response = (await operation).result()
656657
657658
# Handle the response
658659
print(response)
@@ -748,7 +749,7 @@ async def update_channel(
748749
channel: Optional[resources.Channel] = None,
749750
update_mask: Optional[field_mask_pb2.FieldMask] = None,
750751
retry: OptionalRetry = gapic_v1.method.DEFAULT,
751-
timeout: Optional[float] = None,
752+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
752753
metadata: Sequence[Tuple[str, str]] = (),
753754
) -> operation_async.AsyncOperation:
754755
r"""Updates the specified channel.
@@ -777,7 +778,7 @@ async def sample_update_channel():
777778
778779
print("Waiting for operation to complete...")
779780
780-
response = await operation.result()
781+
response = (await operation).result()
781782
782783
# Handle the response
783784
print(response)
@@ -890,7 +891,7 @@ async def start_channel(
890891
*,
891892
name: Optional[str] = None,
892893
retry: OptionalRetry = gapic_v1.method.DEFAULT,
893-
timeout: Optional[float] = None,
894+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
894895
metadata: Sequence[Tuple[str, str]] = (),
895896
) -> operation_async.AsyncOperation:
896897
r"""Starts the specified channel. Part of the video
@@ -922,7 +923,7 @@ async def sample_start_channel():
922923
923924
print("Waiting for operation to complete...")
924925
925-
response = await operation.result()
926+
response = (await operation).result()
926927
927928
# Handle the response
928929
print(response)
@@ -1011,7 +1012,7 @@ async def stop_channel(
10111012
*,
10121013
name: Optional[str] = None,
10131014
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1014-
timeout: Optional[float] = None,
1015+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
10151016
metadata: Sequence[Tuple[str, str]] = (),
10161017
) -> operation_async.AsyncOperation:
10171018
r"""Stops the specified channel. Part of the video
@@ -1043,7 +1044,7 @@ async def sample_stop_channel():
10431044
10441045
print("Waiting for operation to complete...")
10451046
1046-
response = await operation.result()
1047+
response = (await operation).result()
10471048
10481049
# Handle the response
10491050
print(response)
@@ -1134,7 +1135,7 @@ async def create_input(
11341135
input: Optional[resources.Input] = None,
11351136
input_id: Optional[str] = None,
11361137
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1137-
timeout: Optional[float] = None,
1138+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
11381139
metadata: Sequence[Tuple[str, str]] = (),
11391140
) -> operation_async.AsyncOperation:
11401141
r"""Creates an input with the provided unique ID in the
@@ -1166,7 +1167,7 @@ async def sample_create_input():
11661167
11671168
print("Waiting for operation to complete...")
11681169
1169-
response = await operation.result()
1170+
response = (await operation).result()
11701171
11711172
# Handle the response
11721173
print(response)
@@ -1271,7 +1272,7 @@ async def list_inputs(
12711272
*,
12721273
parent: Optional[str] = None,
12731274
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1274-
timeout: Optional[float] = None,
1275+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
12751276
metadata: Sequence[Tuple[str, str]] = (),
12761277
) -> pagers.ListInputsAsyncPager:
12771278
r"""Returns a list of all inputs in the specified region.
@@ -1395,7 +1396,7 @@ async def get_input(
13951396
*,
13961397
name: Optional[str] = None,
13971398
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1398-
timeout: Optional[float] = None,
1399+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
13991400
metadata: Sequence[Tuple[str, str]] = (),
14001401
) -> resources.Input:
14011402
r"""Returns the specified input.
@@ -1508,7 +1509,7 @@ async def delete_input(
15081509
*,
15091510
name: Optional[str] = None,
15101511
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1511-
timeout: Optional[float] = None,
1512+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
15121513
metadata: Sequence[Tuple[str, str]] = (),
15131514
) -> operation_async.AsyncOperation:
15141515
r"""Deletes the specified input.
@@ -1538,7 +1539,7 @@ async def sample_delete_input():
15381539
15391540
print("Waiting for operation to complete...")
15401541
1541-
response = await operation.result()
1542+
response = (await operation).result()
15421543
15431544
# Handle the response
15441545
print(response)
@@ -1634,7 +1635,7 @@ async def update_input(
16341635
input: Optional[resources.Input] = None,
16351636
update_mask: Optional[field_mask_pb2.FieldMask] = None,
16361637
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1637-
timeout: Optional[float] = None,
1638+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
16381639
metadata: Sequence[Tuple[str, str]] = (),
16391640
) -> operation_async.AsyncOperation:
16401641
r"""Updates the specified input.
@@ -1663,7 +1664,7 @@ async def sample_update_input():
16631664
16641665
print("Waiting for operation to complete...")
16651666
1666-
response = await operation.result()
1667+
response = (await operation).result()
16671668
16681669
# Handle the response
16691670
print(response)
@@ -1770,7 +1771,7 @@ async def create_event(
17701771
event: Optional[resources.Event] = None,
17711772
event_id: Optional[str] = None,
17721773
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1773-
timeout: Optional[float] = None,
1774+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
17741775
metadata: Sequence[Tuple[str, str]] = (),
17751776
) -> resources.Event:
17761777
r"""Creates an event with the provided unique ID in the
@@ -1896,7 +1897,7 @@ async def list_events(
18961897
*,
18971898
parent: Optional[str] = None,
18981899
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1899-
timeout: Optional[float] = None,
1900+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
19001901
metadata: Sequence[Tuple[str, str]] = (),
19011902
) -> pagers.ListEventsAsyncPager:
19021903
r"""Returns a list of all events in the specified
@@ -2022,7 +2023,7 @@ async def get_event(
20222023
*,
20232024
name: Optional[str] = None,
20242025
retry: OptionalRetry = gapic_v1.method.DEFAULT,
2025-
timeout: Optional[float] = None,
2026+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
20262027
metadata: Sequence[Tuple[str, str]] = (),
20272028
) -> resources.Event:
20282029
r"""Returns the specified event.
@@ -2136,7 +2137,7 @@ async def delete_event(
21362137
*,
21372138
name: Optional[str] = None,
21382139
retry: OptionalRetry = gapic_v1.method.DEFAULT,
2139-
timeout: Optional[float] = None,
2140+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
21402141
metadata: Sequence[Tuple[str, str]] = (),
21412142
) -> None:
21422143
r"""Deletes the specified event.
@@ -2228,14 +2229,9 @@ async def __aexit__(self, exc_type, exc, tb):
22282229
await self.transport.close()
22292230

22302231

2231-
try:
2232-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
2233-
gapic_version=pkg_resources.get_distribution(
2234-
"google-cloud-video-live-stream",
2235-
).version,
2236-
)
2237-
except pkg_resources.DistributionNotFound:
2238-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
2232+
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
2233+
gapic_version=package_version.__version__
2234+
)
22392235

22402236

22412237
__all__ = ("LivestreamServiceAsyncClient",)

0 commit comments

Comments
 (0)