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

Commit 4eac6bb

Browse files
fix(deps): Require google-api-core >=1.34.0, >=2.11.0 (#416)
* 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 * 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 c116055 commit 4eac6bb

File tree

8 files changed

+71
-72
lines changed

8 files changed

+71
-72
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__ = "2.6.4" # {x-release-please-version}

google/cloud/iot_v1/services/device_manager/async_client.py

Lines changed: 24 additions & 28 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.iot_v1 import gapic_version as package_version
3839

3940
try:
4041
OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault]
@@ -232,7 +233,7 @@ async def create_device_registry(
232233
parent: Optional[str] = None,
233234
device_registry: Optional[resources.DeviceRegistry] = None,
234235
retry: OptionalRetry = gapic_v1.method.DEFAULT,
235-
timeout: Optional[float] = None,
236+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
236237
metadata: Sequence[Tuple[str, str]] = (),
237238
) -> resources.DeviceRegistry:
238239
r"""Creates a device registry that contains devices.
@@ -343,7 +344,7 @@ async def get_device_registry(
343344
*,
344345
name: Optional[str] = None,
345346
retry: OptionalRetry = gapic_v1.method.DEFAULT,
346-
timeout: Optional[float] = None,
347+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
347348
metadata: Sequence[Tuple[str, str]] = (),
348349
) -> resources.DeviceRegistry:
349350
r"""Gets a device registry configuration.
@@ -455,7 +456,7 @@ async def update_device_registry(
455456
device_registry: Optional[resources.DeviceRegistry] = None,
456457
update_mask: Optional[field_mask_pb2.FieldMask] = None,
457458
retry: OptionalRetry = gapic_v1.method.DEFAULT,
458-
timeout: Optional[float] = None,
459+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
459460
metadata: Sequence[Tuple[str, str]] = (),
460461
) -> resources.DeviceRegistry:
461462
r"""Updates a device registry configuration.
@@ -572,7 +573,7 @@ async def delete_device_registry(
572573
*,
573574
name: Optional[str] = None,
574575
retry: OptionalRetry = gapic_v1.method.DEFAULT,
575-
timeout: Optional[float] = None,
576+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
576577
metadata: Sequence[Tuple[str, str]] = (),
577578
) -> None:
578579
r"""Deletes a device registry configuration.
@@ -673,7 +674,7 @@ async def list_device_registries(
673674
*,
674675
parent: Optional[str] = None,
675676
retry: OptionalRetry = gapic_v1.method.DEFAULT,
676-
timeout: Optional[float] = None,
677+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
677678
metadata: Sequence[Tuple[str, str]] = (),
678679
) -> pagers.ListDeviceRegistriesAsyncPager:
679680
r"""Lists device registries.
@@ -798,7 +799,7 @@ async def create_device(
798799
parent: Optional[str] = None,
799800
device: Optional[resources.Device] = None,
800801
retry: OptionalRetry = gapic_v1.method.DEFAULT,
801-
timeout: Optional[float] = None,
802+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
802803
metadata: Sequence[Tuple[str, str]] = (),
803804
) -> resources.Device:
804805
r"""Creates a device in a device registry.
@@ -909,7 +910,7 @@ async def get_device(
909910
*,
910911
name: Optional[str] = None,
911912
retry: OptionalRetry = gapic_v1.method.DEFAULT,
912-
timeout: Optional[float] = None,
913+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
913914
metadata: Sequence[Tuple[str, str]] = (),
914915
) -> resources.Device:
915916
r"""Gets details about a device.
@@ -1021,7 +1022,7 @@ async def update_device(
10211022
device: Optional[resources.Device] = None,
10221023
update_mask: Optional[field_mask_pb2.FieldMask] = None,
10231024
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1024-
timeout: Optional[float] = None,
1025+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
10251026
metadata: Sequence[Tuple[str, str]] = (),
10261027
) -> resources.Device:
10271028
r"""Updates a device.
@@ -1136,7 +1137,7 @@ async def delete_device(
11361137
*,
11371138
name: Optional[str] = None,
11381139
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1139-
timeout: Optional[float] = None,
1140+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
11401141
metadata: Sequence[Tuple[str, str]] = (),
11411142
) -> None:
11421143
r"""Deletes a device.
@@ -1237,7 +1238,7 @@ async def list_devices(
12371238
*,
12381239
parent: Optional[str] = None,
12391240
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1240-
timeout: Optional[float] = None,
1241+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
12411242
metadata: Sequence[Tuple[str, str]] = (),
12421243
) -> pagers.ListDevicesAsyncPager:
12431244
r"""List devices in a device registry.
@@ -1364,7 +1365,7 @@ async def modify_cloud_to_device_config(
13641365
name: Optional[str] = None,
13651366
binary_data: Optional[bytes] = None,
13661367
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1367-
timeout: Optional[float] = None,
1368+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
13681369
metadata: Sequence[Tuple[str, str]] = (),
13691370
) -> resources.DeviceConfig:
13701371
r"""Modifies the configuration for the device, which is
@@ -1493,7 +1494,7 @@ async def list_device_config_versions(
14931494
*,
14941495
name: Optional[str] = None,
14951496
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1496-
timeout: Optional[float] = None,
1497+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
14971498
metadata: Sequence[Tuple[str, str]] = (),
14981499
) -> device_manager.ListDeviceConfigVersionsResponse:
14991500
r"""Lists the last few versions of the device
@@ -1606,7 +1607,7 @@ async def list_device_states(
16061607
*,
16071608
name: Optional[str] = None,
16081609
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1609-
timeout: Optional[float] = None,
1610+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
16101611
metadata: Sequence[Tuple[str, str]] = (),
16111612
) -> device_manager.ListDeviceStatesResponse:
16121613
r"""Lists the last few versions of the device state in
@@ -1718,7 +1719,7 @@ async def set_iam_policy(
17181719
*,
17191720
resource: Optional[str] = None,
17201721
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1721-
timeout: Optional[float] = None,
1722+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
17221723
metadata: Sequence[Tuple[str, str]] = (),
17231724
) -> policy_pb2.Policy:
17241725
r"""Sets the access control policy on the specified
@@ -1885,7 +1886,7 @@ async def get_iam_policy(
18851886
*,
18861887
resource: Optional[str] = None,
18871888
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1888-
timeout: Optional[float] = None,
1889+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
18891890
metadata: Sequence[Tuple[str, str]] = (),
18901891
) -> policy_pb2.Policy:
18911892
r"""Gets the access control policy for a resource.
@@ -2054,7 +2055,7 @@ async def test_iam_permissions(
20542055
resource: Optional[str] = None,
20552056
permissions: Optional[MutableSequence[str]] = None,
20562057
retry: OptionalRetry = gapic_v1.method.DEFAULT,
2057-
timeout: Optional[float] = None,
2058+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
20582059
metadata: Sequence[Tuple[str, str]] = (),
20592060
) -> iam_policy_pb2.TestIamPermissionsResponse:
20602061
r"""Returns permissions that a caller has on the specified resource.
@@ -2176,7 +2177,7 @@ async def send_command_to_device(
21762177
binary_data: Optional[bytes] = None,
21772178
subfolder: Optional[str] = None,
21782179
retry: OptionalRetry = gapic_v1.method.DEFAULT,
2179-
timeout: Optional[float] = None,
2180+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
21802181
metadata: Sequence[Tuple[str, str]] = (),
21812182
) -> device_manager.SendCommandToDeviceResponse:
21822183
r"""Sends a command to the specified device. In order for a device
@@ -2336,7 +2337,7 @@ async def bind_device_to_gateway(
23362337
gateway_id: Optional[str] = None,
23372338
device_id: Optional[str] = None,
23382339
retry: OptionalRetry = gapic_v1.method.DEFAULT,
2339-
timeout: Optional[float] = None,
2340+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
23402341
metadata: Sequence[Tuple[str, str]] = (),
23412342
) -> device_manager.BindDeviceToGatewayResponse:
23422343
r"""Associates the device with the gateway.
@@ -2460,7 +2461,7 @@ async def unbind_device_from_gateway(
24602461
gateway_id: Optional[str] = None,
24612462
device_id: Optional[str] = None,
24622463
retry: OptionalRetry = gapic_v1.method.DEFAULT,
2463-
timeout: Optional[float] = None,
2464+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
24642465
metadata: Sequence[Tuple[str, str]] = (),
24652466
) -> device_manager.UnbindDeviceFromGatewayResponse:
24662467
r"""Deletes the association between the device and the
@@ -2583,14 +2584,9 @@ async def __aexit__(self, exc_type, exc, tb):
25832584
await self.transport.close()
25842585

25852586

2586-
try:
2587-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
2588-
gapic_version=pkg_resources.get_distribution(
2589-
"google-cloud-iot",
2590-
).version,
2591-
)
2592-
except pkg_resources.DistributionNotFound:
2593-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
2587+
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
2588+
gapic_version=package_version.__version__
2589+
)
25942590

25952591

25962592
__all__ = ("DeviceManagerAsyncClient",)

0 commit comments

Comments
 (0)