Skip to content

Commit 3e4133e

Browse files
chore: update gapic-generator-python (#567)
* feat: Support for field update operators in the Datastore API and resolution strategies when there is a conflict at write time PiperOrigin-RevId: 683253625 Source-Link: googleapis/googleapis@3effbf2 Source-Link: googleapis/googleapis-gen@5dd983c Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNWRkOTgzYzc2NDE3ZjJhZDg4ZjlkNDc0MzhjNDhjMjdkNWFjMGUyNyJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * chore: Update gapic-generator-python to v1.19.1 PiperOrigin-RevId: 684571179 Source-Link: googleapis/googleapis@fbdc238 Source-Link: googleapis/googleapis-gen@3a2cdcf Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiM2EyY2RjZmI4MGMyZDBmNWVjMGNjNjYzYzJiYWIwYTk0ODYyMjlkMCJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * feat: Add FindNearest API to the stable branch PiperOrigin-RevId: 684905940 Source-Link: googleapis/googleapis@2196d48 Source-Link: googleapis/googleapis-gen@05df6fa Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMDVkZjZmYTE2YWI5M2JkOWRhMTdiNTZlZGQzNzliNDM5NjNkZTE2NyJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent b0d38a3 commit 3e4133e

File tree

20 files changed

+7678
-4589
lines changed

20 files changed

+7678
-4589
lines changed

google/cloud/datastore_admin_v1/services/datastore_admin/async_client.py

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1129,11 +1129,7 @@ async def list_operations(
11291129

11301130
# Wrap the RPC method; this adds retry and timeout information,
11311131
# and friendly error handling.
1132-
rpc = gapic_v1.method_async.wrap_method(
1133-
self._client._transport.list_operations,
1134-
default_timeout=None,
1135-
client_info=DEFAULT_CLIENT_INFO,
1136-
)
1132+
rpc = self.transport._wrapped_methods[self._client._transport.list_operations]
11371133

11381134
# Certain fields should be provided within the metadata header;
11391135
# add these here.
@@ -1186,11 +1182,7 @@ async def get_operation(
11861182

11871183
# Wrap the RPC method; this adds retry and timeout information,
11881184
# and friendly error handling.
1189-
rpc = gapic_v1.method_async.wrap_method(
1190-
self._client._transport.get_operation,
1191-
default_timeout=None,
1192-
client_info=DEFAULT_CLIENT_INFO,
1193-
)
1185+
rpc = self.transport._wrapped_methods[self._client._transport.get_operation]
11941186

11951187
# Certain fields should be provided within the metadata header;
11961188
# add these here.
@@ -1247,11 +1239,7 @@ async def delete_operation(
12471239

12481240
# Wrap the RPC method; this adds retry and timeout information,
12491241
# and friendly error handling.
1250-
rpc = gapic_v1.method_async.wrap_method(
1251-
self._client._transport.delete_operation,
1252-
default_timeout=None,
1253-
client_info=DEFAULT_CLIENT_INFO,
1254-
)
1242+
rpc = self.transport._wrapped_methods[self._client._transport.delete_operation]
12551243

12561244
# Certain fields should be provided within the metadata header;
12571245
# add these here.
@@ -1304,11 +1292,7 @@ async def cancel_operation(
13041292

13051293
# Wrap the RPC method; this adds retry and timeout information,
13061294
# and friendly error handling.
1307-
rpc = gapic_v1.method_async.wrap_method(
1308-
self._client._transport.cancel_operation,
1309-
default_timeout=None,
1310-
client_info=DEFAULT_CLIENT_INFO,
1311-
)
1295+
rpc = self.transport._wrapped_methods[self._client._transport.cancel_operation]
13121296

13131297
# Certain fields should be provided within the metadata header;
13141298
# add these here.

google/cloud/datastore_admin_v1/services/datastore_admin/client.py

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1528,11 +1528,7 @@ def list_operations(
15281528

15291529
# Wrap the RPC method; this adds retry and timeout information,
15301530
# and friendly error handling.
1531-
rpc = gapic_v1.method.wrap_method(
1532-
self._transport.list_operations,
1533-
default_timeout=None,
1534-
client_info=DEFAULT_CLIENT_INFO,
1535-
)
1531+
rpc = self._transport._wrapped_methods[self._transport.list_operations]
15361532

15371533
# Certain fields should be provided within the metadata header;
15381534
# add these here.
@@ -1585,11 +1581,7 @@ def get_operation(
15851581

15861582
# Wrap the RPC method; this adds retry and timeout information,
15871583
# and friendly error handling.
1588-
rpc = gapic_v1.method.wrap_method(
1589-
self._transport.get_operation,
1590-
default_timeout=None,
1591-
client_info=DEFAULT_CLIENT_INFO,
1592-
)
1584+
rpc = self._transport._wrapped_methods[self._transport.get_operation]
15931585

15941586
# Certain fields should be provided within the metadata header;
15951587
# add these here.
@@ -1646,11 +1638,7 @@ def delete_operation(
16461638

16471639
# Wrap the RPC method; this adds retry and timeout information,
16481640
# and friendly error handling.
1649-
rpc = gapic_v1.method.wrap_method(
1650-
self._transport.delete_operation,
1651-
default_timeout=None,
1652-
client_info=DEFAULT_CLIENT_INFO,
1653-
)
1641+
rpc = self._transport._wrapped_methods[self._transport.delete_operation]
16541642

16551643
# Certain fields should be provided within the metadata header;
16561644
# add these here.
@@ -1703,11 +1691,7 @@ def cancel_operation(
17031691

17041692
# Wrap the RPC method; this adds retry and timeout information,
17051693
# and friendly error handling.
1706-
rpc = gapic_v1.method.wrap_method(
1707-
self._transport.cancel_operation,
1708-
default_timeout=None,
1709-
client_info=DEFAULT_CLIENT_INFO,
1710-
)
1694+
rpc = self._transport._wrapped_methods[self._transport.cancel_operation]
17111695

17121696
# Certain fields should be provided within the metadata header;
17131697
# add these here.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
2+
transport inheritance structure
3+
_______________________________
4+
5+
`DatastoreAdminTransport` is the ABC for all transports.
6+
- public child `DatastoreAdminGrpcTransport` for sync gRPC transport (defined in `grpc.py`).
7+
- public child `DatastoreAdminGrpcAsyncIOTransport` for async gRPC transport (defined in `grpc_asyncio.py`).
8+
- private child `_BaseDatastoreAdminRestTransport` for base REST transport with inner classes `_BaseMETHOD` (defined in `rest_base.py`).
9+
- public child `DatastoreAdminRestTransport` for sync REST transport with inner classes `METHOD` derived from the parent's corresponding `_BaseMETHOD` classes (defined in `rest.py`).

google/cloud/datastore_admin_v1/services/datastore_admin/transports/base.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,26 @@ def _prep_wrapped_messages(self, client_info):
185185
default_timeout=60.0,
186186
client_info=client_info,
187187
),
188+
self.cancel_operation: gapic_v1.method.wrap_method(
189+
self.cancel_operation,
190+
default_timeout=None,
191+
client_info=client_info,
192+
),
193+
self.delete_operation: gapic_v1.method.wrap_method(
194+
self.delete_operation,
195+
default_timeout=None,
196+
client_info=client_info,
197+
),
198+
self.get_operation: gapic_v1.method.wrap_method(
199+
self.get_operation,
200+
default_timeout=None,
201+
client_info=client_info,
202+
),
203+
self.list_operations: gapic_v1.method.wrap_method(
204+
self.list_operations,
205+
default_timeout=None,
206+
client_info=client_info,
207+
),
188208
}
189209

190210
def close(self):

google/cloud/datastore_admin_v1/services/datastore_admin/transports/grpc_asyncio.py

Lines changed: 39 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16+
import inspect
1617
import warnings
1718
from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union
1819

@@ -284,6 +285,9 @@ def __init__(
284285
)
285286

286287
# Wrap messages. This must be done after self._grpc_channel exists
288+
self._wrap_with_kind = (
289+
"kind" in inspect.signature(gapic_v1.method_async.wrap_method).parameters
290+
)
287291
self._prep_wrapped_messages(client_info)
288292

289293
@property
@@ -527,27 +531,27 @@ def list_indexes(
527531
def _prep_wrapped_messages(self, client_info):
528532
"""Precompute the wrapped methods, overriding the base class method to use async wrappers."""
529533
self._wrapped_methods = {
530-
self.export_entities: gapic_v1.method_async.wrap_method(
534+
self.export_entities: self._wrap_method(
531535
self.export_entities,
532536
default_timeout=60.0,
533537
client_info=client_info,
534538
),
535-
self.import_entities: gapic_v1.method_async.wrap_method(
539+
self.import_entities: self._wrap_method(
536540
self.import_entities,
537541
default_timeout=60.0,
538542
client_info=client_info,
539543
),
540-
self.create_index: gapic_v1.method_async.wrap_method(
544+
self.create_index: self._wrap_method(
541545
self.create_index,
542546
default_timeout=60.0,
543547
client_info=client_info,
544548
),
545-
self.delete_index: gapic_v1.method_async.wrap_method(
549+
self.delete_index: self._wrap_method(
546550
self.delete_index,
547551
default_timeout=60.0,
548552
client_info=client_info,
549553
),
550-
self.get_index: gapic_v1.method_async.wrap_method(
554+
self.get_index: self._wrap_method(
551555
self.get_index,
552556
default_retry=retries.AsyncRetry(
553557
initial=0.1,
@@ -562,7 +566,7 @@ def _prep_wrapped_messages(self, client_info):
562566
default_timeout=60.0,
563567
client_info=client_info,
564568
),
565-
self.list_indexes: gapic_v1.method_async.wrap_method(
569+
self.list_indexes: self._wrap_method(
566570
self.list_indexes,
567571
default_retry=retries.AsyncRetry(
568572
initial=0.1,
@@ -577,11 +581,40 @@ def _prep_wrapped_messages(self, client_info):
577581
default_timeout=60.0,
578582
client_info=client_info,
579583
),
584+
self.cancel_operation: self._wrap_method(
585+
self.cancel_operation,
586+
default_timeout=None,
587+
client_info=client_info,
588+
),
589+
self.delete_operation: self._wrap_method(
590+
self.delete_operation,
591+
default_timeout=None,
592+
client_info=client_info,
593+
),
594+
self.get_operation: self._wrap_method(
595+
self.get_operation,
596+
default_timeout=None,
597+
client_info=client_info,
598+
),
599+
self.list_operations: self._wrap_method(
600+
self.list_operations,
601+
default_timeout=None,
602+
client_info=client_info,
603+
),
580604
}
581605

606+
def _wrap_method(self, func, *args, **kwargs):
607+
if self._wrap_with_kind: # pragma: NO COVER
608+
kwargs["kind"] = self.kind
609+
return gapic_v1.method_async.wrap_method(func, *args, **kwargs)
610+
582611
def close(self):
583612
return self.grpc_channel.close()
584613

614+
@property
615+
def kind(self) -> str:
616+
return "grpc_asyncio"
617+
585618
@property
586619
def delete_operation(
587620
self,

0 commit comments

Comments
 (0)