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

fix(deps): Require google-api-core >=1.34.0, >=2.11.0 #200

Merged
merged 7 commits into from
Dec 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,3 @@ exclude_lines =
pragma: NO COVER
# Ignore debug-only repr
def __repr__
# Ignore pkg_resources exceptions.
# This is added at the module level as a safeguard for if someone
# generates the code and tries to run it without pip installing. This
# makes it virtually impossible to test properly.
except pkg_resources.DistributionNotFound
16 changes: 16 additions & 0 deletions google/cloud/dataqna_v1alpha/gapic_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# -*- coding: utf-8 -*-
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
__version__ = "0.8.2" # {x-release-please-version}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
from google.api_core.client_options import ClientOptions
from google.auth import credentials as ga_credentials # type: ignore
from google.oauth2 import service_account # type: ignore
import pkg_resources

from google.cloud.dataqna_v1alpha import gapic_version as package_version

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


try:
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
gapic_version=pkg_resources.get_distribution(
"google-cloud-data-qna",
).version,
)
except pkg_resources.DistributionNotFound:
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
gapic_version=package_version.__version__
)


__all__ = ("AutoSuggestionServiceAsyncClient",)
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@
from google.auth.transport import mtls # type: ignore
from google.auth.transport.grpc import SslCredentials # type: ignore
from google.oauth2 import service_account # type: ignore
import pkg_resources

from google.cloud.dataqna_v1alpha import gapic_version as package_version

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


try:
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
gapic_version=pkg_resources.get_distribution(
"google-cloud-data-qna",
).version,
)
except pkg_resources.DistributionNotFound:
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
gapic_version=package_version.__version__
)


__all__ = ("AutoSuggestionServiceClient",)
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,13 @@
import google.auth # type: ignore
from google.auth import credentials as ga_credentials # type: ignore
from google.oauth2 import service_account # type: ignore
import pkg_resources

from google.cloud.dataqna_v1alpha import gapic_version as package_version
from google.cloud.dataqna_v1alpha.types import auto_suggestion_service

try:
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
gapic_version=pkg_resources.get_distribution(
"google-cloud-data-qna",
).version,
)
except pkg_resources.DistributionNotFound:
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
gapic_version=package_version.__version__
)


class AutoSuggestionServiceTransport(abc.ABC):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,13 @@ class AutoSuggestionServiceRestInterceptor:

.. code-block:: python
class MyCustomAutoSuggestionServiceInterceptor(AutoSuggestionServiceRestInterceptor):
def pre_suggest_queries(request, metadata):
def pre_suggest_queries(self, request, metadata):
logging.log(f"Received request: {request}")
return request, metadata

def post_suggest_queries(response):
def post_suggest_queries(self, response):
logging.log(f"Received response: {response}")
return response

transport = AutoSuggestionServiceRestTransport(interceptor=MyCustomAutoSuggestionServiceInterceptor())
client = AutoSuggestionServiceClient(transport=transport)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
from google.api_core.client_options import ClientOptions
from google.auth import credentials as ga_credentials # type: ignore
from google.oauth2 import service_account # type: ignore
import pkg_resources

from google.cloud.dataqna_v1alpha import gapic_version as package_version

