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

Commit 9a515b5

Browse files
fix(deps): Require google-api-core >=1.34.0, >=2.11.0 (#200)
* chore: Enable requesting numeric enums in "transport=rest" responses for services supporting this (Java, Go, Python, PHP, TypeScript, C#, and Ruby), even if they do not yet turn on REST transport chore: disallow "transport=rest" for services where numeric enums are not confirmed to be supported (except in PHP and Java) PiperOrigin-RevId: 493113566 Source-Link: googleapis/googleapis@758f0d1 Source-Link: https://github.com/googleapis/googleapis-gen/commit/78bd8f05e1276363eb14eae70e91fe4bc20703ab Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNzhiZDhmMDVlMTI3NjM2M2ViMTRlYWU3MGU5MWZlNGJjMjA3MDNhYiJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * 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 * restore REST Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Anthonios Partheniou <partheniou@google.com>
1 parent 9a03bff commit 9a515b5

File tree

13 files changed

+77
-85
lines changed

13 files changed

+77
-85
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__ = "0.8.2" # {x-release-please-version}

google/cloud/dataqna_v1alpha/services/auto_suggestion_service/async_client.py

Lines changed: 6 additions & 10 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.dataqna_v1alpha import gapic_version as package_version
3839

3940
try:
4041
OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault]
@@ -291,7 +292,7 @@ async def suggest_queries(
291292
] = None,
292293
*,
293294
retry: OptionalRetry = gapic_v1.method.DEFAULT,
294-
timeout: Optional[float] = None,
295+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
295296
metadata: Sequence[Tuple[str, str]] = (),
296297
) -> auto_suggestion_service.SuggestQueriesResponse:
297298
r"""Gets a list of suggestions based on a prefix string.
@@ -371,14 +372,9 @@ async def __aexit__(self, exc_type, exc, tb):
371372
await self.transport.close()
372373

373374

374-
try:
375-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
376-
gapic_version=pkg_resources.get_distribution(
377-
"google-cloud-data-qna",
378-
).version,
379-
)
380-
except pkg_resources.DistributionNotFound:
381-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
375+
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
376+
gapic_version=package_version.__version__
377+
)
382378

383379

384380
__all__ = ("AutoSuggestionServiceAsyncClient",)

google/cloud/dataqna_v1alpha/services/auto_suggestion_service/client.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@
3838
from google.auth.transport import mtls # type: ignore
3939
from google.auth.transport.grpc import SslCredentials # type: ignore
4040
from google.oauth2 import service_account # type: ignore
41-
import pkg_resources
41+
42+
from google.cloud.dataqna_v1alpha import gapic_version as package_version
4243

4344
try:
4445
OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault]
@@ -500,7 +501,7 @@ def suggest_queries(
500501
] = None,
501502
*,
502503
retry: OptionalRetry = gapic_v1.method.DEFAULT,
503-
timeout: Optional[float] = None,
504+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
504505
metadata: Sequence[Tuple[str, str]] = (),
505506
) -> auto_suggestion_service.SuggestQueriesResponse:
506507
r"""Gets a list of suggestions based on a prefix string.
@@ -588,14 +589,9 @@ def __exit__(self, type, value, traceback):
588589
self.transport.close()
589590

590591

591-
try:
592-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
593-
gapic_version=pkg_resources.get_distribution(
594-
"google-cloud-data-qna",
595-
).version,
596-
)
597-
except pkg_resources.DistributionNotFound:
598-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
592+
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
593+
gapic_version=package_version.__version__
594+
)
599595

600596

601597
__all__ = ("AutoSuggestionServiceClient",)

google/cloud/dataqna_v1alpha/services/auto_suggestion_service/transports/base.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,13 @@
2323
import google.auth # type: ignore
2424
from google.auth import credentials as ga_credentials # type: ignore
2525
from google.oauth2 import service_account # type: ignore
26-
import pkg_resources
2726

