Skip to content

Commit a341b84

Browse files
fix: [google-cloud-discoveryengine] fix the location type annotation (#13149)
- [ ] Regenerate this pull request now. PiperOrigin-RevId: 684571179 Source-Link: googleapis/googleapis@fbdc238 Source-Link: googleapis/googleapis-gen@3a2cdcf Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWRpc2NvdmVyeWVuZ2luZS8uT3dsQm90LnlhbWwiLCJoIjoiM2EyY2RjZmI4MGMyZDBmNWVjMGNjNjYzYzJiYWIwYTk0ODYyMjlkMCJ9 BEGIN_NESTED_COMMIT fix!: [google-cloud-discoveryengine] fix the location type annotation PiperOrigin-RevId: 684535402 Source-Link: googleapis/googleapis@d544df7 Source-Link: googleapis/googleapis-gen@8bdbcef Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWRpc2NvdmVyeWVuZ2luZS8uT3dsQm90LnlhbWwiLCJoIjoiOGJkYmNlZjg1MTA3M2Y0OWNmOTZlNDU4NjRjNGVhZGIzN2NkN2Q2OSJ9 END_NESTED_COMMIT --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent 1b73fa1 commit a341b84

456 files changed

Lines changed: 138845 additions & 100731 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

packages/google-cloud-discoveryengine/google/cloud/discoveryengine/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "0.12.3" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-cloud-discoveryengine/google/cloud/discoveryengine_v1/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "0.12.3" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-cloud-discoveryengine/google/cloud/discoveryengine_v1/services/completion_service/async_client.py

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -818,11 +818,7 @@ async def list_operations(
818818

819819
# Wrap the RPC method; this adds retry and timeout information,
820820
# and friendly error handling.
821-
rpc = gapic_v1.method_async.wrap_method(
822-
self._client._transport.list_operations,
823-
default_timeout=None,
824-
client_info=DEFAULT_CLIENT_INFO,
825-
)
821+
rpc = self.transport._wrapped_methods[self._client._transport.list_operations]
826822

827823
# Certain fields should be provided within the metadata header;
828824
# add these here.
@@ -875,11 +871,7 @@ async def get_operation(
875871

876872
# Wrap the RPC method; this adds retry and timeout information,
877873
# and friendly error handling.
878-
rpc = gapic_v1.method_async.wrap_method(
879-
self._client._transport.get_operation,
880-
default_timeout=None,
881-
client_info=DEFAULT_CLIENT_INFO,
882-
)
874+
rpc = self.transport._wrapped_methods[self._client._transport.get_operation]
883875

884876
# Certain fields should be provided within the metadata header;
885877
# add these here.
@@ -935,11 +927,7 @@ async def cancel_operation(
935927

936928
# Wrap the RPC method; this adds retry and timeout information,
937929
# and friendly error handling.
938-
rpc = gapic_v1.method_async.wrap_method(
939-
self._client._transport.cancel_operation,
940-
default_timeout=None,
941-
client_info=DEFAULT_CLIENT_INFO,
942-
)
930+
rpc = self.transport._wrapped_methods[self._client._transport.cancel_operation]
943931

944932
# Certain fields should be provided within the metadata header;
945933
# add these here.

packages/google-cloud-discoveryengine/google/cloud/discoveryengine_v1/services/completion_service/client.py

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1253,11 +1253,7 @@ def list_operations(
12531253

12541254
# Wrap the RPC method; this adds retry and timeout information,
12551255
# and friendly error handling.
1256-
rpc = gapic_v1.method.wrap_method(
1257-
self._transport.list_operations,
1258-
default_timeout=None,
1259-
client_info=DEFAULT_CLIENT_INFO,
1260-
)
1256+
rpc = self._transport._wrapped_methods[self._transport.list_operations]
12611257

12621258
# Certain fields should be provided within the metadata header;
12631259
# add these here.
@@ -1310,11 +1306,7 @@ def get_operation(
13101306

13111307
# Wrap the RPC method; this adds retry and timeout information,
13121308
# and friendly error handling.
1313-
rpc = gapic_v1.method.wrap_method(
1314-
self._transport.get_operation,
1315-
default_timeout=None,
1316-
client_info=DEFAULT_CLIENT_INFO,
1317-
)
1309+
rpc = self._transport._wrapped_methods[self._transport.get_operation]
13181310

13191311
# Certain fields should be provided within the metadata header;
13201312
# add these here.
@@ -1370,11 +1362,7 @@ def cancel_operation(
13701362

13711363
# Wrap the RPC method; this adds retry and timeout information,
13721364
# and friendly error handling.
1373-
rpc = gapic_v1.method.wrap_method(
1374-
self._transport.cancel_operation,
1375-
default_timeout=None,
1376-
client_info=DEFAULT_CLIENT_INFO,
1377-
)
1365+
rpc = self._transport._wrapped_methods[self._transport.cancel_operation]
13781366

13791367
# Certain fields should be provided within the metadata header;
13801368
# 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+
`CompletionServiceTransport` is the ABC for all transports.
6+
- public child `CompletionServiceGrpcTransport` for sync gRPC transport (defined in `grpc.py`).
7+
- public child `CompletionServiceGrpcAsyncIOTransport` for async gRPC transport (defined in `grpc_asyncio.py`).
8+
- private child `_BaseCompletionServiceRestTransport` for base REST transport with inner classes `_BaseMETHOD` (defined in `rest_base.py`).
9+
- public child `CompletionServiceRestTransport` for sync REST transport with inner classes `METHOD` derived from the parent's corresponding `_BaseMETHOD` classes (defined in `rest.py`).

packages/google-cloud-discoveryengine/google/cloud/discoveryengine_v1/services/completion_service/transports/base.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,21 @@ def _prep_wrapped_messages(self, client_info):
159159
default_timeout=None,
160160
client_info=client_info,
161161
),
162+
self.cancel_operation: gapic_v1.method.wrap_method(
163+
self.cancel_operation,
164+
default_timeout=None,
165+
client_info=client_info,
166+
),
167+
self.get_operation: gapic_v1.method.wrap_method(
168+
self.get_operation,
169+
default_timeout=None,
170+
client_info=client_info,
171+
),
172+
self.list_operations: gapic_v1.method.wrap_method(
173+
self.list_operations,
174+
default_timeout=None,
175+
client_info=client_info,
176+
),
162177
}
163178

164179
def close(self):

packages/google-cloud-discoveryengine/google/cloud/discoveryengine_v1/services/completion_service/transports/grpc_asyncio.py

Lines changed: 33 additions & 5 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
from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union
1718
import warnings
1819

@@ -233,6 +234,9 @@ def __init__(
233234
)
234235

235236
# Wrap messages. This must be done after self._grpc_channel exists
237+
self._wrap_with_kind = (
238+
"kind" in inspect.signature(gapic_v1.method_async.wrap_method).parameters
239+
)
236240
self._prep_wrapped_messages(client_info)
237241

238242
@property
@@ -426,36 +430,60 @@ def purge_completion_suggestions(
426430
def _prep_wrapped_messages(self, client_info):
427431
"""Precompute the wrapped methods, overriding the base class method to use async wrappers."""
428432
self._wrapped_methods = {
429-
self.complete_query: gapic_v1.method_async.wrap_method(
433+
self.complete_query: self._wrap_method(
430434
self.complete_query,
431435
default_timeout=None,
432436
client_info=client_info,
433437
),
434-
self.import_suggestion_deny_list_entries: gapic_v1.method_async.wrap_method(
438+
self.import_suggestion_deny_list_entries: self._wrap_method(
435439
self.import_suggestion_deny_list_entries,
436440
default_timeout=None,
437441
client_info=client_info,
438442
),
439-
self.purge_suggestion_deny_list_entries: gapic_v1.method_async.wrap_method(
443+
self.purge_suggestion_deny_list_entries: self._wrap_method(
440444
self.purge_suggestion_deny_list_entries,
441445
default_timeout=None,
442446
client_info=client_info,
443447
),
444-
self.import_completion_suggestions: gapic_v1.method_async.wrap_method(
448+
self.import_completion_suggestions: self._wrap_method(
445449
self.import_completion_suggestions,
446450
default_timeout=None,
447451
client_info=client_info,
448452
),
449-
self.purge_completion_suggestions: gapic_v1.method_async.wrap_method(
453+
self.purge_completion_suggestions: self._wrap_method(
450454
self.purge_completion_suggestions,
451455
default_timeout=None,
452456
client_info=client_info,
453457
),
458+
self.cancel_operation: self._wrap_method(
459+
self.cancel_operation,
460+
default_timeout=None,
461+
client_info=client_info,
462+
),
463+
self.get_operation: self._wrap_method(
464+
self.get_operation,
465+
default_timeout=None,
466+
client_info=client_info,
467+
),
468+
self.list_operations: self._wrap_method(
469+
self.list_operations,
470+
default_timeout=None,
471+
client_info=client_info,
472+
),
454473
}
455474

475+
def _wrap_method(self, func, *args, **kwargs):
476+
if self._wrap_with_kind: # pragma: NO COVER
477+
kwargs["kind"] = self.kind
478+
return gapic_v1.method_async.wrap_method(func, *args, **kwargs)
479+
456480
def close(self):
457481
return self.grpc_channel.close()
458482

483+
@property
484+
def kind(self) -> str:
485+
return "grpc_asyncio"
486+
459487
@property
460488
def cancel_operation(
461489
self,

0 commit comments

Comments
 (0)