try:
OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault]
Expand Down Expand Up @@ -247,7 +248,7 @@ async def get_question(
*,
name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> question.Question:
r"""Gets a previously created question.
Expand Down Expand Up @@ -353,7 +354,7 @@ async def create_question(
parent: Optional[str] = None,
question: Optional[gcd_question.Question] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> gcd_question.Question:
r"""Creates a question.
Expand Down Expand Up @@ -472,7 +473,7 @@ async def execute_question(
name: Optional[str] = None,
interpretation_index: Optional[int] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> question.Question:
r"""Executes an interpretation.
Expand Down Expand Up @@ -587,7 +588,7 @@ async def get_user_feedback(
*,
name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> user_feedback.UserFeedback:
r"""Gets previously created user feedback.
Expand Down Expand Up @@ -691,7 +692,7 @@ async def update_user_feedback(
user_feedback: Optional[gcd_user_feedback.UserFeedback] = None,
update_mask: Optional[field_mask_pb2.FieldMask] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> gcd_user_feedback.UserFeedback:
r"""Updates user feedback. This creates user feedback if
Expand Down Expand Up @@ -808,14 +809,9 @@ async def __aexit__(self, exc_type, exc, tb):
await self.transport.close()


try:
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
gapic_version=pkg_resources.get_distribution(
"google-cloud-data-qna",
).version,
)
except pkg_resources.DistributionNotFound:
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
gapic_version=package_version.__version__
)


__all__ = ("QuestionServiceAsyncClient",)
24 changes: 10 additions & 14 deletions google/cloud/dataqna_v1alpha/services/question_service/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@
from google.auth.transport import mtls # type: ignore
from google.auth.transport.grpc import SslCredentials # type: ignore
from google.oauth2 import service_account # type: ignore
import pkg_resources

from google.cloud.dataqna_v1alpha import gapic_version as package_version

try:
OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault]
Expand Down Expand Up @@ -497,7 +498,7 @@ def get_question(
*,
name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> question.Question:
r"""Gets a previously created question.
Expand Down Expand Up @@ -603,7 +604,7 @@ def create_question(
parent: Optional[str] = None,
question: Optional[gcd_question.Question] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> gcd_question.Question:
r"""Creates a question.
Expand Down Expand Up @@ -722,7 +723,7 @@ def execute_question(
name: Optional[str] = None,
interpretation_index: Optional[int] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> question.Question:
r"""Executes an interpretation.
Expand Down Expand Up @@ -837,7 +838,7 @@ def get_user_feedback(
*,
name: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> user_feedback.UserFeedback:
r"""Gets previously created user feedback.
Expand Down Expand Up @@ -941,7 +942,7 @@ def update_user_feedback(
user_feedback: Optional[gcd_user_feedback.UserFeedback] = None,
update_mask: Optional[field_mask_pb2.FieldMask] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Optional[float] = None,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> gcd_user_feedback.UserFeedback:
r"""Updates user feedback. This creates user feedback if
Expand Down Expand Up @@ -1065,14 +1066,9 @@ def __exit__(self, type, value, traceback):
self.transport.close()


try:
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
gapic_version=pkg_resources.get_distribution(
"google-cloud-data-qna",
).version,
)
except pkg_resources.DistributionNotFound:
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
gapic_version=package_version.__version__
)


__all__ = ("QuestionServiceClient",)
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,17 @@
import google.auth # type: ignore
from google.auth import credentials as ga_credentials # type: ignore
from google.oauth2 import service_account # type: ignore
import pkg_resources

from google.cloud.dataqna_v1alpha import gapic_version as package_version
from google.cloud.dataqna_v1alpha.types import user_feedback as gcd_user_feedback
from google.cloud.dataqna_v1alpha.types import question
from google.cloud.dataqna_v1alpha.types import question as gcd_question
from google.cloud.dataqna_v1alpha.types import question_service
from google.cloud.dataqna_v1alpha.types import user_feedback

try:
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
gapic_version=pkg_resources.get_distribution(
"google-cloud-data-qna",
).version,
)
except pkg_resources.DistributionNotFound:
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
gapic_version=package_version.__version__
)


class QuestionServiceTransport(abc.ABC):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,40 +67,45 @@ class QuestionServiceRestInterceptor:

.. code-block:: python
class MyCustomQuestionServiceInterceptor(QuestionServiceRestInterceptor):
def pre_create_question(request, metadata):
def pre_create_question(self, request, metadata):
logging.log(f"Received request: {request}")
return request, metadata

def post_create_question(response):
def post_create_question(self, response):
logging.log(f"Received response: {response}")
return response

def pre_execute_question(request, metadata):
def pre_execute_question(self, request, metadata):
logging.log(f"Received request: {request}")
return request, metadata

def post_execute_question(response):
def post_execute_question(self, response):
logging.log(f"Received response: {response}")
return response

def pre_get_question(request, metadata):
def pre_get_question(self, request, metadata):
logging.log(f"Received request: {request}")
return request, metadata

def post_get_question(response):
def post_get_question(self, response):
logging.log(f"Received response: {response}")
return response

def pre_get_user_feedback(request, metadata):
def pre_get_user_feedback(self, request, metadata):
logging.log(f"Received request: {request}")
return request, metadata

def post_get_user_feedback(response):
def post_get_user_feedback(self, response):
logging.log(f"Received response: {response}")
return response

def pre_update_user_feedback(request, metadata):
def pre_update_user_feedback(self, request, metadata):
logging.log(f"Received request: {request}")
return request, metadata

def post_update_user_feedback(response):
def post_update_user_feedback(self, response):
logging.log(f"Received response: {response}")
return response

transport = QuestionServiceRestTransport(interceptor=MyCustomQuestionServiceInterceptor())
client = QuestionServiceClient(transport=transport)
Expand Down
1 change: 1 addition & 0 deletions release-please-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"release-type": "python",
"extra-files": [
"google/cloud/dataqna/gapic_version.py",
"google/cloud/dataqna_v1alpha/gapic_version.py",
{
"type": "json",
"path": "samples/generated_samples/snippet_metadata_google.cloud.dataqna.v1alpha.json",
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
release_status = "Development Status :: 5 - Production/Stable"

dependencies = [
"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.*",
"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.*",
"proto-plus >= 1.22.0, <2.0.0dev",
"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",
]
Expand Down
2 changes: 1 addition & 1 deletion testing/constraints-3.7.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
# Pin the version to the lower bound.
# e.g., if setup.py has "google-cloud-foo >= 1.14.0, < 2.0.0dev",
# Then this file should have google-cloud-foo==1.14.0
google-api-core==1.33.2
google-api-core==1.34.0
proto-plus==1.22.0
protobuf==3.19.5