27+
from google.cloud.dataqna_v1alpha import gapic_version as package_version
2828
from google.cloud.dataqna_v1alpha.types import auto_suggestion_service
2929

30-
try:
31-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
32-
gapic_version=pkg_resources.get_distribution(
33-
"google-cloud-data-qna",
34-
).version,
35-
)
36-
except pkg_resources.DistributionNotFound:
37-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
30+
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
31+
gapic_version=package_version.__version__
32+
)
3833

3934

4035
class AutoSuggestionServiceTransport(abc.ABC):

google/cloud/dataqna_v1alpha/services/auto_suggestion_service/transports/rest.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,13 @@ class AutoSuggestionServiceRestInterceptor:
6363
6464
.. code-block:: python
6565
class MyCustomAutoSuggestionServiceInterceptor(AutoSuggestionServiceRestInterceptor):
66-
def pre_suggest_queries(request, metadata):
66+
def pre_suggest_queries(self, request, metadata):
6767
logging.log(f"Received request: {request}")
6868
return request, metadata
6969
70-
def post_suggest_queries(response):
70+
def post_suggest_queries(self, response):
7171
logging.log(f"Received response: {response}")
72+
return response
7273
7374
transport = AutoSuggestionServiceRestTransport(interceptor=MyCustomAutoSuggestionServiceInterceptor())
7475
client = AutoSuggestionServiceClient(transport=transport)

google/cloud/dataqna_v1alpha/services/question_service/async_client.py

Lines changed: 10 additions & 14 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.dataqna_v1alpha import gapic_version as package_version
3839

