Skip to content

Commit

Permalink
chore: update gapic-generator-python (#567)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
gcf-owl-bot[bot] and gcf-owl-bot[bot] authored Oct 11, 2024
1 parent b0d38a3 commit 3e4133e
Show file tree
Hide file tree
Showing 20 changed files with 7,678 additions and 4,589 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1129,11 +1129,7 @@ async def list_operations(

# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = gapic_v1.method_async.wrap_method(
self._client._transport.list_operations,
default_timeout=None,
client_info=DEFAULT_CLIENT_INFO,
)
rpc = self.transport._wrapped_methods[self._client._transport.list_operations]

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

# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = gapic_v1.method_async.wrap_method(
self._client._transport.get_operation,
default_timeout=None,
client_info=DEFAULT_CLIENT_INFO,
)
rpc = self.transport._wrapped_methods[self._client._transport.get_operation]

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

# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = gapic_v1.method_async.wrap_method(
self._client._transport.delete_operation,
default_timeout=None,
client_info=DEFAULT_CLIENT_INFO,
)
rpc = self.transport._wrapped_methods[self._client._transport.delete_operation]

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

# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = gapic_v1.method_async.wrap_method(
self._client._transport.cancel_operation,
default_timeout=None,
client_info=DEFAULT_CLIENT_INFO,
)
rpc = self.transport._wrapped_methods[self._client._transport.cancel_operation]

# Certain fields should be provided within the metadata header;
# add these here.
Expand Down
24 changes: 4 additions & 20 deletions google/cloud/datastore_admin_v1/services/datastore_admin/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1528,11 +1528,7 @@ def list_operations(

# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = gapic_v1.method.wrap_method(
self._transport.list_operations,
default_timeout=None,
client_info=DEFAULT_CLIENT_INFO,
)
rpc = self._transport._wrapped_methods[self._transport.list_operations]

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

# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = gapic_v1.method.wrap_method(
self._transport.get_operation,
default_timeout=None,
client_info=DEFAULT_CLIENT_INFO,
)
rpc = self._transport._wrapped_methods[self._transport.get_operation]

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

# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = gapic_v1.method.wrap_method(
self._transport.delete_operation,
default_timeout=None,
client_info=DEFAULT_CLIENT_INFO,
)
rpc = self._transport._wrapped_methods[self._transport.delete_operation]

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

# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = gapic_v1.method.wrap_method(
self._transport.cancel_operation,
default_timeout=None,
client_info=DEFAULT_CLIENT_INFO,
)
rpc = self._transport._wrapped_methods[self._transport.cancel_operation]

# Certain fields should be provided within the metadata header;
# add these here.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

transport inheritance structure
_______________________________

`DatastoreAdminTransport` is the ABC for all transports.
- public child `DatastoreAdminGrpcTransport` for sync gRPC transport (defined in `grpc.py`).
- public child `DatastoreAdminGrpcAsyncIOTransport` for async gRPC transport (defined in `grpc_asyncio.py`).
- private child `_BaseDatastoreAdminRestTransport` for base REST transport with inner classes `_BaseMETHOD` (defined in `rest_base.py`).
- public child `DatastoreAdminRestTransport` for sync REST transport with inner classes `METHOD` derived from the parent's corresponding `_BaseMETHOD` classes (defined in `rest.py`).
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,26 @@ def _prep_wrapped_messages(self, client_info):
default_timeout=60.0,
client_info=client_info,
),
self.cancel_operation: gapic_v1.method.wrap_method(
self.cancel_operation,
default_timeout=None,
client_info=client_info,
),
self.delete_operation: gapic_v1.method.wrap_method(
self.delete_operation,
default_timeout=None,
client_info=client_info,
),
self.get_operation: gapic_v1.method.wrap_method(
self.get_operation,
default_timeout=None,
client_info=client_info,
),
self.list_operations: gapic_v1.method.wrap_method(
self.list_operations,
default_timeout=None,
client_info=client_info,
),
}

def close(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
import inspect
import warnings
from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union

Expand Down Expand Up @@ -284,6 +285,9 @@ def __init__(
)

# Wrap messages. This must be done after self._grpc_channel exists
self._wrap_with_kind = (
"kind" in inspect.signature(gapic_v1.method_async.wrap_method).parameters
)
self._prep_wrapped_messages(client_info)

@property
Expand Down Expand Up @@ -527,27 +531,27 @@ def list_indexes(
def _prep_wrapped_messages(self, client_info):
"""Precompute the wrapped methods, overriding the base class method to use async wrappers."""
self._wrapped_methods = {
self.export_entities: gapic_v1.method_async.wrap_method(
self.export_entities: self._wrap_method(
self.export_entities,
default_timeout=60.0,
client_info=client_info,
),
self.import_entities: gapic_v1.method_async.wrap_method(
self.import_entities: self._wrap_method(
self.import_entities,
default_timeout=60.0,
client_info=client_info,
),
self.create_index: gapic_v1.method_async.wrap_method(
self.create_index: self._wrap_method(
self.create_index,
default_timeout=60.0,
client_info=client_info,
),
self.delete_index: gapic_v1.method_async.wrap_method(
self.delete_index: self._wrap_method(
self.delete_index,
default_timeout=60.0,
client_info=client_info,
),
self.get_index: gapic_v1.method_async.wrap_method(
self.get_index: self._wrap_method(
self.get_index,
default_retry=retries.AsyncRetry(
initial=0.1,
Expand All @@ -562,7 +566,7 @@ def _prep_wrapped_messages(self, client_info):
default_timeout=60.0,
client_info=client_info,
),
self.list_indexes: gapic_v1.method_async.wrap_method(
self.list_indexes: self._wrap_method(
self.list_indexes,
default_retry=retries.AsyncRetry(
initial=0.1,
Expand All @@ -577,11 +581,40 @@ def _prep_wrapped_messages(self, client_info):
default_timeout=60.0,
client_info=client_info,
),
self.cancel_operation: self._wrap_method(
self.cancel_operation,
default_timeout=None,
client_info=client_info,
),
self.delete_operation: self._wrap_method(
self.delete_operation,
default_timeout=None,
client_info=client_info,
),
self.get_operation: self._wrap_method(
self.get_operation,
default_timeout=None,
client_info=client_info,
),
self.list_operations: self._wrap_method(
self.list_operations,
default_timeout=None,
client_info=client_info,
),
}

def _wrap_method(self, func, *args, **kwargs):
if self._wrap_with_kind: # pragma: NO COVER
kwargs["kind"] = self.kind
return gapic_v1.method_async.wrap_method(func, *args, **kwargs)

def close(self):
return self.grpc_channel.close()

@property
def kind(self) -> str:
return "grpc_asyncio"

@property
def delete_operation(
self,
Expand Down
Loading

0 comments on commit 3e4133e

Please sign in to comment.