3940
try:
4041
OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault]
@@ -247,7 +248,7 @@ async def get_question(
247248
*,
248249
name: Optional[str] = None,
249250
retry: OptionalRetry = gapic_v1.method.DEFAULT,
250-
timeout: Optional[float] = None,
251+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
251252
metadata: Sequence[Tuple[str, str]] = (),
252253
) -> question.Question:
253254
r"""Gets a previously created question.
@@ -353,7 +354,7 @@ async def create_question(
353354
parent: Optional[str] = None,
354355
question: Optional[gcd_question.Question] = None,
355356
retry: OptionalRetry = gapic_v1.method.DEFAULT,
356-
timeout: Optional[float] = None,
357+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
357358
metadata: Sequence[Tuple[str, str]] = (),
358359
) -> gcd_question.Question:
359360
r"""Creates a question.
@@ -472,7 +473,7 @@ async def execute_question(
472473
name: Optional[str] = None,
473474
interpretation_index: Optional[int] = None,
474475
retry: OptionalRetry = gapic_v1.method.DEFAULT,
475-
timeout: Optional[float] = None,
476+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
476477
metadata: Sequence[Tuple[str, str]] = (),
477478
) -> question.Question:
478479
r"""Executes an interpretation.
@@ -587,7 +588,7 @@ async def get_user_feedback(
587588
*,
588589
name: Optional[str] = None,
589590
retry: OptionalRetry = gapic_v1.method.DEFAULT,
590-
timeout: Optional[float] = None,
591+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
591592
metadata: Sequence[Tuple[str, str]] = (),
592593
) -> user_feedback.UserFeedback:
593594
r"""Gets previously created user feedback.
@@ -691,7 +692,7 @@ async def update_user_feedback(
691692
user_feedback: Optional[gcd_user_feedback.UserFeedback] = None,
692693
update_mask: Optional[field_mask_pb2.FieldMask] = None,
693694
retry: OptionalRetry = gapic_v1.method.DEFAULT,
694-
timeout: Optional[float] = None,
695+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
695696
metadata: Sequence[Tuple[str, str]] = (),
696697
) -> gcd_user_feedback.UserFeedback:
697698
r"""Updates user feedback. This creates user feedback if
@@ -808,14 +809,9 @@ async def __aexit__(self, exc_type, exc, tb):
808809
await self.transport.close()
809810

810811

811-
try:
812-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
813-
gapic_version=pkg_resources.get_distribution(
814-
"google-cloud-data-qna",
815-
).version,
816-
)
817-
except pkg_resources.DistributionNotFound:
818-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
812+
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
813+
gapic_version=package_version.__version__
814+
)
819815

820816

821817
__all__ = ("QuestionServiceAsyncClient",)

google/cloud/dataqna_v1alpha/services/question_service/client.py

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@
3838
from google.auth.transport import mtls # type: ignore
3939
from google.auth.transport.grpc import SslCredentials # type: ignore
4040
from google.oauth2 import service_account # type: ignore
41-
import pkg_resources
41+
42+
from google.cloud.dataqna_v1alpha import gapic_version as package_version
4243

4344
try:
4445
OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault]
@@ -497,7 +498,7 @@ def get_question(
497498
*,
498499
name: Optional[str] = None,
499500
retry: OptionalRetry = gapic_v1.method.DEFAULT,
500-
timeout: Optional[float] = None,
501+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
501502
metadata: Sequence[Tuple[str, str]] = (),
502503
) -> question.Question:
503504
r"""Gets a previously created question.
@@ -603,7 +604,7 @@ def create_question(
603604
parent: Optional[str] = None,
604605
question: Optional[gcd_question.Question] = None,
605606
retry: OptionalRetry = gapic_v1.method.DEFAULT,
606-
timeout: Optional[float] = None,
607+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
607608
metadata: Sequence[Tuple[str, str]] = (),
608609
) -> gcd_question.Question:
609610
r"""Creates a question.
@@ -722,7 +723,7 @@ def execute_question(
722723
name: Optional[str] = None,
723724
interpretation_index: Optional[int] = None,
724725
retry: OptionalRetry = gapic_v1.method.DEFAULT,
725-
timeout: Optional[float] = None,
726+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
726727
metadata: Sequence[Tuple[str, str]] = (),
727728
) -> question.Question:
728729
r"""Executes an interpretation.
@@ -837,7 +838,7 @@ def get_user_feedback(
837838
*,
838839
name: Optional[str] = None,
839840
retry: OptionalRetry = gapic_v1.method.DEFAULT,
840-
timeout: Optional[float] = None,
841+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
841842
metadata: Sequence[Tuple[str, str]] = (),
842843
) -> user_feedback.UserFeedback:
843844
r"""Gets previously created user feedback.
@@ -941,7 +942,7 @@ def update_user_feedback(
941942
user_feedback: Optional[gcd_user_feedback.UserFeedback] = None,
942943
update_mask: Optional[field_mask_pb2.FieldMask] = None,
943944
retry: OptionalRetry = gapic_v1.method.DEFAULT,
944-
timeout: Optional[float] = None,
945+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
945946
metadata: Sequence[Tuple[str, str]] = (),
946947
) -> gcd_user_feedback.UserFeedback:
947948
r"""Updates user feedback. This creates user feedback if
@@ -1065,14 +1066,9 @@ def __exit__(self, type, value, traceback):
10651066
self.transport.close()
10661067

10671068

1068-
try:
1069-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
1070-
gapic_version=pkg_resources.get_distribution(
1071-
"google-cloud-data-qna",
1072-
).version,
1073-
)
1074-
except pkg_resources.DistributionNotFound:
1075-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
1069+
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
1070+
gapic_version=package_version.__version__
1071+
)
10761072

10771073

10781074
__all__ = ("QuestionServiceClient",)

google/cloud/dataqna_v1alpha/services/question_service/transports/base.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,17 @@
2323
import google.auth # type: ignore
2424
from google.auth import credentials as ga_credentials # type: ignore
2525
from google.oauth2 import service_account # type: ignore
26-
import pkg_resources
2726

27+
from google.cloud.dataqna_v1alpha import gapic_version as package_version
2828
from google.cloud.dataqna_v1alpha.types import user_feedback as gcd_user_feedback
2929
from google.cloud.dataqna_v1alpha.types import question
3030
from google.cloud.dataqna_v1alpha.types import question as gcd_question
3131
from google.cloud.dataqna_v1alpha.types import question_service
3232
from google.cloud.dataqna_v1alpha.types import user_feedback
3333

34-
try:
35-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
36-
gapic_version=pkg_resources.get_distribution(
37-
"google-cloud-data-qna",
38-
).version,
39-
)
40-
except pkg_resources.DistributionNotFound:
41-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
34+
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
35+
gapic_version=package_version.__version__
36+
)
4237

4338

4439
class QuestionServiceTransport(abc.ABC):

google/cloud/dataqna_v1alpha/services/question_service/transports/rest.py

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -67,40 +67,45 @@ class QuestionServiceRestInterceptor:
6767
6868
.. code-block:: python
6969
class MyCustomQuestionServiceInterceptor(QuestionServiceRestInterceptor):
70-
def pre_create_question(request, metadata):
70+
def pre_create_question(self, request, metadata):
7171
logging.log(f"Received request: {request}")
7272
return request, metadata
7373
74-
def post_create_question(response):
74+
def post_create_question(self, response):
7575
logging.log(f"Received response: {response}")
76+
return response
7677
77-
def pre_execute_question(request, metadata):
78+
def pre_execute_question(self, request, metadata):
7879
logging.log(f"Received request: {request}")
7980
return request, metadata
8081
81-
def post_execute_question(response):
82+
def post_execute_question(self, response):
8283
logging.log(f"Received response: {response}")
84+
return response
8385
84-
def pre_get_question(request, metadata):
86+
def pre_get_question(self, request, metadata):
8587
logging.log(f"Received request: {request}")
8688
return request, metadata
8789
88-
def post_get_question(response):
90+
def post_get_question(self, response):
8991
logging.log(f"Received response: {response}")
92+
return response
9093
91-
def pre_get_user_feedback(request, metadata):
94+
def pre_get_user_feedback(self, request, metadata):
9295
logging.log(f"Received request: {request}")
9396
return request, metadata
9497
95-
def post_get_user_feedback(response):
98+
def post_get_user_feedback(self, response):
9699
logging.log(f"Received response: {response}")
100+
return response
97101
98-
def pre_update_user_feedback(request, metadata):
102+
def pre_update_user_feedback(self, request, metadata):
99103
logging.log(f"Received request: {request}")
100104
return request, metadata
101105
102-
def post_update_user_feedback(response):
106+
def post_update_user_feedback(self, response):
103107
logging.log(f"Received response: {response}")
108+
return response
104109
105110
transport = QuestionServiceRestTransport(interceptor=MyCustomQuestionServiceInterceptor())
106111
client = QuestionServiceClient(transport=transport)

release-please-config.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"release-type": "python",
66
"extra-files": [
77
"google/cloud/dataqna/gapic_version.py",
8+
"google/cloud/dataqna_v1alpha/gapic_version.py",
89
{
910
"type": "json",
1011
"path": "samples/generated_samples/snippet_metadata_google.cloud.dataqna.v1alpha.json",

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
release_status = "Development Status :: 5 - Production/Stable"
3737

3838
dependencies = [
39-
"google-api-core[grpc] >= 1.33.2, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*",
39+
"google-api-core[grpc] >= 1.34.0, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,!=2.8.*,!=2.9.*,!=2.10.*",
4040
"proto-plus >= 1.22.0, <2.0.0dev",
4141
"protobuf>=3.19.5,<5.0.0dev,!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5",
4242
]

testing/constraints-3.7.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
# Pin the version to the lower bound.
55
# e.g., if setup.py has "google-cloud-foo >= 1.14.0, < 2.0.0dev",
66
# Then this file should have google-cloud-foo==1.14.0
7-
google-api-core==1.33.2
7+
google-api-core==1.34.0
88
proto-plus==1.22.0
99
protobuf==3.19.5

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy