diff --git a/.flake8 b/.flake8 index 29227d4..2e43874 100644 --- a/.flake8 +++ b/.flake8 @@ -16,7 +16,7 @@ # Generated by synthtool. DO NOT EDIT! [flake8] -ignore = E203, E266, E501, W503 +ignore = E203, E231, E266, E501, W503 exclude = # Exclude generated code. **/proto/** diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 44c78f7..757c9dc 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,4 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:4e1991042fe54b991db9ca17c8fb386e61b22fe4d1472a568bf0fcac85dcf5d3 + digest: sha256:81ed5ecdfc7cac5b699ba4537376f3563f6f04122c4ec9e735d3b3dc1d43dd32 +# created: 2022-05-05T22:08:23.383410683Z diff --git a/.github/auto-approve.yml b/.github/auto-approve.yml new file mode 100644 index 0000000..311ebbb --- /dev/null +++ b/.github/auto-approve.yml @@ -0,0 +1,3 @@ +# https://github.com/googleapis/repo-automation-bots/tree/main/packages/auto-approve +processes: + - "OwlBotTemplateChanges" diff --git a/.github/auto-label.yaml b/.github/auto-label.yaml new file mode 100644 index 0000000..41bff0b --- /dev/null +++ b/.github/auto-label.yaml @@ -0,0 +1,15 @@ +# 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. +requestsize: + enabled: true diff --git a/.kokoro/docker/docs/Dockerfile b/.kokoro/docker/docs/Dockerfile index 4e1b1fb..238b87b 100644 --- a/.kokoro/docker/docs/Dockerfile +++ b/.kokoro/docker/docs/Dockerfile @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -from ubuntu:20.04 +from ubuntu:22.04 ENV DEBIAN_FRONTEND noninteractive @@ -60,8 +60,24 @@ RUN apt-get update \ && rm -rf /var/lib/apt/lists/* \ && rm -f /var/cache/apt/archives/*.deb +###################### Install python 3.8.11 + +# Download python 3.8.11 +RUN wget https://www.python.org/ftp/python/3.8.11/Python-3.8.11.tgz + +# Extract files +RUN tar -xvf Python-3.8.11.tgz + +# Install python 3.8.11 +RUN ./Python-3.8.11/configure --enable-optimizations +RUN make altinstall + +###################### Install pip RUN wget -O /tmp/get-pip.py 'https://bootstrap.pypa.io/get-pip.py' \ - && python3.8 /tmp/get-pip.py \ + && python3 /tmp/get-pip.py \ && rm /tmp/get-pip.py +# Test pip +RUN python3 -m pip + CMD ["python3.8"] diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 62eb5a7..46d2371 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -22,7 +22,7 @@ repos: - id: end-of-file-fixer - id: check-yaml - repo: https://github.com/psf/black - rev: 19.10b0 + rev: 22.3.0 hooks: - id: black - repo: https://gitlab.com/pycqa/flake8 diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e0afe5..912ceb3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,18 @@ # Changelog -### [0.6.2](https://github.com/googleapis/python-data-qna/compare/v0.6.1...v0.6.2) (2022-03-05) +## [0.6.3](https://github.com/googleapis/python-data-qna/compare/v0.6.2...v0.6.3) (2022-06-03) + + +### Bug Fixes + +* **deps:** require protobuf <4.0.0dev ([#151](https://github.com/googleapis/python-data-qna/issues/151)) ([6f292bd](https://github.com/googleapis/python-data-qna/commit/6f292bdfad46ca12a622209519af6a77a37c5132)) + + +### Documentation + +* fix changelog header to consistent size ([#152](https://github.com/googleapis/python-data-qna/issues/152)) ([07536c6](https://github.com/googleapis/python-data-qna/commit/07536c60e876a8b8d9e78545c5f3492515149c0b)) + +## [0.6.2](https://github.com/googleapis/python-data-qna/compare/v0.6.1...v0.6.2) (2022-03-05) ### Bug Fixes @@ -8,7 +20,7 @@ * **deps:** require google-api-core>=1.31.5, >=2.3.2 ([#130](https://github.com/googleapis/python-data-qna/issues/130)) ([dd16b4e](https://github.com/googleapis/python-data-qna/commit/dd16b4ec0ece088065f4d1e59dc6ba4e9b586054)) * **deps:** require proto-plus>=1.15.0 ([dd16b4e](https://github.com/googleapis/python-data-qna/commit/dd16b4ec0ece088065f4d1e59dc6ba4e9b586054)) -### [0.6.1](https://github.com/googleapis/python-data-qna/compare/v0.6.0...v0.6.1) (2022-02-26) +## [0.6.1](https://github.com/googleapis/python-data-qna/compare/v0.6.0...v0.6.1) (2022-02-26) ### Documentation @@ -27,7 +39,7 @@ * resolve DuplicateCredentialArgs error when using credentials_file ([9fe2aed](https://github.com/googleapis/python-data-qna/commit/9fe2aedd2fac78ef4771bb9c4615c5af2606d4d1)) -### [0.5.1](https://www.github.com/googleapis/python-data-qna/compare/v0.5.0...v0.5.1) (2021-11-01) +## [0.5.1](https://www.github.com/googleapis/python-data-qna/compare/v0.5.0...v0.5.1) (2021-11-01) ### Bug Fixes @@ -54,14 +66,14 @@ * add context manager support in client ([#93](https://www.github.com/googleapis/python-data-qna/issues/93)) ([9a0ef96](https://www.github.com/googleapis/python-data-qna/commit/9a0ef9636ec8deb2d7b8f0cc18eb3a2d363d5da1)) -### [0.3.3](https://www.github.com/googleapis/python-data-qna/compare/v0.3.2...v0.3.3) (2021-09-24) +## [0.3.3](https://www.github.com/googleapis/python-data-qna/compare/v0.3.2...v0.3.3) (2021-09-24) ### Bug Fixes * add 'dict' annotation type to 'request' ([149f428](https://www.github.com/googleapis/python-data-qna/commit/149f4286f073101a1013ccf07604a0b0c33b8e94)) -### [0.3.2](https://www.github.com/googleapis/python-data-qna/compare/v0.3.1...v0.3.2) (2021-07-27) +## [0.3.2](https://www.github.com/googleapis/python-data-qna/compare/v0.3.1...v0.3.2) (2021-07-27) ### Bug Fixes @@ -78,7 +90,7 @@ * release as 0.3.2 ([#72](https://www.github.com/googleapis/python-data-qna/issues/72)) ([8606b7b](https://www.github.com/googleapis/python-data-qna/commit/8606b7b3cd3cb311d9687c7d38211bb9ee07ab97)) -### [0.3.1](https://www.github.com/googleapis/python-data-qna/compare/v0.3.0...v0.3.1) (2021-07-20) +## [0.3.1](https://www.github.com/googleapis/python-data-qna/compare/v0.3.0...v0.3.1) (2021-07-20) ### Bug Fixes @@ -103,7 +115,7 @@ * omit mention of Python 2.7 in 'CONTRIBUTING.rst' ([#1127](https://www.github.com/googleapis/python-data-qna/issues/1127)) ([#54](https://www.github.com/googleapis/python-data-qna/issues/54)) ([2eb4cfb](https://www.github.com/googleapis/python-data-qna/commit/2eb4cfb449856ea2e40b2202cbba766c14ade9ce)) -### [0.2.1](https://www.github.com/googleapis/python-data-qna/compare/v0.2.0...v0.2.1) (2021-06-16) +## [0.2.1](https://www.github.com/googleapis/python-data-qna/compare/v0.2.0...v0.2.1) (2021-06-16) ### Bug Fixes @@ -125,7 +137,7 @@ * **deps:** add packaging requirement ([#46](https://www.github.com/googleapis/python-data-qna/issues/46)) ([afb3009](https://www.github.com/googleapis/python-data-qna/commit/afb3009e762aff472c07f9884469d1cee78bc660)) * remove gRPC send/recv limits ([#15](https://www.github.com/googleapis/python-data-qna/issues/15)) ([044d47a](https://www.github.com/googleapis/python-data-qna/commit/044d47ab0ab3c9ccb1b1f81fb974be6375a0cf52)) -### [0.1.1](https://www.github.com/googleapis/python-data-qna/compare/v0.1.0...v0.1.1) (2020-12-04) +## [0.1.1](https://www.github.com/googleapis/python-data-qna/compare/v0.1.0...v0.1.1) (2020-12-04) ### Documentation diff --git a/docs/conf.py b/docs/conf.py index 8ed8fc2..00158b3 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -24,9 +24,9 @@ # All configuration values have a default; values that are commented out # serve to show the default. -import sys import os import shlex +import sys # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the @@ -361,7 +361,10 @@ intersphinx_mapping = { "python": ("https://python.readthedocs.org/en/latest/", None), "google-auth": ("https://googleapis.dev/python/google-auth/latest/", None), - "google.api_core": ("https://googleapis.dev/python/google-api-core/latest/", None,), + "google.api_core": ( + "https://googleapis.dev/python/google-api-core/latest/", + None, + ), "grpc": ("https://grpc.github.io/grpc/python/", None), "proto-plus": ("https://proto-plus-python.readthedocs.io/en/latest/", None), "protobuf": ("https://googleapis.dev/python/protobuf/latest/", None), diff --git a/google/cloud/dataqna/__init__.py b/google/cloud/dataqna/__init__.py index cec6e4a..7c0ef5a 100644 --- a/google/cloud/dataqna/__init__.py +++ b/google/cloud/dataqna/__init__.py @@ -14,44 +14,43 @@ # limitations under the License. # -from google.cloud.dataqna_v1alpha.services.auto_suggestion_service.client import ( - AutoSuggestionServiceClient, -) from google.cloud.dataqna_v1alpha.services.auto_suggestion_service.async_client import ( AutoSuggestionServiceAsyncClient, ) -from google.cloud.dataqna_v1alpha.services.question_service.client import ( - QuestionServiceClient, +from google.cloud.dataqna_v1alpha.services.auto_suggestion_service.client import ( + AutoSuggestionServiceClient, ) from google.cloud.dataqna_v1alpha.services.question_service.async_client import ( QuestionServiceAsyncClient, ) - +from google.cloud.dataqna_v1alpha.services.question_service.client import ( + QuestionServiceClient, +) from google.cloud.dataqna_v1alpha.types.annotated_string import AnnotatedString -from google.cloud.dataqna_v1alpha.types.auto_suggestion_service import Suggestion -from google.cloud.dataqna_v1alpha.types.auto_suggestion_service import SuggestionInfo from google.cloud.dataqna_v1alpha.types.auto_suggestion_service import ( + Suggestion, + SuggestionInfo, + SuggestionType, SuggestQueriesRequest, -) -from google.cloud.dataqna_v1alpha.types.auto_suggestion_service import ( SuggestQueriesResponse, ) -from google.cloud.dataqna_v1alpha.types.auto_suggestion_service import SuggestionType -from google.cloud.dataqna_v1alpha.types.question import BigQueryJob -from google.cloud.dataqna_v1alpha.types.question import DataQuery -from google.cloud.dataqna_v1alpha.types.question import DebugFlags -from google.cloud.dataqna_v1alpha.types.question import ExecutionInfo -from google.cloud.dataqna_v1alpha.types.question import HumanReadable -from google.cloud.dataqna_v1alpha.types.question import Interpretation -from google.cloud.dataqna_v1alpha.types.question import InterpretationStructure -from google.cloud.dataqna_v1alpha.types.question import InterpretError -from google.cloud.dataqna_v1alpha.types.question import Question -from google.cloud.dataqna_v1alpha.types.question import InterpretEntity -from google.cloud.dataqna_v1alpha.types.question_service import CreateQuestionRequest -from google.cloud.dataqna_v1alpha.types.question_service import ExecuteQuestionRequest -from google.cloud.dataqna_v1alpha.types.question_service import GetQuestionRequest -from google.cloud.dataqna_v1alpha.types.question_service import GetUserFeedbackRequest +from google.cloud.dataqna_v1alpha.types.question import ( + BigQueryJob, + DataQuery, + DebugFlags, + ExecutionInfo, + HumanReadable, + Interpretation, + InterpretationStructure, + InterpretEntity, + InterpretError, + Question, +) from google.cloud.dataqna_v1alpha.types.question_service import ( + CreateQuestionRequest, + ExecuteQuestionRequest, + GetQuestionRequest, + GetUserFeedbackRequest, UpdateUserFeedbackRequest, ) from google.cloud.dataqna_v1alpha.types.user_feedback import UserFeedback diff --git a/google/cloud/dataqna_v1alpha/__init__.py b/google/cloud/dataqna_v1alpha/__init__.py index a47123c..18533c0 100644 --- a/google/cloud/dataqna_v1alpha/__init__.py +++ b/google/cloud/dataqna_v1alpha/__init__.py @@ -14,32 +14,38 @@ # limitations under the License. # -from .services.auto_suggestion_service import AutoSuggestionServiceClient -from .services.auto_suggestion_service import AutoSuggestionServiceAsyncClient -from .services.question_service import QuestionServiceClient -from .services.question_service import QuestionServiceAsyncClient - +from .services.auto_suggestion_service import ( + AutoSuggestionServiceAsyncClient, + AutoSuggestionServiceClient, +) +from .services.question_service import QuestionServiceAsyncClient, QuestionServiceClient from .types.annotated_string import AnnotatedString -from .types.auto_suggestion_service import Suggestion -from .types.auto_suggestion_service import SuggestionInfo -from .types.auto_suggestion_service import SuggestQueriesRequest -from .types.auto_suggestion_service import SuggestQueriesResponse -from .types.auto_suggestion_service import SuggestionType -from .types.question import BigQueryJob -from .types.question import DataQuery -from .types.question import DebugFlags -from .types.question import ExecutionInfo -from .types.question import HumanReadable -from .types.question import Interpretation -from .types.question import InterpretationStructure -from .types.question import InterpretError -from .types.question import Question -from .types.question import InterpretEntity -from .types.question_service import CreateQuestionRequest -from .types.question_service import ExecuteQuestionRequest -from .types.question_service import GetQuestionRequest -from .types.question_service import GetUserFeedbackRequest -from .types.question_service import UpdateUserFeedbackRequest +from .types.auto_suggestion_service import ( + Suggestion, + SuggestionInfo, + SuggestionType, + SuggestQueriesRequest, + SuggestQueriesResponse, +) +from .types.question import ( + BigQueryJob, + DataQuery, + DebugFlags, + ExecutionInfo, + HumanReadable, + Interpretation, + InterpretationStructure, + InterpretEntity, + InterpretError, + Question, +) +from .types.question_service import ( + CreateQuestionRequest, + ExecuteQuestionRequest, + GetQuestionRequest, + GetUserFeedbackRequest, + UpdateUserFeedbackRequest, +) from .types.user_feedback import UserFeedback __all__ = ( diff --git a/google/cloud/dataqna_v1alpha/services/auto_suggestion_service/__init__.py b/google/cloud/dataqna_v1alpha/services/auto_suggestion_service/__init__.py index db76801..2767e9f 100644 --- a/google/cloud/dataqna_v1alpha/services/auto_suggestion_service/__init__.py +++ b/google/cloud/dataqna_v1alpha/services/auto_suggestion_service/__init__.py @@ -13,8 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # -from .client import AutoSuggestionServiceClient from .async_client import AutoSuggestionServiceAsyncClient +from .client import AutoSuggestionServiceClient __all__ = ( "AutoSuggestionServiceClient", diff --git a/google/cloud/dataqna_v1alpha/services/auto_suggestion_service/async_client.py b/google/cloud/dataqna_v1alpha/services/auto_suggestion_service/async_client.py index 675420d..5491a33 100644 --- a/google/cloud/dataqna_v1alpha/services/auto_suggestion_service/async_client.py +++ b/google/cloud/dataqna_v1alpha/services/auto_suggestion_service/async_client.py @@ -16,15 +16,15 @@ from collections import OrderedDict import functools import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union -import pkg_resources +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union -from google.api_core.client_options import ClientOptions from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 from google.api_core import retry as retries +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 try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] @@ -32,9 +32,10 @@ OptionalRetry = Union[retries.Retry, object] # type: ignore from google.cloud.dataqna_v1alpha.types import auto_suggestion_service -from .transports.base import AutoSuggestionServiceTransport, DEFAULT_CLIENT_INFO -from .transports.grpc_asyncio import AutoSuggestionServiceGrpcAsyncIOTransport + from .client import AutoSuggestionServiceClient +from .transports.base import DEFAULT_CLIENT_INFO, AutoSuggestionServiceTransport +from .transports.grpc_asyncio import AutoSuggestionServiceGrpcAsyncIOTransport class AutoSuggestionServiceAsyncClient: @@ -284,14 +285,13 @@ async def suggest_queries( r"""Gets a list of suggestions based on a prefix string. AutoSuggestion tolerance should be less than 1 second. - .. code-block:: python from google.cloud import dataqna_v1alpha - def sample_suggest_queries(): + async def sample_suggest_queries(): # Create a client - client = dataqna_v1alpha.AutoSuggestionServiceClient() + client = dataqna_v1alpha.AutoSuggestionServiceAsyncClient() # Initialize request argument(s) request = dataqna_v1alpha.SuggestQueriesRequest( @@ -299,7 +299,7 @@ def sample_suggest_queries(): ) # Make the request - response = client.suggest_queries(request=request) + response = await client.suggest_queries(request=request) # Handle the response print(response) @@ -335,7 +335,12 @@ def sample_suggest_queries(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -349,7 +354,9 @@ async def __aexit__(self, exc_type, exc, tb): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-dataqna",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-dataqna", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/dataqna_v1alpha/services/auto_suggestion_service/client.py b/google/cloud/dataqna_v1alpha/services/auto_suggestion_service/client.py index e978cc6..52cf440 100644 --- a/google/cloud/dataqna_v1alpha/services/auto_suggestion_service/client.py +++ b/google/cloud/dataqna_v1alpha/services/auto_suggestion_service/client.py @@ -16,18 +16,18 @@ from collections import OrderedDict import os import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union -import pkg_resources +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union from google.api_core import client_options as client_options_lib from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 from google.api_core import retry as retries from google.auth import credentials as ga_credentials # type: ignore +from google.auth.exceptions import MutualTLSChannelError # type: ignore from google.auth.transport import mtls # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore from google.oauth2 import service_account # type: ignore +import pkg_resources try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] @@ -35,7 +35,8 @@ OptionalRetry = Union[retries.Retry, object] # type: ignore from google.cloud.dataqna_v1alpha.types import auto_suggestion_service -from .transports.base import AutoSuggestionServiceTransport, DEFAULT_CLIENT_INFO + +from .transports.base import DEFAULT_CLIENT_INFO, AutoSuggestionServiceTransport from .transports.grpc import AutoSuggestionServiceGrpcTransport from .transports.grpc_asyncio import AutoSuggestionServiceGrpcAsyncIOTransport @@ -55,7 +56,8 @@ class AutoSuggestionServiceClientMeta(type): _transport_registry["grpc_asyncio"] = AutoSuggestionServiceGrpcAsyncIOTransport def get_transport_class( - cls, label: str = None, + cls, + label: str = None, ) -> Type[AutoSuggestionServiceTransport]: """Returns an appropriate transport class. @@ -232,7 +234,9 @@ def transport(self) -> AutoSuggestionServiceTransport: return self._transport @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -245,9 +249,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -256,9 +264,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -267,9 +279,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -278,10 +294,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -466,7 +486,6 @@ def suggest_queries( r"""Gets a list of suggestions based on a prefix string. AutoSuggestion tolerance should be less than 1 second. - .. code-block:: python from google.cloud import dataqna_v1alpha @@ -518,7 +537,12 @@ def sample_suggest_queries(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -539,7 +563,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-dataqna",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-dataqna", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/dataqna_v1alpha/services/auto_suggestion_service/transports/__init__.py b/google/cloud/dataqna_v1alpha/services/auto_suggestion_service/transports/__init__.py index 31dca25..cdaa5a5 100644 --- a/google/cloud/dataqna_v1alpha/services/auto_suggestion_service/transports/__init__.py +++ b/google/cloud/dataqna_v1alpha/services/auto_suggestion_service/transports/__init__.py @@ -20,7 +20,6 @@ from .grpc import AutoSuggestionServiceGrpcTransport from .grpc_asyncio import AutoSuggestionServiceGrpcAsyncIOTransport - # Compile a registry of transports. _transport_registry = ( OrderedDict() diff --git a/google/cloud/dataqna_v1alpha/services/auto_suggestion_service/transports/base.py b/google/cloud/dataqna_v1alpha/services/auto_suggestion_service/transports/base.py index 8d4f914..4470404 100644 --- a/google/cloud/dataqna_v1alpha/services/auto_suggestion_service/transports/base.py +++ b/google/cloud/dataqna_v1alpha/services/auto_suggestion_service/transports/base.py @@ -15,21 +15,23 @@ # import abc from typing import Awaitable, Callable, Dict, Optional, Sequence, Union -import pkg_resources -import google.auth # type: ignore import google.api_core from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 from google.api_core import retry as retries +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.types import auto_suggestion_service try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-dataqna",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-dataqna", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -78,6 +80,7 @@ def __init__( always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: host += ":443" @@ -119,16 +122,18 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.suggest_queries: gapic_v1.method.wrap_method( - self.suggest_queries, default_timeout=None, client_info=client_info, + self.suggest_queries, + default_timeout=None, + client_info=client_info, ), } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() @@ -144,5 +149,9 @@ def suggest_queries( ]: raise NotImplementedError() + @property + def kind(self) -> str: + raise NotImplementedError() + __all__ = ("AutoSuggestionServiceTransport",) diff --git a/google/cloud/dataqna_v1alpha/services/auto_suggestion_service/transports/grpc.py b/google/cloud/dataqna_v1alpha/services/auto_suggestion_service/transports/grpc.py index caa5d91..6b00b11 100644 --- a/google/cloud/dataqna_v1alpha/services/auto_suggestion_service/transports/grpc.py +++ b/google/cloud/dataqna_v1alpha/services/auto_suggestion_service/transports/grpc.py @@ -13,19 +13,18 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union +import warnings -from google.api_core import grpc_helpers -from google.api_core import gapic_v1 +from google.api_core import gapic_v1, grpc_helpers import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore - import grpc # type: ignore from google.cloud.dataqna_v1alpha.types import auto_suggestion_service -from .base import AutoSuggestionServiceTransport, DEFAULT_CLIENT_INFO + +from .base import DEFAULT_CLIENT_INFO, AutoSuggestionServiceTransport class AutoSuggestionServiceGrpcTransport(AutoSuggestionServiceTransport): @@ -294,8 +293,7 @@ def create_channel( @property def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ + """Return the channel designed to connect to this service.""" return self._grpc_channel @property @@ -331,5 +329,9 @@ def suggest_queries( def close(self): self.grpc_channel.close() + @property + def kind(self) -> str: + return "grpc" + __all__ = ("AutoSuggestionServiceGrpcTransport",) diff --git a/google/cloud/dataqna_v1alpha/services/auto_suggestion_service/transports/grpc_asyncio.py b/google/cloud/dataqna_v1alpha/services/auto_suggestion_service/transports/grpc_asyncio.py index 721b7aa..9f9dc5d 100644 --- a/google/cloud/dataqna_v1alpha/services/auto_suggestion_service/transports/grpc_asyncio.py +++ b/google/cloud/dataqna_v1alpha/services/auto_suggestion_service/transports/grpc_asyncio.py @@ -13,19 +13,18 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union +import warnings -from google.api_core import gapic_v1 -from google.api_core import grpc_helpers_async +from google.api_core import gapic_v1, grpc_helpers_async from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore - import grpc # type: ignore from grpc.experimental import aio # type: ignore from google.cloud.dataqna_v1alpha.types import auto_suggestion_service -from .base import AutoSuggestionServiceTransport, DEFAULT_CLIENT_INFO + +from .base import DEFAULT_CLIENT_INFO, AutoSuggestionServiceTransport from .grpc import AutoSuggestionServiceGrpcTransport diff --git a/google/cloud/dataqna_v1alpha/services/question_service/__init__.py b/google/cloud/dataqna_v1alpha/services/question_service/__init__.py index 3bea59c..7976730 100644 --- a/google/cloud/dataqna_v1alpha/services/question_service/__init__.py +++ b/google/cloud/dataqna_v1alpha/services/question_service/__init__.py @@ -13,8 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # -from .client import QuestionServiceClient from .async_client import QuestionServiceAsyncClient +from .client import QuestionServiceClient __all__ = ( "QuestionServiceClient", diff --git a/google/cloud/dataqna_v1alpha/services/question_service/async_client.py b/google/cloud/dataqna_v1alpha/services/question_service/async_client.py index 214492e..a51844e 100644 --- a/google/cloud/dataqna_v1alpha/services/question_service/async_client.py +++ b/google/cloud/dataqna_v1alpha/services/question_service/async_client.py @@ -16,32 +16,34 @@ from collections import OrderedDict import functools import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union -import pkg_resources +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union -from google.api_core.client_options import ClientOptions from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 from google.api_core import retry as retries +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 try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] except AttributeError: # pragma: NO COVER OptionalRetry = Union[retries.Retry, object] # type: ignore +from google.protobuf import any_pb2 # type: ignore +from google.protobuf import field_mask_pb2 # type: ignore +from google.protobuf import timestamp_pb2 # type: ignore + +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 -from google.cloud.dataqna_v1alpha.types import user_feedback as gcd_user_feedback -from google.protobuf import any_pb2 # type: ignore -from google.protobuf import field_mask_pb2 # type: ignore -from google.protobuf import timestamp_pb2 # type: ignore -from .transports.base import QuestionServiceTransport, DEFAULT_CLIENT_INFO -from .transports.grpc_asyncio import QuestionServiceGrpcAsyncIOTransport + from .client import QuestionServiceClient +from .transports.base import DEFAULT_CLIENT_INFO, QuestionServiceTransport +from .transports.grpc_asyncio import QuestionServiceGrpcAsyncIOTransport class QuestionServiceAsyncClient: @@ -244,9 +246,9 @@ async def get_question( from google.cloud import dataqna_v1alpha - def sample_get_question(): + async def sample_get_question(): # Create a client - client = dataqna_v1alpha.QuestionServiceClient() + client = dataqna_v1alpha.QuestionServiceAsyncClient() # Initialize request argument(s) request = dataqna_v1alpha.GetQuestionRequest( @@ -254,7 +256,7 @@ def sample_get_question(): ) # Make the request - response = client.get_question(request=request) + response = await client.get_question(request=request) # Handle the response print(response) @@ -317,7 +319,12 @@ def sample_get_question(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -338,9 +345,9 @@ async def create_question( from google.cloud import dataqna_v1alpha - def sample_create_question(): + async def sample_create_question(): # Create a client - client = dataqna_v1alpha.QuestionServiceClient() + client = dataqna_v1alpha.QuestionServiceAsyncClient() # Initialize request argument(s) question = dataqna_v1alpha.Question() @@ -353,7 +360,7 @@ def sample_create_question(): ) # Make the request - response = client.create_question(request=request) + response = await client.create_question(request=request) # Handle the response print(response) @@ -424,7 +431,12 @@ def sample_create_question(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -445,9 +457,9 @@ async def execute_question( from google.cloud import dataqna_v1alpha - def sample_execute_question(): + async def sample_execute_question(): # Create a client - client = dataqna_v1alpha.QuestionServiceClient() + client = dataqna_v1alpha.QuestionServiceAsyncClient() # Initialize request argument(s) request = dataqna_v1alpha.ExecuteQuestionRequest( @@ -456,7 +468,7 @@ def sample_execute_question(): ) # Make the request - response = client.execute_question(request=request) + response = await client.execute_question(request=request) # Handle the response print(response) @@ -528,7 +540,12 @@ def sample_execute_question(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -548,9 +565,9 @@ async def get_user_feedback( from google.cloud import dataqna_v1alpha - def sample_get_user_feedback(): + async def sample_get_user_feedback(): # Create a client - client = dataqna_v1alpha.QuestionServiceClient() + client = dataqna_v1alpha.QuestionServiceAsyncClient() # Initialize request argument(s) request = dataqna_v1alpha.GetUserFeedbackRequest( @@ -558,7 +575,7 @@ def sample_get_user_feedback(): ) # Make the request - response = client.get_user_feedback(request=request) + response = await client.get_user_feedback(request=request) # Handle the response print(response) @@ -617,7 +634,12 @@ def sample_get_user_feedback(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -635,14 +657,13 @@ async def update_user_feedback( r"""Updates user feedback. This creates user feedback if there was none before (upsert). - .. code-block:: python from google.cloud import dataqna_v1alpha - def sample_update_user_feedback(): + async def sample_update_user_feedback(): # Create a client - client = dataqna_v1alpha.QuestionServiceClient() + client = dataqna_v1alpha.QuestionServiceAsyncClient() # Initialize request argument(s) user_feedback = dataqna_v1alpha.UserFeedback() @@ -653,7 +674,7 @@ def sample_update_user_feedback(): ) # Make the request - response = client.update_user_feedback(request=request) + response = await client.update_user_feedback(request=request) # Handle the response print(response) @@ -723,7 +744,12 @@ def sample_update_user_feedback(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -737,7 +763,9 @@ async def __aexit__(self, exc_type, exc, tb): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-dataqna",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-dataqna", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/dataqna_v1alpha/services/question_service/client.py b/google/cloud/dataqna_v1alpha/services/question_service/client.py index fc0f5c0..d82d37b 100644 --- a/google/cloud/dataqna_v1alpha/services/question_service/client.py +++ b/google/cloud/dataqna_v1alpha/services/question_service/client.py @@ -16,33 +16,35 @@ from collections import OrderedDict import os import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union -import pkg_resources +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union from google.api_core import client_options as client_options_lib from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 from google.api_core import retry as retries from google.auth import credentials as ga_credentials # type: ignore +from google.auth.exceptions import MutualTLSChannelError # type: ignore from google.auth.transport import mtls # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore from google.oauth2 import service_account # type: ignore +import pkg_resources try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] except AttributeError: # pragma: NO COVER OptionalRetry = Union[retries.Retry, object] # type: ignore +from google.protobuf import any_pb2 # type: ignore +from google.protobuf import field_mask_pb2 # type: ignore +from google.protobuf import timestamp_pb2 # type: ignore + +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 -from google.cloud.dataqna_v1alpha.types import user_feedback as gcd_user_feedback -from google.protobuf import any_pb2 # type: ignore -from google.protobuf import field_mask_pb2 # type: ignore -from google.protobuf import timestamp_pb2 # type: ignore -from .transports.base import QuestionServiceTransport, DEFAULT_CLIENT_INFO + +from .transports.base import DEFAULT_CLIENT_INFO, QuestionServiceTransport from .transports.grpc import QuestionServiceGrpcTransport from .transports.grpc_asyncio import QuestionServiceGrpcAsyncIOTransport @@ -61,7 +63,10 @@ class QuestionServiceClientMeta(type): _transport_registry["grpc"] = QuestionServiceGrpcTransport _transport_registry["grpc_asyncio"] = QuestionServiceGrpcAsyncIOTransport - def get_transport_class(cls, label: str = None,) -> Type[QuestionServiceTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[QuestionServiceTransport]: """Returns an appropriate transport class. Args: @@ -183,10 +188,16 @@ def transport(self) -> QuestionServiceTransport: return self._transport @staticmethod - def question_path(project: str, location: str, question: str,) -> str: + def question_path( + project: str, + location: str, + question: str, + ) -> str: """Returns a fully-qualified question string.""" return "projects/{project}/locations/{location}/questions/{question}".format( - project=project, location=location, question=question, + project=project, + location=location, + question=question, ) @staticmethod @@ -199,10 +210,16 @@ def parse_question_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def user_feedback_path(project: str, location: str, question: str,) -> str: + def user_feedback_path( + project: str, + location: str, + question: str, + ) -> str: """Returns a fully-qualified user_feedback string.""" return "projects/{project}/locations/{location}/questions/{question}/userFeedback".format( - project=project, location=location, question=question, + project=project, + location=location, + question=question, ) @staticmethod @@ -215,7 +232,9 @@ def parse_user_feedback_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -228,9 +247,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -239,9 +262,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -250,9 +277,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -261,10 +292,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -526,7 +561,12 @@ def sample_get_question(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -633,7 +673,12 @@ def sample_create_question(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -737,7 +782,12 @@ def sample_execute_question(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -826,7 +876,12 @@ def sample_get_user_feedback(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -844,7 +899,6 @@ def update_user_feedback( r"""Updates user feedback. This creates user feedback if there was none before (upsert). - .. code-block:: python from google.cloud import dataqna_v1alpha @@ -932,7 +986,12 @@ def sample_update_user_feedback(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -953,7 +1012,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-dataqna",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-dataqna", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/dataqna_v1alpha/services/question_service/transports/__init__.py b/google/cloud/dataqna_v1alpha/services/question_service/transports/__init__.py index 45be22a..80e9be5 100644 --- a/google/cloud/dataqna_v1alpha/services/question_service/transports/__init__.py +++ b/google/cloud/dataqna_v1alpha/services/question_service/transports/__init__.py @@ -20,7 +20,6 @@ from .grpc import QuestionServiceGrpcTransport from .grpc_asyncio import QuestionServiceGrpcAsyncIOTransport - # Compile a registry of transports. _transport_registry = OrderedDict() # type: Dict[str, Type[QuestionServiceTransport]] _transport_registry["grpc"] = QuestionServiceGrpcTransport diff --git a/google/cloud/dataqna_v1alpha/services/question_service/transports/base.py b/google/cloud/dataqna_v1alpha/services/question_service/transports/base.py index 2c4c790..7777645 100644 --- a/google/cloud/dataqna_v1alpha/services/question_service/transports/base.py +++ b/google/cloud/dataqna_v1alpha/services/question_service/transports/base.py @@ -15,25 +15,27 @@ # import abc from typing import Awaitable, Callable, Dict, Optional, Sequence, Union -import pkg_resources -import google.auth # type: ignore import google.api_core from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 from google.api_core import retry as retries +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.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 -from google.cloud.dataqna_v1alpha.types import user_feedback as gcd_user_feedback try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-dataqna",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-dataqna", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -82,6 +84,7 @@ def __init__( always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: host += ":443" @@ -123,16 +126,24 @@ def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { self.get_question: gapic_v1.method.wrap_method( - self.get_question, default_timeout=None, client_info=client_info, + self.get_question, + default_timeout=None, + client_info=client_info, ), self.create_question: gapic_v1.method.wrap_method( - self.create_question, default_timeout=60.0, client_info=client_info, + self.create_question, + default_timeout=60.0, + client_info=client_info, ), self.execute_question: gapic_v1.method.wrap_method( - self.execute_question, default_timeout=60.0, client_info=client_info, + self.execute_question, + default_timeout=60.0, + client_info=client_info, ), self.get_user_feedback: gapic_v1.method.wrap_method( - self.get_user_feedback, default_timeout=None, client_info=client_info, + self.get_user_feedback, + default_timeout=None, + client_info=client_info, ), self.update_user_feedback: gapic_v1.method.wrap_method( self.update_user_feedback, @@ -144,9 +155,9 @@ def _prep_wrapped_messages(self, client_info): def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() @@ -197,5 +208,9 @@ def update_user_feedback( ]: raise NotImplementedError() + @property + def kind(self) -> str: + raise NotImplementedError() + __all__ = ("QuestionServiceTransport",) diff --git a/google/cloud/dataqna_v1alpha/services/question_service/transports/grpc.py b/google/cloud/dataqna_v1alpha/services/question_service/transports/grpc.py index 0eb6998..857bb0d 100644 --- a/google/cloud/dataqna_v1alpha/services/question_service/transports/grpc.py +++ b/google/cloud/dataqna_v1alpha/services/question_service/transports/grpc.py @@ -13,23 +13,22 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union +import warnings -from google.api_core import grpc_helpers -from google.api_core import gapic_v1 +from google.api_core import gapic_v1, grpc_helpers import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore - import grpc # type: ignore +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 -from google.cloud.dataqna_v1alpha.types import user_feedback as gcd_user_feedback -from .base import QuestionServiceTransport, DEFAULT_CLIENT_INFO + +from .base import DEFAULT_CLIENT_INFO, QuestionServiceTransport class QuestionServiceGrpcTransport(QuestionServiceTransport): @@ -244,8 +243,7 @@ def create_channel( @property def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ + """Return the channel designed to connect to this service.""" return self._grpc_channel @property @@ -386,5 +384,9 @@ def update_user_feedback( def close(self): self.grpc_channel.close() + @property + def kind(self) -> str: + return "grpc" + __all__ = ("QuestionServiceGrpcTransport",) diff --git a/google/cloud/dataqna_v1alpha/services/question_service/transports/grpc_asyncio.py b/google/cloud/dataqna_v1alpha/services/question_service/transports/grpc_asyncio.py index bc8b92c..befbf1c 100644 --- a/google/cloud/dataqna_v1alpha/services/question_service/transports/grpc_asyncio.py +++ b/google/cloud/dataqna_v1alpha/services/question_service/transports/grpc_asyncio.py @@ -13,23 +13,22 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union +import warnings -from google.api_core import gapic_v1 -from google.api_core import grpc_helpers_async +from google.api_core import gapic_v1, grpc_helpers_async from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore - import grpc # type: ignore from grpc.experimental import aio # type: ignore +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 -from google.cloud.dataqna_v1alpha.types import user_feedback as gcd_user_feedback -from .base import QuestionServiceTransport, DEFAULT_CLIENT_INFO + +from .base import DEFAULT_CLIENT_INFO, QuestionServiceTransport from .grpc import QuestionServiceGrpcTransport diff --git a/google/cloud/dataqna_v1alpha/types/__init__.py b/google/cloud/dataqna_v1alpha/types/__init__.py index eeafb1f..3c9be40 100644 --- a/google/cloud/dataqna_v1alpha/types/__init__.py +++ b/google/cloud/dataqna_v1alpha/types/__init__.py @@ -17,9 +17,9 @@ from .auto_suggestion_service import ( Suggestion, SuggestionInfo, + SuggestionType, SuggestQueriesRequest, SuggestQueriesResponse, - SuggestionType, ) from .question import ( BigQueryJob, @@ -29,9 +29,9 @@ HumanReadable, Interpretation, InterpretationStructure, + InterpretEntity, InterpretError, Question, - InterpretEntity, ) from .question_service import ( CreateQuestionRequest, diff --git a/google/cloud/dataqna_v1alpha/types/annotated_string.py b/google/cloud/dataqna_v1alpha/types/annotated_string.py index 753d86e..c678b50 100644 --- a/google/cloud/dataqna_v1alpha/types/annotated_string.py +++ b/google/cloud/dataqna_v1alpha/types/annotated_string.py @@ -15,9 +15,11 @@ # import proto # type: ignore - __protobuf__ = proto.module( - package="google.cloud.dataqna.v1alpha", manifest={"AnnotatedString",}, + package="google.cloud.dataqna.v1alpha", + manifest={ + "AnnotatedString", + }, ) @@ -87,14 +89,32 @@ class SemanticMarkup(proto.Message): """ type_ = proto.Field( - proto.ENUM, number=1, enum="AnnotatedString.SemanticMarkupType", + proto.ENUM, + number=1, + enum="AnnotatedString.SemanticMarkupType", + ) + start_char_index = proto.Field( + proto.INT32, + number=2, + ) + length = proto.Field( + proto.INT32, + number=3, ) - start_char_index = proto.Field(proto.INT32, number=2,) - length = proto.Field(proto.INT32, number=3,) - text_formatted = proto.Field(proto.STRING, number=1,) - html_formatted = proto.Field(proto.STRING, number=2,) - markups = proto.RepeatedField(proto.MESSAGE, number=3, message=SemanticMarkup,) + text_formatted = proto.Field( + proto.STRING, + number=1, + ) + html_formatted = proto.Field( + proto.STRING, + number=2, + ) + markups = proto.RepeatedField( + proto.MESSAGE, + number=3, + message=SemanticMarkup, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/dataqna_v1alpha/types/auto_suggestion_service.py b/google/cloud/dataqna_v1alpha/types/auto_suggestion_service.py index 05d11db..8496457 100644 --- a/google/cloud/dataqna_v1alpha/types/auto_suggestion_service.py +++ b/google/cloud/dataqna_v1alpha/types/auto_suggestion_service.py @@ -17,7 +17,6 @@ from google.cloud.dataqna_v1alpha.types import annotated_string - __protobuf__ = proto.module( package="google.cloud.dataqna.v1alpha", manifest={ @@ -65,10 +64,23 @@ class SuggestQueriesRequest(proto.Message): cut these suggestions off. """ - parent = proto.Field(proto.STRING, number=1,) - scopes = proto.RepeatedField(proto.STRING, number=2,) - query = proto.Field(proto.STRING, number=3,) - suggestion_types = proto.RepeatedField(proto.ENUM, number=4, enum="SuggestionType",) + parent = proto.Field( + proto.STRING, + number=1, + ) + scopes = proto.RepeatedField( + proto.STRING, + number=2, + ) + query = proto.Field( + proto.STRING, + number=3, + ) + suggestion_types = proto.RepeatedField( + proto.ENUM, + number=4, + enum="SuggestionType", + ) class Suggestion(proto.Message): @@ -86,9 +98,20 @@ class Suggestion(proto.Message): The type of the suggestion. """ - suggestion_info = proto.Field(proto.MESSAGE, number=1, message="SuggestionInfo",) - ranking_score = proto.Field(proto.DOUBLE, number=2,) - suggestion_type = proto.Field(proto.ENUM, number=3, enum="SuggestionType",) + suggestion_info = proto.Field( + proto.MESSAGE, + number=1, + message="SuggestionInfo", + ) + ranking_score = proto.Field( + proto.DOUBLE, + number=2, + ) + suggestion_type = proto.Field( + proto.ENUM, + number=3, + enum="SuggestionType", + ) class SuggestionInfo(proto.Message): @@ -140,13 +163,25 @@ class MatchInfo(proto.Message): substring. """ - start_char_index = proto.Field(proto.INT32, number=1,) - length = proto.Field(proto.INT32, number=2,) + start_char_index = proto.Field( + proto.INT32, + number=1, + ) + length = proto.Field( + proto.INT32, + number=2, + ) annotated_suggestion = proto.Field( - proto.MESSAGE, number=1, message=annotated_string.AnnotatedString, + proto.MESSAGE, + number=1, + message=annotated_string.AnnotatedString, + ) + query_matches = proto.RepeatedField( + proto.MESSAGE, + number=2, + message=MatchInfo, ) - query_matches = proto.RepeatedField(proto.MESSAGE, number=2, message=MatchInfo,) class SuggestQueriesResponse(proto.Message): @@ -157,7 +192,11 @@ class SuggestQueriesResponse(proto.Message): A list of suggestions. """ - suggestions = proto.RepeatedField(proto.MESSAGE, number=1, message="Suggestion",) + suggestions = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="Suggestion", + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/dataqna_v1alpha/types/question.py b/google/cloud/dataqna_v1alpha/types/question.py index 1f70933..a39684d 100644 --- a/google/cloud/dataqna_v1alpha/types/question.py +++ b/google/cloud/dataqna_v1alpha/types/question.py @@ -13,13 +13,12 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import proto # type: ignore - -from google.cloud.dataqna_v1alpha.types import annotated_string from google.protobuf import any_pb2 # type: ignore from google.protobuf import timestamp_pb2 # type: ignore from google.rpc import status_pb2 # type: ignore +import proto # type: ignore +from google.cloud.dataqna_v1alpha.types import annotated_string __protobuf__ = proto.module( package="google.cloud.dataqna.v1alpha", @@ -102,18 +101,51 @@ class Question(proto.Message): message. """ - name = proto.Field(proto.STRING, number=1,) - scopes = proto.RepeatedField(proto.STRING, number=2,) - query = proto.Field(proto.STRING, number=3,) - data_source_annotations = proto.RepeatedField(proto.STRING, number=4,) - interpret_error = proto.Field(proto.MESSAGE, number=5, message="InterpretError",) + name = proto.Field( + proto.STRING, + number=1, + ) + scopes = proto.RepeatedField( + proto.STRING, + number=2, + ) + query = proto.Field( + proto.STRING, + number=3, + ) + data_source_annotations = proto.RepeatedField( + proto.STRING, + number=4, + ) + interpret_error = proto.Field( + proto.MESSAGE, + number=5, + message="InterpretError", + ) interpretations = proto.RepeatedField( - proto.MESSAGE, number=6, message="Interpretation", + proto.MESSAGE, + number=6, + message="Interpretation", + ) + create_time = proto.Field( + proto.MESSAGE, + number=7, + message=timestamp_pb2.Timestamp, + ) + user_email = proto.Field( + proto.STRING, + number=8, + ) + debug_flags = proto.Field( + proto.MESSAGE, + number=9, + message="DebugFlags", + ) + debug_info = proto.Field( + proto.MESSAGE, + number=10, + message=any_pb2.Any, ) - create_time = proto.Field(proto.MESSAGE, number=7, message=timestamp_pb2.Timestamp,) - user_email = proto.Field(proto.STRING, number=8,) - debug_flags = proto.Field(proto.MESSAGE, number=9, message="DebugFlags",) - debug_info = proto.Field(proto.MESSAGE, number=10, message=any_pb2.Any,) class InterpretError(proto.Message): @@ -163,7 +195,9 @@ class InterpretErrorDetails(proto.Message): message="InterpretError.InterpretIncompleteQueryDetails", ) ambiguity_details = proto.Field( - proto.MESSAGE, number=3, message="InterpretError.InterpretAmbiguityDetails", + proto.MESSAGE, + number=3, + message="InterpretError.InterpretAmbiguityDetails", ) class InterpretUnsupportedDetails(proto.Message): @@ -176,8 +210,14 @@ class InterpretUnsupportedDetails(proto.Message): Unsupported intents. """ - operators = proto.RepeatedField(proto.STRING, number=1,) - intent = proto.RepeatedField(proto.STRING, number=2,) + operators = proto.RepeatedField( + proto.STRING, + number=1, + ) + intent = proto.RepeatedField( + proto.STRING, + number=2, + ) class InterpretIncompleteQueryDetails(proto.Message): r"""Details about an incomplete query. @@ -187,7 +227,11 @@ class InterpretIncompleteQueryDetails(proto.Message): List of missing interpret entities. """ - entities = proto.RepeatedField(proto.ENUM, number=1, enum="InterpretEntity",) + entities = proto.RepeatedField( + proto.ENUM, + number=1, + enum="InterpretEntity", + ) class InterpretAmbiguityDetails(proto.Message): r"""Details about a query that was too ambiguous. Currently, the @@ -196,9 +240,20 @@ class InterpretAmbiguityDetails(proto.Message): """ - message = proto.Field(proto.STRING, number=1,) - code = proto.Field(proto.ENUM, number=2, enum=InterpretErrorCode,) - details = proto.Field(proto.MESSAGE, number=3, message=InterpretErrorDetails,) + message = proto.Field( + proto.STRING, + number=1, + ) + code = proto.Field( + proto.ENUM, + number=2, + enum=InterpretErrorCode, + ) + details = proto.Field( + proto.MESSAGE, + number=3, + message=InterpretErrorDetails, + ) class ExecutionInfo(proto.Message): @@ -229,11 +284,25 @@ class JobExecutionState(proto.Enum): FAILED = 4 job_creation_status = proto.Field( - proto.MESSAGE, number=1, message=status_pb2.Status, + proto.MESSAGE, + number=1, + message=status_pb2.Status, + ) + job_execution_state = proto.Field( + proto.ENUM, + number=2, + enum=JobExecutionState, + ) + create_time = proto.Field( + proto.MESSAGE, + number=3, + message=timestamp_pb2.Timestamp, + ) + bigquery_job = proto.Field( + proto.MESSAGE, + number=4, + message="BigQueryJob", ) - job_execution_state = proto.Field(proto.ENUM, number=2, enum=JobExecutionState,) - create_time = proto.Field(proto.MESSAGE, number=3, message=timestamp_pb2.Timestamp,) - bigquery_job = proto.Field(proto.MESSAGE, number=4, message="BigQueryJob",) class BigQueryJob(proto.Message): @@ -250,9 +319,18 @@ class BigQueryJob(proto.Message): The location where the job is running. """ - job_id = proto.Field(proto.STRING, number=1,) - project_id = proto.Field(proto.STRING, number=2,) - location = proto.Field(proto.STRING, number=3,) + job_id = proto.Field( + proto.STRING, + number=1, + ) + project_id = proto.Field( + proto.STRING, + number=2, + ) + location = proto.Field( + proto.STRING, + number=3, + ) class Interpretation(proto.Message): @@ -286,15 +364,38 @@ class Interpretation(proto.Message): interpretation was requested. """ - data_sources = proto.RepeatedField(proto.STRING, number=1,) - confidence = proto.Field(proto.DOUBLE, number=2,) - unused_phrases = proto.RepeatedField(proto.STRING, number=3,) - human_readable = proto.Field(proto.MESSAGE, number=4, message="HumanReadable",) + data_sources = proto.RepeatedField( + proto.STRING, + number=1, + ) + confidence = proto.Field( + proto.DOUBLE, + number=2, + ) + unused_phrases = proto.RepeatedField( + proto.STRING, + number=3, + ) + human_readable = proto.Field( + proto.MESSAGE, + number=4, + message="HumanReadable", + ) interpretation_structure = proto.Field( - proto.MESSAGE, number=5, message="InterpretationStructure", + proto.MESSAGE, + number=5, + message="InterpretationStructure", + ) + data_query = proto.Field( + proto.MESSAGE, + number=6, + message="DataQuery", + ) + execution_info = proto.Field( + proto.MESSAGE, + number=7, + message="ExecutionInfo", ) - data_query = proto.Field(proto.MESSAGE, number=6, message="DataQuery",) - execution_info = proto.Field(proto.MESSAGE, number=7, message="ExecutionInfo",) class DataQuery(proto.Message): @@ -311,7 +412,10 @@ class DataQuery(proto.Message): backend. """ - sql = proto.Field(proto.STRING, number=1,) + sql = proto.Field( + proto.STRING, + number=1, + ) class HumanReadable(proto.Message): @@ -326,10 +430,14 @@ class HumanReadable(proto.Message): """ generated_interpretation = proto.Field( - proto.MESSAGE, number=1, message=annotated_string.AnnotatedString, + proto.MESSAGE, + number=1, + message=annotated_string.AnnotatedString, ) original_question = proto.Field( - proto.MESSAGE, number=2, message=annotated_string.AnnotatedString, + proto.MESSAGE, + number=2, + message=annotated_string.AnnotatedString, ) @@ -379,13 +487,25 @@ class ColumnInfo(proto.Message): Human readable name of the output column. """ - output_alias = proto.Field(proto.STRING, number=1,) - display_name = proto.Field(proto.STRING, number=2,) + output_alias = proto.Field( + proto.STRING, + number=1, + ) + display_name = proto.Field( + proto.STRING, + number=2, + ) visualization_types = proto.RepeatedField( - proto.ENUM, number=1, enum=VisualizationType, + proto.ENUM, + number=1, + enum=VisualizationType, + ) + column_info = proto.RepeatedField( + proto.MESSAGE, + number=2, + message=ColumnInfo, ) - column_info = proto.RepeatedField(proto.MESSAGE, number=2, message=ColumnInfo,) class DebugFlags(proto.Message): @@ -431,18 +551,54 @@ class DebugFlags(proto.Message): Whether to include the domain list. """ - include_va_query = proto.Field(proto.BOOL, number=1,) - include_nested_va_query = proto.Field(proto.BOOL, number=2,) - include_human_interpretation = proto.Field(proto.BOOL, number=3,) - include_aqua_debug_response = proto.Field(proto.BOOL, number=4,) - time_override = proto.Field(proto.INT64, number=5,) - is_internal_google_user = proto.Field(proto.BOOL, number=6,) - ignore_cache = proto.Field(proto.BOOL, number=7,) - include_search_entities_rpc = proto.Field(proto.BOOL, number=8,) - include_list_column_annotations_rpc = proto.Field(proto.BOOL, number=9,) - include_virtual_analyst_entities = proto.Field(proto.BOOL, number=10,) - include_table_list = proto.Field(proto.BOOL, number=11,) - include_domain_list = proto.Field(proto.BOOL, number=12,) + include_va_query = proto.Field( + proto.BOOL, + number=1, + ) + include_nested_va_query = proto.Field( + proto.BOOL, + number=2, + ) + include_human_interpretation = proto.Field( + proto.BOOL, + number=3, + ) + include_aqua_debug_response = proto.Field( + proto.BOOL, + number=4, + ) + time_override = proto.Field( + proto.INT64, + number=5, + ) + is_internal_google_user = proto.Field( + proto.BOOL, + number=6, + ) + ignore_cache = proto.Field( + proto.BOOL, + number=7, + ) + include_search_entities_rpc = proto.Field( + proto.BOOL, + number=8, + ) + include_list_column_annotations_rpc = proto.Field( + proto.BOOL, + number=9, + ) + include_virtual_analyst_entities = proto.Field( + proto.BOOL, + number=10, + ) + include_table_list = proto.Field( + proto.BOOL, + number=11, + ) + include_domain_list = proto.Field( + proto.BOOL, + number=12, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/dataqna_v1alpha/types/question_service.py b/google/cloud/dataqna_v1alpha/types/question_service.py index da1f0b7..6dea834 100644 --- a/google/cloud/dataqna_v1alpha/types/question_service.py +++ b/google/cloud/dataqna_v1alpha/types/question_service.py @@ -13,12 +13,11 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from google.protobuf import field_mask_pb2 # type: ignore import proto # type: ignore -from google.cloud.dataqna_v1alpha.types import question as gcd_question from google.cloud.dataqna_v1alpha.types import user_feedback as gcd_user_feedback -from google.protobuf import field_mask_pb2 # type: ignore - +from google.cloud.dataqna_v1alpha.types import question as gcd_question __protobuf__ = proto.module( package="google.cloud.dataqna.v1alpha", @@ -43,8 +42,15 @@ class GetQuestionRequest(proto.Message): The list of fields to be retrieved. """ - name = proto.Field(proto.STRING, number=1,) - read_mask = proto.Field(proto.MESSAGE, number=2, message=field_mask_pb2.FieldMask,) + name = proto.Field( + proto.STRING, + number=1, + ) + read_mask = proto.Field( + proto.MESSAGE, + number=2, + message=field_mask_pb2.FieldMask, + ) class CreateQuestionRequest(proto.Message): @@ -58,8 +64,15 @@ class CreateQuestionRequest(proto.Message): Required. The question to create. """ - parent = proto.Field(proto.STRING, number=1,) - question = proto.Field(proto.MESSAGE, number=2, message=gcd_question.Question,) + parent = proto.Field( + proto.STRING, + number=1, + ) + question = proto.Field( + proto.MESSAGE, + number=2, + message=gcd_question.Question, + ) class ExecuteQuestionRequest(proto.Message): @@ -74,8 +87,14 @@ class ExecuteQuestionRequest(proto.Message): execute. """ - name = proto.Field(proto.STRING, number=1,) - interpretation_index = proto.Field(proto.INT32, number=2,) + name = proto.Field( + proto.STRING, + number=1, + ) + interpretation_index = proto.Field( + proto.INT32, + number=2, + ) class GetUserFeedbackRequest(proto.Message): @@ -88,7 +107,10 @@ class GetUserFeedbackRequest(proto.Message): ``projects/foo/locations/bar/questions/1234/userFeedback`` """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class UpdateUserFeedbackRequest(proto.Message): @@ -106,10 +128,14 @@ class UpdateUserFeedbackRequest(proto.Message): """ user_feedback = proto.Field( - proto.MESSAGE, number=1, message=gcd_user_feedback.UserFeedback, + proto.MESSAGE, + number=1, + message=gcd_user_feedback.UserFeedback, ) update_mask = proto.Field( - proto.MESSAGE, number=2, message=field_mask_pb2.FieldMask, + proto.MESSAGE, + number=2, + message=field_mask_pb2.FieldMask, ) diff --git a/google/cloud/dataqna_v1alpha/types/user_feedback.py b/google/cloud/dataqna_v1alpha/types/user_feedback.py index cb99cb4..c573b62 100644 --- a/google/cloud/dataqna_v1alpha/types/user_feedback.py +++ b/google/cloud/dataqna_v1alpha/types/user_feedback.py @@ -15,9 +15,11 @@ # import proto # type: ignore - __protobuf__ = proto.module( - package="google.cloud.dataqna.v1alpha", manifest={"UserFeedback",}, + package="google.cloud.dataqna.v1alpha", + manifest={ + "UserFeedback", + }, ) @@ -41,9 +43,19 @@ class UserFeedbackRating(proto.Enum): POSITIVE = 1 NEGATIVE = 2 - name = proto.Field(proto.STRING, number=1,) - free_form_feedback = proto.Field(proto.STRING, number=2,) - rating = proto.Field(proto.ENUM, number=3, enum=UserFeedbackRating,) + name = proto.Field( + proto.STRING, + number=1, + ) + free_form_feedback = proto.Field( + proto.STRING, + number=2, + ) + rating = proto.Field( + proto.ENUM, + number=3, + enum=UserFeedbackRating, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/noxfile.py b/noxfile.py index 2a2001c..7c1742d 100644 --- a/noxfile.py +++ b/noxfile.py @@ -17,19 +17,45 @@ # Generated by synthtool. DO NOT EDIT! from __future__ import absolute_import + import os import pathlib import shutil +import warnings import nox - -BLACK_VERSION = "black==19.10b0" -BLACK_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"] +BLACK_VERSION = "black==22.3.0" +ISORT_VERSION = "isort==5.10.1" +LINT_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"] DEFAULT_PYTHON_VERSION = "3.8" -SYSTEM_TEST_PYTHON_VERSIONS = ["3.8"] + UNIT_TEST_PYTHON_VERSIONS = ["3.6", "3.7", "3.8", "3.9", "3.10"] +UNIT_TEST_STANDARD_DEPENDENCIES = [ + "mock", + "asyncmock", + "pytest", + "pytest-cov", + "pytest-asyncio", +] +UNIT_TEST_EXTERNAL_DEPENDENCIES = [] +UNIT_TEST_LOCAL_DEPENDENCIES = [] +UNIT_TEST_DEPENDENCIES = [] +UNIT_TEST_EXTRAS = [] +UNIT_TEST_EXTRAS_BY_PYTHON = {} + +SYSTEM_TEST_PYTHON_VERSIONS = ["3.8"] +SYSTEM_TEST_STANDARD_DEPENDENCIES = [ + "mock", + "pytest", + "google-cloud-testutils", +] +SYSTEM_TEST_EXTERNAL_DEPENDENCIES = [] +SYSTEM_TEST_LOCAL_DEPENDENCIES = [] +SYSTEM_TEST_DEPENDENCIES = [] +SYSTEM_TEST_EXTRAS = [] +SYSTEM_TEST_EXTRAS_BY_PYTHON = {} CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute() @@ -57,7 +83,9 @@ def lint(session): """ session.install("flake8", BLACK_VERSION) session.run( - "black", "--check", *BLACK_PATHS, + "black", + "--check", + *LINT_PATHS, ) session.run("flake8", "google", "tests") @@ -67,7 +95,28 @@ def blacken(session): """Run black. Format code to uniform standard.""" session.install(BLACK_VERSION) session.run( - "black", *BLACK_PATHS, + "black", + *LINT_PATHS, + ) + + +@nox.session(python=DEFAULT_PYTHON_VERSION) +def format(session): + """ + Run isort to sort imports. Then run black + to format code to uniform standard. + """ + session.install(BLACK_VERSION, ISORT_VERSION) + # Use the --fss option to sort imports using strict alphabetical order. + # See https://pycqa.github.io/isort/docs/configuration/options.html#force-sort-within-sections + session.run( + "isort", + "--fss", + *LINT_PATHS, + ) + session.run( + "black", + *LINT_PATHS, ) @@ -78,23 +127,41 @@ def lint_setup_py(session): session.run("python", "setup.py", "check", "--restructuredtext", "--strict") +def install_unittest_dependencies(session, *constraints): + standard_deps = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_DEPENDENCIES + session.install(*standard_deps, *constraints) + + if UNIT_TEST_EXTERNAL_DEPENDENCIES: + warnings.warn( + "'unit_test_external_dependencies' is deprecated. Instead, please " + "use 'unit_test_dependencies' or 'unit_test_local_dependencies'.", + DeprecationWarning, + ) + session.install(*UNIT_TEST_EXTERNAL_DEPENDENCIES, *constraints) + + if UNIT_TEST_LOCAL_DEPENDENCIES: + session.install(*UNIT_TEST_LOCAL_DEPENDENCIES, *constraints) + + if UNIT_TEST_EXTRAS_BY_PYTHON: + extras = UNIT_TEST_EXTRAS_BY_PYTHON.get(session.python, []) + elif UNIT_TEST_EXTRAS: + extras = UNIT_TEST_EXTRAS + else: + extras = [] + + if extras: + session.install("-e", f".[{','.join(extras)}]", *constraints) + else: + session.install("-e", ".", *constraints) + + def default(session): # Install all test dependencies, then install this package in-place. constraints_path = str( CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt" ) - session.install( - "mock", - "asyncmock", - "pytest", - "pytest-cov", - "pytest-asyncio", - "-c", - constraints_path, - ) - - session.install("-e", ".", "-c", constraints_path) + install_unittest_dependencies(session, "-c", constraints_path) # Run py.test against the unit tests. session.run( @@ -118,6 +185,35 @@ def unit(session): default(session) +def install_systemtest_dependencies(session, *constraints): + + # Use pre-release gRPC for system tests. + session.install("--pre", "grpcio") + + session.install(*SYSTEM_TEST_STANDARD_DEPENDENCIES, *constraints) + + if SYSTEM_TEST_EXTERNAL_DEPENDENCIES: + session.install(*SYSTEM_TEST_EXTERNAL_DEPENDENCIES, *constraints) + + if SYSTEM_TEST_LOCAL_DEPENDENCIES: + session.install("-e", *SYSTEM_TEST_LOCAL_DEPENDENCIES, *constraints) + + if SYSTEM_TEST_DEPENDENCIES: + session.install("-e", *SYSTEM_TEST_DEPENDENCIES, *constraints) + + if SYSTEM_TEST_EXTRAS_BY_PYTHON: + extras = SYSTEM_TEST_EXTRAS_BY_PYTHON.get(session.python, []) + elif SYSTEM_TEST_EXTRAS: + extras = SYSTEM_TEST_EXTRAS + else: + extras = [] + + if extras: + session.install("-e", f".[{','.join(extras)}]", *constraints) + else: + session.install("-e", ".", *constraints) + + @nox.session(python=SYSTEM_TEST_PYTHON_VERSIONS) def system(session): """Run the system test suite.""" @@ -140,13 +236,7 @@ def system(session): if not system_test_exists and not system_test_folder_exists: session.skip("System tests were not found") - # Use pre-release gRPC for system tests. - session.install("--pre", "grpcio") - - # Install all test dependencies, then install this package into the - # virtualenv's dist-packages. - session.install("mock", "pytest", "google-cloud-testutils", "-c", constraints_path) - session.install("-e", ".", "-c", constraints_path) + install_systemtest_dependencies(session, "-c", constraints_path) # Run py.test against the system tests. if system_test_exists: diff --git a/samples/generated_samples/dataqna_generated_dataqna_v1alpha_auto_suggestion_service_suggest_queries_async.py b/samples/generated_samples/dataqna_generated_dataqna_v1alpha_auto_suggestion_service_suggest_queries_async.py deleted file mode 100644 index 486d928..0000000 --- a/samples/generated_samples/dataqna_generated_dataqna_v1alpha_auto_suggestion_service_suggest_queries_async.py +++ /dev/null @@ -1,45 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for SuggestQueries -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-dataqna - - -# [START dataqna_generated_dataqna_v1alpha_AutoSuggestionService_SuggestQueries_async] -from google.cloud import dataqna_v1alpha - - -async def sample_suggest_queries(): - # Create a client - client = dataqna_v1alpha.AutoSuggestionServiceAsyncClient() - - # Initialize request argument(s) - request = dataqna_v1alpha.SuggestQueriesRequest( - parent="parent_value", - ) - - # Make the request - response = await client.suggest_queries(request=request) - - # Handle the response - print(response) - -# [END dataqna_generated_dataqna_v1alpha_AutoSuggestionService_SuggestQueries_async] diff --git a/samples/generated_samples/dataqna_generated_dataqna_v1alpha_auto_suggestion_service_suggest_queries_sync.py b/samples/generated_samples/dataqna_generated_dataqna_v1alpha_auto_suggestion_service_suggest_queries_sync.py deleted file mode 100644 index 5d28446..0000000 --- a/samples/generated_samples/dataqna_generated_dataqna_v1alpha_auto_suggestion_service_suggest_queries_sync.py +++ /dev/null @@ -1,45 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for SuggestQueries -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-dataqna - - -# [START dataqna_generated_dataqna_v1alpha_AutoSuggestionService_SuggestQueries_sync] -from google.cloud import dataqna_v1alpha - - -def sample_suggest_queries(): - # Create a client - client = dataqna_v1alpha.AutoSuggestionServiceClient() - - # Initialize request argument(s) - request = dataqna_v1alpha.SuggestQueriesRequest( - parent="parent_value", - ) - - # Make the request - response = client.suggest_queries(request=request) - - # Handle the response - print(response) - -# [END dataqna_generated_dataqna_v1alpha_AutoSuggestionService_SuggestQueries_sync] diff --git a/samples/generated_samples/dataqna_generated_dataqna_v1alpha_question_service_create_question_async.py b/samples/generated_samples/dataqna_generated_dataqna_v1alpha_question_service_create_question_async.py deleted file mode 100644 index 9055e84..0000000 --- a/samples/generated_samples/dataqna_generated_dataqna_v1alpha_question_service_create_question_async.py +++ /dev/null @@ -1,50 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateQuestion -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-dataqna - - -# [START dataqna_generated_dataqna_v1alpha_QuestionService_CreateQuestion_async] -from google.cloud import dataqna_v1alpha - - -async def sample_create_question(): - # Create a client - client = dataqna_v1alpha.QuestionServiceAsyncClient() - - # Initialize request argument(s) - question = dataqna_v1alpha.Question() - question.scopes = ['scopes_value_1', 'scopes_value_2'] - question.query = "query_value" - - request = dataqna_v1alpha.CreateQuestionRequest( - parent="parent_value", - question=question, - ) - - # Make the request - response = await client.create_question(request=request) - - # Handle the response - print(response) - -# [END dataqna_generated_dataqna_v1alpha_QuestionService_CreateQuestion_async] diff --git a/samples/generated_samples/dataqna_generated_dataqna_v1alpha_question_service_create_question_sync.py b/samples/generated_samples/dataqna_generated_dataqna_v1alpha_question_service_create_question_sync.py deleted file mode 100644 index d7c6c54..0000000 --- a/samples/generated_samples/dataqna_generated_dataqna_v1alpha_question_service_create_question_sync.py +++ /dev/null @@ -1,50 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateQuestion -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-dataqna - - -# [START dataqna_generated_dataqna_v1alpha_QuestionService_CreateQuestion_sync] -from google.cloud import dataqna_v1alpha - - -def sample_create_question(): - # Create a client - client = dataqna_v1alpha.QuestionServiceClient() - - # Initialize request argument(s) - question = dataqna_v1alpha.Question() - question.scopes = ['scopes_value_1', 'scopes_value_2'] - question.query = "query_value" - - request = dataqna_v1alpha.CreateQuestionRequest( - parent="parent_value", - question=question, - ) - - # Make the request - response = client.create_question(request=request) - - # Handle the response - print(response) - -# [END dataqna_generated_dataqna_v1alpha_QuestionService_CreateQuestion_sync] diff --git a/samples/generated_samples/dataqna_generated_dataqna_v1alpha_question_service_execute_question_async.py b/samples/generated_samples/dataqna_generated_dataqna_v1alpha_question_service_execute_question_async.py deleted file mode 100644 index ed2cbf2..0000000 --- a/samples/generated_samples/dataqna_generated_dataqna_v1alpha_question_service_execute_question_async.py +++ /dev/null @@ -1,46 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ExecuteQuestion -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-dataqna - - -# [START dataqna_generated_dataqna_v1alpha_QuestionService_ExecuteQuestion_async] -from google.cloud import dataqna_v1alpha - - -async def sample_execute_question(): - # Create a client - client = dataqna_v1alpha.QuestionServiceAsyncClient() - - # Initialize request argument(s) - request = dataqna_v1alpha.ExecuteQuestionRequest( - name="name_value", - interpretation_index=2159, - ) - - # Make the request - response = await client.execute_question(request=request) - - # Handle the response - print(response) - -# [END dataqna_generated_dataqna_v1alpha_QuestionService_ExecuteQuestion_async] diff --git a/samples/generated_samples/dataqna_generated_dataqna_v1alpha_question_service_execute_question_sync.py b/samples/generated_samples/dataqna_generated_dataqna_v1alpha_question_service_execute_question_sync.py deleted file mode 100644 index dae9790..0000000 --- a/samples/generated_samples/dataqna_generated_dataqna_v1alpha_question_service_execute_question_sync.py +++ /dev/null @@ -1,46 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ExecuteQuestion -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-dataqna - - -# [START dataqna_generated_dataqna_v1alpha_QuestionService_ExecuteQuestion_sync] -from google.cloud import dataqna_v1alpha - - -def sample_execute_question(): - # Create a client - client = dataqna_v1alpha.QuestionServiceClient() - - # Initialize request argument(s) - request = dataqna_v1alpha.ExecuteQuestionRequest( - name="name_value", - interpretation_index=2159, - ) - - # Make the request - response = client.execute_question(request=request) - - # Handle the response - print(response) - -# [END dataqna_generated_dataqna_v1alpha_QuestionService_ExecuteQuestion_sync] diff --git a/samples/generated_samples/dataqna_generated_dataqna_v1alpha_question_service_get_question_async.py b/samples/generated_samples/dataqna_generated_dataqna_v1alpha_question_service_get_question_async.py deleted file mode 100644 index 1cb56b7..0000000 --- a/samples/generated_samples/dataqna_generated_dataqna_v1alpha_question_service_get_question_async.py +++ /dev/null @@ -1,45 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetQuestion -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-dataqna - - -# [START dataqna_generated_dataqna_v1alpha_QuestionService_GetQuestion_async] -from google.cloud import dataqna_v1alpha - - -async def sample_get_question(): - # Create a client - client = dataqna_v1alpha.QuestionServiceAsyncClient() - - # Initialize request argument(s) - request = dataqna_v1alpha.GetQuestionRequest( - name="name_value", - ) - - # Make the request - response = await client.get_question(request=request) - - # Handle the response - print(response) - -# [END dataqna_generated_dataqna_v1alpha_QuestionService_GetQuestion_async] diff --git a/samples/generated_samples/dataqna_generated_dataqna_v1alpha_question_service_get_question_sync.py b/samples/generated_samples/dataqna_generated_dataqna_v1alpha_question_service_get_question_sync.py deleted file mode 100644 index 67bb0e5..0000000 --- a/samples/generated_samples/dataqna_generated_dataqna_v1alpha_question_service_get_question_sync.py +++ /dev/null @@ -1,45 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetQuestion -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-dataqna - - -# [START dataqna_generated_dataqna_v1alpha_QuestionService_GetQuestion_sync] -from google.cloud import dataqna_v1alpha - - -def sample_get_question(): - # Create a client - client = dataqna_v1alpha.QuestionServiceClient() - - # Initialize request argument(s) - request = dataqna_v1alpha.GetQuestionRequest( - name="name_value", - ) - - # Make the request - response = client.get_question(request=request) - - # Handle the response - print(response) - -# [END dataqna_generated_dataqna_v1alpha_QuestionService_GetQuestion_sync] diff --git a/samples/generated_samples/dataqna_generated_dataqna_v1alpha_question_service_get_user_feedback_async.py b/samples/generated_samples/dataqna_generated_dataqna_v1alpha_question_service_get_user_feedback_async.py deleted file mode 100644 index 378c64f..0000000 --- a/samples/generated_samples/dataqna_generated_dataqna_v1alpha_question_service_get_user_feedback_async.py +++ /dev/null @@ -1,45 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetUserFeedback -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-dataqna - - -# [START dataqna_generated_dataqna_v1alpha_QuestionService_GetUserFeedback_async] -from google.cloud import dataqna_v1alpha - - -async def sample_get_user_feedback(): - # Create a client - client = dataqna_v1alpha.QuestionServiceAsyncClient() - - # Initialize request argument(s) - request = dataqna_v1alpha.GetUserFeedbackRequest( - name="name_value", - ) - - # Make the request - response = await client.get_user_feedback(request=request) - - # Handle the response - print(response) - -# [END dataqna_generated_dataqna_v1alpha_QuestionService_GetUserFeedback_async] diff --git a/samples/generated_samples/dataqna_generated_dataqna_v1alpha_question_service_get_user_feedback_sync.py b/samples/generated_samples/dataqna_generated_dataqna_v1alpha_question_service_get_user_feedback_sync.py deleted file mode 100644 index e466d36..0000000 --- a/samples/generated_samples/dataqna_generated_dataqna_v1alpha_question_service_get_user_feedback_sync.py +++ /dev/null @@ -1,45 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetUserFeedback -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-dataqna - - -# [START dataqna_generated_dataqna_v1alpha_QuestionService_GetUserFeedback_sync] -from google.cloud import dataqna_v1alpha - - -def sample_get_user_feedback(): - # Create a client - client = dataqna_v1alpha.QuestionServiceClient() - - # Initialize request argument(s) - request = dataqna_v1alpha.GetUserFeedbackRequest( - name="name_value", - ) - - # Make the request - response = client.get_user_feedback(request=request) - - # Handle the response - print(response) - -# [END dataqna_generated_dataqna_v1alpha_QuestionService_GetUserFeedback_sync] diff --git a/samples/generated_samples/dataqna_generated_dataqna_v1alpha_question_service_update_user_feedback_async.py b/samples/generated_samples/dataqna_generated_dataqna_v1alpha_question_service_update_user_feedback_async.py deleted file mode 100644 index b6b2608..0000000 --- a/samples/generated_samples/dataqna_generated_dataqna_v1alpha_question_service_update_user_feedback_async.py +++ /dev/null @@ -1,48 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateUserFeedback -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-dataqna - - -# [START dataqna_generated_dataqna_v1alpha_QuestionService_UpdateUserFeedback_async] -from google.cloud import dataqna_v1alpha - - -async def sample_update_user_feedback(): - # Create a client - client = dataqna_v1alpha.QuestionServiceAsyncClient() - - # Initialize request argument(s) - user_feedback = dataqna_v1alpha.UserFeedback() - user_feedback.name = "name_value" - - request = dataqna_v1alpha.UpdateUserFeedbackRequest( - user_feedback=user_feedback, - ) - - # Make the request - response = await client.update_user_feedback(request=request) - - # Handle the response - print(response) - -# [END dataqna_generated_dataqna_v1alpha_QuestionService_UpdateUserFeedback_async] diff --git a/samples/generated_samples/dataqna_generated_dataqna_v1alpha_question_service_update_user_feedback_sync.py b/samples/generated_samples/dataqna_generated_dataqna_v1alpha_question_service_update_user_feedback_sync.py deleted file mode 100644 index abb2e8a..0000000 --- a/samples/generated_samples/dataqna_generated_dataqna_v1alpha_question_service_update_user_feedback_sync.py +++ /dev/null @@ -1,48 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateUserFeedback -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-dataqna - - -# [START dataqna_generated_dataqna_v1alpha_QuestionService_UpdateUserFeedback_sync] -from google.cloud import dataqna_v1alpha - - -def sample_update_user_feedback(): - # Create a client - client = dataqna_v1alpha.QuestionServiceClient() - - # Initialize request argument(s) - user_feedback = dataqna_v1alpha.UserFeedback() - user_feedback.name = "name_value" - - request = dataqna_v1alpha.UpdateUserFeedbackRequest( - user_feedback=user_feedback, - ) - - # Make the request - response = client.update_user_feedback(request=request) - - # Handle the response - print(response) - -# [END dataqna_generated_dataqna_v1alpha_QuestionService_UpdateUserFeedback_sync] diff --git a/samples/generated_samples/snippet_metadata_dataqna_v1alpha.json b/samples/generated_samples/snippet_metadata_dataqna_v1alpha.json index 689aa34..27e0338 100644 --- a/samples/generated_samples/snippet_metadata_dataqna_v1alpha.json +++ b/samples/generated_samples/snippet_metadata_dataqna_v1alpha.json @@ -1,16 +1,57 @@ { + "clientLibrary": { + "apis": [ + { + "id": "google.cloud.dataqna.v1alpha", + "version": "v1alpha" + } + ], + "language": "PYTHON", + "name": "google-cloud-dataqna" + }, "snippets": [ { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dataqna_v1alpha.AutoSuggestionServiceAsyncClient", + "shortName": "AutoSuggestionServiceAsyncClient" + }, + "fullName": "google.cloud.dataqna_v1alpha.AutoSuggestionServiceAsyncClient.suggest_queries", "method": { + "fullName": "google.cloud.dataqna.v1alpha.AutoSuggestionService.SuggestQueries", "service": { + "fullName": "google.cloud.dataqna.v1alpha.AutoSuggestionService", "shortName": "AutoSuggestionService" }, "shortName": "SuggestQueries" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dataqna_v1alpha.types.SuggestQueriesRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dataqna_v1alpha.types.SuggestQueriesResponse", + "shortName": "suggest_queries" }, + "description": "Sample for SuggestQueries", "file": "dataqna_v1alpha_generated_auto_suggestion_service_suggest_queries_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dataqna_v1alpha_generated_AutoSuggestionService_SuggestQueries_async", "segments": [ { @@ -43,18 +84,50 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dataqna_v1alpha_generated_auto_suggestion_service_suggest_queries_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dataqna_v1alpha.AutoSuggestionServiceClient", + "shortName": "AutoSuggestionServiceClient" + }, + "fullName": "google.cloud.dataqna_v1alpha.AutoSuggestionServiceClient.suggest_queries", "method": { + "fullName": "google.cloud.dataqna.v1alpha.AutoSuggestionService.SuggestQueries", "service": { + "fullName": "google.cloud.dataqna.v1alpha.AutoSuggestionService", "shortName": "AutoSuggestionService" }, "shortName": "SuggestQueries" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dataqna_v1alpha.types.SuggestQueriesRequest" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dataqna_v1alpha.types.SuggestQueriesResponse", + "shortName": "suggest_queries" }, + "description": "Sample for SuggestQueries", "file": "dataqna_v1alpha_generated_auto_suggestion_service_suggest_queries_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dataqna_v1alpha_generated_AutoSuggestionService_SuggestQueries_sync", "segments": [ { @@ -87,19 +160,59 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dataqna_v1alpha_generated_auto_suggestion_service_suggest_queries_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dataqna_v1alpha.QuestionServiceAsyncClient", + "shortName": "QuestionServiceAsyncClient" + }, + "fullName": "google.cloud.dataqna_v1alpha.QuestionServiceAsyncClient.create_question", "method": { + "fullName": "google.cloud.dataqna.v1alpha.QuestionService.CreateQuestion", "service": { + "fullName": "google.cloud.dataqna.v1alpha.QuestionService", "shortName": "QuestionService" }, "shortName": "CreateQuestion" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dataqna_v1alpha.types.CreateQuestionRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "question", + "type": "google.cloud.dataqna_v1alpha.types.Question" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dataqna_v1alpha.types.Question", + "shortName": "create_question" }, + "description": "Sample for CreateQuestion", "file": "dataqna_v1alpha_generated_question_service_create_question_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dataqna_v1alpha_generated_QuestionService_CreateQuestion_async", "segments": [ { @@ -132,18 +245,58 @@ "start": 47, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dataqna_v1alpha_generated_question_service_create_question_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dataqna_v1alpha.QuestionServiceClient", + "shortName": "QuestionServiceClient" + }, + "fullName": "google.cloud.dataqna_v1alpha.QuestionServiceClient.create_question", "method": { + "fullName": "google.cloud.dataqna.v1alpha.QuestionService.CreateQuestion", "service": { + "fullName": "google.cloud.dataqna.v1alpha.QuestionService", "shortName": "QuestionService" }, "shortName": "CreateQuestion" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dataqna_v1alpha.types.CreateQuestionRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "question", + "type": "google.cloud.dataqna_v1alpha.types.Question" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dataqna_v1alpha.types.Question", + "shortName": "create_question" }, + "description": "Sample for CreateQuestion", "file": "dataqna_v1alpha_generated_question_service_create_question_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dataqna_v1alpha_generated_QuestionService_CreateQuestion_sync", "segments": [ { @@ -176,19 +329,59 @@ "start": 47, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dataqna_v1alpha_generated_question_service_create_question_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dataqna_v1alpha.QuestionServiceAsyncClient", + "shortName": "QuestionServiceAsyncClient" + }, + "fullName": "google.cloud.dataqna_v1alpha.QuestionServiceAsyncClient.execute_question", "method": { + "fullName": "google.cloud.dataqna.v1alpha.QuestionService.ExecuteQuestion", "service": { + "fullName": "google.cloud.dataqna.v1alpha.QuestionService", "shortName": "QuestionService" }, "shortName": "ExecuteQuestion" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dataqna_v1alpha.types.ExecuteQuestionRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "interpretation_index", + "type": "int" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dataqna_v1alpha.types.Question", + "shortName": "execute_question" }, + "description": "Sample for ExecuteQuestion", "file": "dataqna_v1alpha_generated_question_service_execute_question_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dataqna_v1alpha_generated_QuestionService_ExecuteQuestion_async", "segments": [ { @@ -221,18 +414,58 @@ "start": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dataqna_v1alpha_generated_question_service_execute_question_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dataqna_v1alpha.QuestionServiceClient", + "shortName": "QuestionServiceClient" + }, + "fullName": "google.cloud.dataqna_v1alpha.QuestionServiceClient.execute_question", "method": { + "fullName": "google.cloud.dataqna.v1alpha.QuestionService.ExecuteQuestion", "service": { + "fullName": "google.cloud.dataqna.v1alpha.QuestionService", "shortName": "QuestionService" }, "shortName": "ExecuteQuestion" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dataqna_v1alpha.types.ExecuteQuestionRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "interpretation_index", + "type": "int" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dataqna_v1alpha.types.Question", + "shortName": "execute_question" }, + "description": "Sample for ExecuteQuestion", "file": "dataqna_v1alpha_generated_question_service_execute_question_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dataqna_v1alpha_generated_QuestionService_ExecuteQuestion_sync", "segments": [ { @@ -265,19 +498,55 @@ "start": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dataqna_v1alpha_generated_question_service_execute_question_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dataqna_v1alpha.QuestionServiceAsyncClient", + "shortName": "QuestionServiceAsyncClient" + }, + "fullName": "google.cloud.dataqna_v1alpha.QuestionServiceAsyncClient.get_question", "method": { + "fullName": "google.cloud.dataqna.v1alpha.QuestionService.GetQuestion", "service": { + "fullName": "google.cloud.dataqna.v1alpha.QuestionService", "shortName": "QuestionService" }, "shortName": "GetQuestion" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dataqna_v1alpha.types.GetQuestionRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dataqna_v1alpha.types.Question", + "shortName": "get_question" }, + "description": "Sample for GetQuestion", "file": "dataqna_v1alpha_generated_question_service_get_question_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dataqna_v1alpha_generated_QuestionService_GetQuestion_async", "segments": [ { @@ -310,18 +579,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dataqna_v1alpha_generated_question_service_get_question_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dataqna_v1alpha.QuestionServiceClient", + "shortName": "QuestionServiceClient" + }, + "fullName": "google.cloud.dataqna_v1alpha.QuestionServiceClient.get_question", "method": { + "fullName": "google.cloud.dataqna.v1alpha.QuestionService.GetQuestion", "service": { + "fullName": "google.cloud.dataqna.v1alpha.QuestionService", "shortName": "QuestionService" }, "shortName": "GetQuestion" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dataqna_v1alpha.types.GetQuestionRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dataqna_v1alpha.types.Question", + "shortName": "get_question" }, + "description": "Sample for GetQuestion", "file": "dataqna_v1alpha_generated_question_service_get_question_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dataqna_v1alpha_generated_QuestionService_GetQuestion_sync", "segments": [ { @@ -354,19 +659,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dataqna_v1alpha_generated_question_service_get_question_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dataqna_v1alpha.QuestionServiceAsyncClient", + "shortName": "QuestionServiceAsyncClient" + }, + "fullName": "google.cloud.dataqna_v1alpha.QuestionServiceAsyncClient.get_user_feedback", "method": { + "fullName": "google.cloud.dataqna.v1alpha.QuestionService.GetUserFeedback", "service": { + "fullName": "google.cloud.dataqna.v1alpha.QuestionService", "shortName": "QuestionService" }, "shortName": "GetUserFeedback" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dataqna_v1alpha.types.GetUserFeedbackRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dataqna_v1alpha.types.UserFeedback", + "shortName": "get_user_feedback" }, + "description": "Sample for GetUserFeedback", "file": "dataqna_v1alpha_generated_question_service_get_user_feedback_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dataqna_v1alpha_generated_QuestionService_GetUserFeedback_async", "segments": [ { @@ -399,18 +740,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dataqna_v1alpha_generated_question_service_get_user_feedback_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dataqna_v1alpha.QuestionServiceClient", + "shortName": "QuestionServiceClient" + }, + "fullName": "google.cloud.dataqna_v1alpha.QuestionServiceClient.get_user_feedback", "method": { + "fullName": "google.cloud.dataqna.v1alpha.QuestionService.GetUserFeedback", "service": { + "fullName": "google.cloud.dataqna.v1alpha.QuestionService", "shortName": "QuestionService" }, "shortName": "GetUserFeedback" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dataqna_v1alpha.types.GetUserFeedbackRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dataqna_v1alpha.types.UserFeedback", + "shortName": "get_user_feedback" }, + "description": "Sample for GetUserFeedback", "file": "dataqna_v1alpha_generated_question_service_get_user_feedback_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dataqna_v1alpha_generated_QuestionService_GetUserFeedback_sync", "segments": [ { @@ -443,19 +820,59 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dataqna_v1alpha_generated_question_service_get_user_feedback_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.dataqna_v1alpha.QuestionServiceAsyncClient", + "shortName": "QuestionServiceAsyncClient" + }, + "fullName": "google.cloud.dataqna_v1alpha.QuestionServiceAsyncClient.update_user_feedback", "method": { + "fullName": "google.cloud.dataqna.v1alpha.QuestionService.UpdateUserFeedback", "service": { + "fullName": "google.cloud.dataqna.v1alpha.QuestionService", "shortName": "QuestionService" }, "shortName": "UpdateUserFeedback" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dataqna_v1alpha.types.UpdateUserFeedbackRequest" + }, + { + "name": "user_feedback", + "type": "google.cloud.dataqna_v1alpha.types.UserFeedback" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dataqna_v1alpha.types.UserFeedback", + "shortName": "update_user_feedback" }, + "description": "Sample for UpdateUserFeedback", "file": "dataqna_v1alpha_generated_question_service_update_user_feedback_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dataqna_v1alpha_generated_QuestionService_UpdateUserFeedback_async", "segments": [ { @@ -488,18 +905,58 @@ "start": 45, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dataqna_v1alpha_generated_question_service_update_user_feedback_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.dataqna_v1alpha.QuestionServiceClient", + "shortName": "QuestionServiceClient" + }, + "fullName": "google.cloud.dataqna_v1alpha.QuestionServiceClient.update_user_feedback", "method": { + "fullName": "google.cloud.dataqna.v1alpha.QuestionService.UpdateUserFeedback", "service": { + "fullName": "google.cloud.dataqna.v1alpha.QuestionService", "shortName": "QuestionService" }, "shortName": "UpdateUserFeedback" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.dataqna_v1alpha.types.UpdateUserFeedbackRequest" + }, + { + "name": "user_feedback", + "type": "google.cloud.dataqna_v1alpha.types.UserFeedback" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.dataqna_v1alpha.types.UserFeedback", + "shortName": "update_user_feedback" }, + "description": "Sample for UpdateUserFeedback", "file": "dataqna_v1alpha_generated_question_service_update_user_feedback_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "dataqna_v1alpha_generated_QuestionService_UpdateUserFeedback_sync", "segments": [ { @@ -532,7 +989,8 @@ "start": 45, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "dataqna_v1alpha_generated_question_service_update_user_feedback_sync.py" } ] } diff --git a/scripts/readme-gen/readme_gen.py b/scripts/readme-gen/readme_gen.py index d309d6e..91b5967 100644 --- a/scripts/readme-gen/readme_gen.py +++ b/scripts/readme-gen/readme_gen.py @@ -28,7 +28,10 @@ jinja_env = jinja2.Environment( trim_blocks=True, loader=jinja2.FileSystemLoader( - os.path.abspath(os.path.join(os.path.dirname(__file__), 'templates')))) + os.path.abspath(os.path.join(os.path.dirname(__file__), "templates")) + ), + autoescape=True, +) README_TMPL = jinja_env.get_template('README.tmpl.rst') diff --git a/setup.py b/setup.py index 74d4b42..3a0791d 100644 --- a/setup.py +++ b/setup.py @@ -17,9 +17,10 @@ import io import os + import setuptools # type: ignore -version = "0.6.2" +version = "0.6.3" package_root = os.path.abspath(os.path.dirname(__file__)) @@ -49,7 +50,8 @@ # Until this issue is closed # https://github.com/googleapis/google-cloud-python/issues/10566 "google-api-core[grpc] >= 1.31.5, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.0", - "proto-plus >= 1.15.0", + "proto-plus >= 1.15.0, <2.0.0dev", + "protobuf >= 3.19.0, <4.0.0dev", ), python_requires=">=3.6", classifiers=[ diff --git a/testing/constraints-3.6.txt b/testing/constraints-3.6.txt index b666ca6..ec8ca20 100644 --- a/testing/constraints-3.6.txt +++ b/testing/constraints-3.6.txt @@ -7,3 +7,4 @@ # Then this file should have foo==1.14.0 google-api-core==1.31.5 proto-plus==1.15.0 +protobuf==3.19.0 diff --git a/testing/constraints-3.7.txt b/testing/constraints-3.7.txt index e69de29..ec8ca20 100644 --- a/testing/constraints-3.7.txt +++ b/testing/constraints-3.7.txt @@ -0,0 +1,10 @@ +# This constraints file is used to check that lower bounds +# are correct in setup.py +# List *all* library dependencies and extras in this file. +# Pin the version to the lower bound. +# +# e.g., if setup.py has "foo >= 1.14.0, < 2.0.0dev", +# Then this file should have foo==1.14.0 +google-api-core==1.31.5 +proto-plus==1.15.0 +protobuf==3.19.0 diff --git a/tests/unit/gapic/dataqna_v1alpha/test_auto_suggestion_service.py b/tests/unit/gapic/dataqna_v1alpha/test_auto_suggestion_service.py index ce664c5..eef4190 100644 --- a/tests/unit/gapic/dataqna_v1alpha/test_auto_suggestion_service.py +++ b/tests/unit/gapic/dataqna_v1alpha/test_auto_suggestion_service.py @@ -14,33 +14,34 @@ # limitations under the License. # import os -import mock -import grpc -from grpc.experimental import aio -import math -import pytest -from proto.marshal.rules.dates import DurationRule, TimestampRule +# try/except added for compatibility with python < 3.8 +try: + from unittest import mock + from unittest.mock import AsyncMock +except ImportError: + import mock +import math +from google.api_core import gapic_v1, grpc_helpers, grpc_helpers_async, path_template from google.api_core import client_options from google.api_core import exceptions as core_exceptions -from google.api_core import gapic_v1 -from google.api_core import grpc_helpers -from google.api_core import grpc_helpers_async -from google.api_core import path_template +import google.auth from google.auth import credentials as ga_credentials from google.auth.exceptions import MutualTLSChannelError +from google.oauth2 import service_account +import grpc +from grpc.experimental import aio +from proto.marshal.rules.dates import DurationRule, TimestampRule +import pytest + from google.cloud.dataqna_v1alpha.services.auto_suggestion_service import ( AutoSuggestionServiceAsyncClient, -) -from google.cloud.dataqna_v1alpha.services.auto_suggestion_service import ( AutoSuggestionServiceClient, + transports, ) -from google.cloud.dataqna_v1alpha.services.auto_suggestion_service import transports from google.cloud.dataqna_v1alpha.types import auto_suggestion_service -from google.oauth2 import service_account -import google.auth def client_cert_source_callback(): @@ -89,20 +90,26 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class", [AutoSuggestionServiceClient, AutoSuggestionServiceAsyncClient,] + "client_class,transport_name", + [ + (AutoSuggestionServiceClient, "grpc"), + (AutoSuggestionServiceAsyncClient, "grpc_asyncio"), + ], ) -def test_auto_suggestion_service_client_from_service_account_info(client_class): +def test_auto_suggestion_service_client_from_service_account_info( + client_class, transport_name +): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: factory.return_value = creds info = {"valid": True} - client = client_class.from_service_account_info(info) + client = client_class.from_service_account_info(info, transport=transport_name) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "dataqna.googleapis.com:443" + assert client.transport._host == ("dataqna.googleapis.com:443") @pytest.mark.parametrize( @@ -131,23 +138,33 @@ def test_auto_suggestion_service_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class", [AutoSuggestionServiceClient, AutoSuggestionServiceAsyncClient,] + "client_class,transport_name", + [ + (AutoSuggestionServiceClient, "grpc"), + (AutoSuggestionServiceAsyncClient, "grpc_asyncio"), + ], ) -def test_auto_suggestion_service_client_from_service_account_file(client_class): +def test_auto_suggestion_service_client_from_service_account_file( + client_class, transport_name +): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: factory.return_value = creds - client = client_class.from_service_account_file("dummy/file/path.json") + client = client_class.from_service_account_file( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - client = client_class.from_service_account_json("dummy/file/path.json") + client = client_class.from_service_account_json( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "dataqna.googleapis.com:443" + assert client.transport._host == ("dataqna.googleapis.com:443") def test_auto_suggestion_service_client_get_transport_class(): @@ -513,7 +530,9 @@ def test_auto_suggestion_service_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -654,11 +673,16 @@ def test_auto_suggestion_service_client_create_channel_credentials_file( @pytest.mark.parametrize( - "request_type", [auto_suggestion_service.SuggestQueriesRequest, dict,] + "request_type", + [ + auto_suggestion_service.SuggestQueriesRequest, + dict, + ], ) def test_suggest_queries(request_type, transport: str = "grpc"): client = AutoSuggestionServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -684,7 +708,8 @@ def test_suggest_queries_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AutoSuggestionServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -701,7 +726,8 @@ async def test_suggest_queries_async( request_type=auto_suggestion_service.SuggestQueriesRequest, ): client = AutoSuggestionServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -739,7 +765,7 @@ def test_suggest_queries_field_headers(): # a field header. Set these to a non-empty value. request = auto_suggestion_service.SuggestQueriesRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.suggest_queries), "__call__") as call: @@ -753,7 +779,10 @@ def test_suggest_queries_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -766,7 +795,7 @@ async def test_suggest_queries_field_headers_async(): # a field header. Set these to a non-empty value. request = auto_suggestion_service.SuggestQueriesRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.suggest_queries), "__call__") as call: @@ -782,7 +811,10 @@ async def test_suggest_queries_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_credentials_transport_error(): @@ -792,7 +824,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = AutoSuggestionServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -813,7 +846,8 @@ def test_credentials_transport_error(): options.api_key = "api_key" with pytest.raises(ValueError): client = AutoSuggestionServiceClient( - client_options=options, transport=transport, + client_options=options, + transport=transport, ) # It is an error to provide an api_key and a credential. @@ -830,7 +864,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = AutoSuggestionServiceClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -873,12 +908,28 @@ def test_transport_adc(transport_class): adc.assert_called_once() +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + ], +) +def test_transport_kind(transport_name): + transport = AutoSuggestionServiceClient.get_transport_class(transport_name)( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert transport.kind == transport_name + + def test_transport_grpc_default(): # A client should use the gRPC transport by default. client = AutoSuggestionServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) - assert isinstance(client.transport, transports.AutoSuggestionServiceGrpcTransport,) + assert isinstance( + client.transport, + transports.AutoSuggestionServiceGrpcTransport, + ) def test_auto_suggestion_service_base_transport_error(): @@ -910,6 +961,14 @@ def test_auto_suggestion_service_base_transport(): with pytest.raises(NotImplementedError): transport.close() + # Catch all for all remaining methods and properties + remainder = [ + "kind", + ] + for r in remainder: + with pytest.raises(NotImplementedError): + getattr(transport, r)() + def test_auto_suggestion_service_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file @@ -921,7 +980,8 @@ def test_auto_suggestion_service_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.AutoSuggestionServiceTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -1058,24 +1118,40 @@ def test_auto_suggestion_service_grpc_transport_client_cert_source_for_mtls( ) -def test_auto_suggestion_service_host_no_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_auto_suggestion_service_host_no_port(transport_name): client = AutoSuggestionServiceClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="dataqna.googleapis.com" ), + transport=transport_name, ) - assert client.transport._host == "dataqna.googleapis.com:443" + assert client.transport._host == ("dataqna.googleapis.com:443") -def test_auto_suggestion_service_host_with_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_auto_suggestion_service_host_with_port(transport_name): client = AutoSuggestionServiceClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="dataqna.googleapis.com:8000" ), + transport=transport_name, ) - assert client.transport._host == "dataqna.googleapis.com:8000" + assert client.transport._host == ("dataqna.googleapis.com:8000") def test_auto_suggestion_service_grpc_transport_channel(): @@ -1083,7 +1159,8 @@ def test_auto_suggestion_service_grpc_transport_channel(): # Check that channel is used if provided. transport = transports.AutoSuggestionServiceGrpcTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -1095,7 +1172,8 @@ def test_auto_suggestion_service_grpc_asyncio_transport_channel(): # Check that channel is used if provided. transport = transports.AutoSuggestionServiceGrpcAsyncIOTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -1224,7 +1302,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = AutoSuggestionServiceClient.common_folder_path(folder) assert expected == actual @@ -1242,7 +1322,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = AutoSuggestionServiceClient.common_organization_path(organization) assert expected == actual @@ -1260,7 +1342,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = AutoSuggestionServiceClient.common_project_path(project) assert expected == actual @@ -1280,7 +1364,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = AutoSuggestionServiceClient.common_location_path(project, location) assert expected == actual @@ -1305,7 +1390,8 @@ def test_client_with_default_client_info(): transports.AutoSuggestionServiceTransport, "_prep_wrapped_messages" ) as prep: client = AutoSuggestionServiceClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -1314,7 +1400,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = AutoSuggestionServiceClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -1322,7 +1409,8 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = AutoSuggestionServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) with mock.patch.object( type(getattr(client.transport, "grpc_channel")), "close" diff --git a/tests/unit/gapic/dataqna_v1alpha/test_question_service.py b/tests/unit/gapic/dataqna_v1alpha/test_question_service.py index e1d9ae6..7e7b914 100644 --- a/tests/unit/gapic/dataqna_v1alpha/test_question_service.py +++ b/tests/unit/gapic/dataqna_v1alpha/test_question_service.py @@ -14,40 +14,43 @@ # limitations under the License. # import os -import mock -import grpc -from grpc.experimental import aio -import math -import pytest -from proto.marshal.rules.dates import DurationRule, TimestampRule +# try/except added for compatibility with python < 3.8 +try: + from unittest import mock + from unittest.mock import AsyncMock +except ImportError: + import mock +import math +from google.api_core import gapic_v1, grpc_helpers, grpc_helpers_async, path_template from google.api_core import client_options from google.api_core import exceptions as core_exceptions -from google.api_core import gapic_v1 -from google.api_core import grpc_helpers -from google.api_core import grpc_helpers_async -from google.api_core import path_template +import google.auth from google.auth import credentials as ga_credentials from google.auth.exceptions import MutualTLSChannelError +from google.oauth2 import service_account +from google.protobuf import any_pb2 # type: ignore +from google.protobuf import field_mask_pb2 # type: ignore +from google.protobuf import timestamp_pb2 # type: ignore +from google.rpc import status_pb2 # type: ignore +import grpc +from grpc.experimental import aio +from proto.marshal.rules.dates import DurationRule, TimestampRule +import pytest + from google.cloud.dataqna_v1alpha.services.question_service import ( QuestionServiceAsyncClient, + QuestionServiceClient, + transports, ) -from google.cloud.dataqna_v1alpha.services.question_service import QuestionServiceClient -from google.cloud.dataqna_v1alpha.services.question_service import transports +from google.cloud.dataqna_v1alpha.types import user_feedback as gcd_user_feedback from google.cloud.dataqna_v1alpha.types import annotated_string 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 -from google.cloud.dataqna_v1alpha.types import user_feedback as gcd_user_feedback -from google.oauth2 import service_account -from google.protobuf import any_pb2 # type: ignore -from google.protobuf import field_mask_pb2 # type: ignore -from google.protobuf import timestamp_pb2 # type: ignore -from google.rpc import status_pb2 # type: ignore -import google.auth def client_cert_source_callback(): @@ -95,20 +98,26 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class", [QuestionServiceClient, QuestionServiceAsyncClient,] + "client_class,transport_name", + [ + (QuestionServiceClient, "grpc"), + (QuestionServiceAsyncClient, "grpc_asyncio"), + ], ) -def test_question_service_client_from_service_account_info(client_class): +def test_question_service_client_from_service_account_info( + client_class, transport_name +): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: factory.return_value = creds info = {"valid": True} - client = client_class.from_service_account_info(info) + client = client_class.from_service_account_info(info, transport=transport_name) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "dataqna.googleapis.com:443" + assert client.transport._host == ("dataqna.googleapis.com:443") @pytest.mark.parametrize( @@ -137,23 +146,33 @@ def test_question_service_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class", [QuestionServiceClient, QuestionServiceAsyncClient,] + "client_class,transport_name", + [ + (QuestionServiceClient, "grpc"), + (QuestionServiceAsyncClient, "grpc_asyncio"), + ], ) -def test_question_service_client_from_service_account_file(client_class): +def test_question_service_client_from_service_account_file( + client_class, transport_name +): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: factory.return_value = creds - client = client_class.from_service_account_file("dummy/file/path.json") + client = client_class.from_service_account_file( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - client = client_class.from_service_account_json("dummy/file/path.json") + client = client_class.from_service_account_json( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "dataqna.googleapis.com:443" + assert client.transport._host == ("dataqna.googleapis.com:443") def test_question_service_client_get_transport_class(): @@ -511,7 +530,9 @@ def test_question_service_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -651,10 +672,17 @@ def test_question_service_client_create_channel_credentials_file( ) -@pytest.mark.parametrize("request_type", [question_service.GetQuestionRequest, dict,]) +@pytest.mark.parametrize( + "request_type", + [ + question_service.GetQuestionRequest, + dict, + ], +) def test_get_question(request_type, transport: str = "grpc"): client = QuestionServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -691,7 +719,8 @@ def test_get_question_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = QuestionServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -707,7 +736,8 @@ async def test_get_question_async( transport: str = "grpc_asyncio", request_type=question_service.GetQuestionRequest ): client = QuestionServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -748,13 +778,15 @@ async def test_get_question_async_from_dict(): def test_get_question_field_headers(): - client = QuestionServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = QuestionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = question_service.GetQuestionRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_question), "__call__") as call: @@ -768,7 +800,10 @@ def test_get_question_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -781,7 +816,7 @@ async def test_get_question_field_headers_async(): # a field header. Set these to a non-empty value. request = question_service.GetQuestionRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_question), "__call__") as call: @@ -795,11 +830,16 @@ async def test_get_question_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_get_question_flattened(): - client = QuestionServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = QuestionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_question), "__call__") as call: @@ -807,7 +847,9 @@ def test_get_question_flattened(): call.return_value = question.Question() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_question(name="name_value",) + client.get_question( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -819,13 +861,16 @@ def test_get_question_flattened(): def test_get_question_flattened_error(): - client = QuestionServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = QuestionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.get_question( - question_service.GetQuestionRequest(), name="name_value", + question_service.GetQuestionRequest(), + name="name_value", ) @@ -843,7 +888,9 @@ async def test_get_question_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(question.Question()) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_question(name="name_value",) + response = await client.get_question( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -864,16 +911,22 @@ async def test_get_question_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.get_question( - question_service.GetQuestionRequest(), name="name_value", + question_service.GetQuestionRequest(), + name="name_value", ) @pytest.mark.parametrize( - "request_type", [question_service.CreateQuestionRequest, dict,] + "request_type", + [ + question_service.CreateQuestionRequest, + dict, + ], ) def test_create_question(request_type, transport: str = "grpc"): client = QuestionServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -910,7 +963,8 @@ def test_create_question_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = QuestionServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -926,7 +980,8 @@ async def test_create_question_async( transport: str = "grpc_asyncio", request_type=question_service.CreateQuestionRequest ): client = QuestionServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -967,13 +1022,15 @@ async def test_create_question_async_from_dict(): def test_create_question_field_headers(): - client = QuestionServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = QuestionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = question_service.CreateQuestionRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_question), "__call__") as call: @@ -987,7 +1044,10 @@ def test_create_question_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -1000,7 +1060,7 @@ async def test_create_question_field_headers_async(): # a field header. Set these to a non-empty value. request = question_service.CreateQuestionRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_question), "__call__") as call: @@ -1016,11 +1076,16 @@ async def test_create_question_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_create_question_flattened(): - client = QuestionServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = QuestionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_question), "__call__") as call: @@ -1029,7 +1094,8 @@ def test_create_question_flattened(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.create_question( - parent="parent_value", question=gcd_question.Question(name="name_value"), + parent="parent_value", + question=gcd_question.Question(name="name_value"), ) # Establish that the underlying call was made with the expected @@ -1045,7 +1111,9 @@ def test_create_question_flattened(): def test_create_question_flattened_error(): - client = QuestionServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = QuestionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1074,7 +1142,8 @@ async def test_create_question_flattened_async(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. response = await client.create_question( - parent="parent_value", question=gcd_question.Question(name="name_value"), + parent="parent_value", + question=gcd_question.Question(name="name_value"), ) # Establish that the underlying call was made with the expected @@ -1106,11 +1175,16 @@ async def test_create_question_flattened_error_async(): @pytest.mark.parametrize( - "request_type", [question_service.ExecuteQuestionRequest, dict,] + "request_type", + [ + question_service.ExecuteQuestionRequest, + dict, + ], ) def test_execute_question(request_type, transport: str = "grpc"): client = QuestionServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1147,7 +1221,8 @@ def test_execute_question_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = QuestionServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1164,7 +1239,8 @@ async def test_execute_question_async( request_type=question_service.ExecuteQuestionRequest, ): client = QuestionServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1205,13 +1281,15 @@ async def test_execute_question_async_from_dict(): def test_execute_question_field_headers(): - client = QuestionServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = QuestionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = question_service.ExecuteQuestionRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.execute_question), "__call__") as call: @@ -1225,7 +1303,10 @@ def test_execute_question_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -1238,7 +1319,7 @@ async def test_execute_question_field_headers_async(): # a field header. Set these to a non-empty value. request = question_service.ExecuteQuestionRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.execute_question), "__call__") as call: @@ -1252,11 +1333,16 @@ async def test_execute_question_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_execute_question_flattened(): - client = QuestionServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = QuestionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.execute_question), "__call__") as call: @@ -1265,7 +1351,8 @@ def test_execute_question_flattened(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.execute_question( - name="name_value", interpretation_index=2159, + name="name_value", + interpretation_index=2159, ) # Establish that the underlying call was made with the expected @@ -1281,7 +1368,9 @@ def test_execute_question_flattened(): def test_execute_question_flattened_error(): - client = QuestionServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = QuestionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1308,7 +1397,8 @@ async def test_execute_question_flattened_async(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. response = await client.execute_question( - name="name_value", interpretation_index=2159, + name="name_value", + interpretation_index=2159, ) # Establish that the underlying call was made with the expected @@ -1340,11 +1430,16 @@ async def test_execute_question_flattened_error_async(): @pytest.mark.parametrize( - "request_type", [question_service.GetUserFeedbackRequest, dict,] + "request_type", + [ + question_service.GetUserFeedbackRequest, + dict, + ], ) def test_get_user_feedback(request_type, transport: str = "grpc"): client = QuestionServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1379,7 +1474,8 @@ def test_get_user_feedback_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = QuestionServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1398,7 +1494,8 @@ async def test_get_user_feedback_async( request_type=question_service.GetUserFeedbackRequest, ): client = QuestionServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1437,13 +1534,15 @@ async def test_get_user_feedback_async_from_dict(): def test_get_user_feedback_field_headers(): - client = QuestionServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = QuestionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = question_service.GetUserFeedbackRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1459,7 +1558,10 @@ def test_get_user_feedback_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -1472,7 +1574,7 @@ async def test_get_user_feedback_field_headers_async(): # a field header. Set these to a non-empty value. request = question_service.GetUserFeedbackRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1490,11 +1592,16 @@ async def test_get_user_feedback_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_get_user_feedback_flattened(): - client = QuestionServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = QuestionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1504,7 +1611,9 @@ def test_get_user_feedback_flattened(): call.return_value = user_feedback.UserFeedback() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_user_feedback(name="name_value",) + client.get_user_feedback( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1516,13 +1625,16 @@ def test_get_user_feedback_flattened(): def test_get_user_feedback_flattened_error(): - client = QuestionServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = QuestionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.get_user_feedback( - question_service.GetUserFeedbackRequest(), name="name_value", + question_service.GetUserFeedbackRequest(), + name="name_value", ) @@ -1544,7 +1656,9 @@ async def test_get_user_feedback_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_user_feedback(name="name_value",) + response = await client.get_user_feedback( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1565,16 +1679,22 @@ async def test_get_user_feedback_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.get_user_feedback( - question_service.GetUserFeedbackRequest(), name="name_value", + question_service.GetUserFeedbackRequest(), + name="name_value", ) @pytest.mark.parametrize( - "request_type", [question_service.UpdateUserFeedbackRequest, dict,] + "request_type", + [ + question_service.UpdateUserFeedbackRequest, + dict, + ], ) def test_update_user_feedback(request_type, transport: str = "grpc"): client = QuestionServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1609,7 +1729,8 @@ def test_update_user_feedback_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = QuestionServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1628,7 +1749,8 @@ async def test_update_user_feedback_async( request_type=question_service.UpdateUserFeedbackRequest, ): client = QuestionServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1667,13 +1789,15 @@ async def test_update_user_feedback_async_from_dict(): def test_update_user_feedback_field_headers(): - client = QuestionServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = QuestionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = question_service.UpdateUserFeedbackRequest() - request.user_feedback.name = "user_feedback.name/value" + request.user_feedback.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1691,7 +1815,7 @@ def test_update_user_feedback_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "user_feedback.name=user_feedback.name/value", + "user_feedback.name=name_value", ) in kw["metadata"] @@ -1705,7 +1829,7 @@ async def test_update_user_feedback_field_headers_async(): # a field header. Set these to a non-empty value. request = question_service.UpdateUserFeedbackRequest() - request.user_feedback.name = "user_feedback.name/value" + request.user_feedback.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1725,12 +1849,14 @@ async def test_update_user_feedback_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "user_feedback.name=user_feedback.name/value", + "user_feedback.name=name_value", ) in kw["metadata"] def test_update_user_feedback_flattened(): - client = QuestionServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = QuestionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1758,7 +1884,9 @@ def test_update_user_feedback_flattened(): def test_update_user_feedback_flattened_error(): - client = QuestionServiceClient(credentials=ga_credentials.AnonymousCredentials(),) + client = QuestionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1828,7 +1956,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = QuestionServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -1848,7 +1977,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = QuestionServiceClient(client_options=options, transport=transport,) + client = QuestionServiceClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -1864,7 +1996,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = QuestionServiceClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -1907,10 +2040,28 @@ def test_transport_adc(transport_class): adc.assert_called_once() +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + ], +) +def test_transport_kind(transport_name): + transport = QuestionServiceClient.get_transport_class(transport_name)( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert transport.kind == transport_name + + def test_transport_grpc_default(): # A client should use the gRPC transport by default. - client = QuestionServiceClient(credentials=ga_credentials.AnonymousCredentials(),) - assert isinstance(client.transport, transports.QuestionServiceGrpcTransport,) + client = QuestionServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert isinstance( + client.transport, + transports.QuestionServiceGrpcTransport, + ) def test_question_service_base_transport_error(): @@ -1948,6 +2099,14 @@ def test_question_service_base_transport(): with pytest.raises(NotImplementedError): transport.close() + # Catch all for all remaining methods and properties + remainder = [ + "kind", + ] + for r in remainder: + with pytest.raises(NotImplementedError): + getattr(transport, r)() + def test_question_service_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file @@ -1959,7 +2118,8 @@ def test_question_service_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.QuestionServiceTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -2092,24 +2252,40 @@ def test_question_service_grpc_transport_client_cert_source_for_mtls(transport_c ) -def test_question_service_host_no_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_question_service_host_no_port(transport_name): client = QuestionServiceClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="dataqna.googleapis.com" ), + transport=transport_name, ) - assert client.transport._host == "dataqna.googleapis.com:443" + assert client.transport._host == ("dataqna.googleapis.com:443") -def test_question_service_host_with_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_question_service_host_with_port(transport_name): client = QuestionServiceClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="dataqna.googleapis.com:8000" ), + transport=transport_name, ) - assert client.transport._host == "dataqna.googleapis.com:8000" + assert client.transport._host == ("dataqna.googleapis.com:8000") def test_question_service_grpc_transport_channel(): @@ -2117,7 +2293,8 @@ def test_question_service_grpc_transport_channel(): # Check that channel is used if provided. transport = transports.QuestionServiceGrpcTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -2129,7 +2306,8 @@ def test_question_service_grpc_asyncio_transport_channel(): # Check that channel is used if provided. transport = transports.QuestionServiceGrpcAsyncIOTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -2241,7 +2419,9 @@ def test_question_path(): location = "clam" question = "whelk" expected = "projects/{project}/locations/{location}/questions/{question}".format( - project=project, location=location, question=question, + project=project, + location=location, + question=question, ) actual = QuestionServiceClient.question_path(project, location, question) assert expected == actual @@ -2265,7 +2445,9 @@ def test_user_feedback_path(): location = "mussel" question = "winkle" expected = "projects/{project}/locations/{location}/questions/{question}/userFeedback".format( - project=project, location=location, question=question, + project=project, + location=location, + question=question, ) actual = QuestionServiceClient.user_feedback_path(project, location, question) assert expected == actual @@ -2306,7 +2488,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = QuestionServiceClient.common_folder_path(folder) assert expected == actual @@ -2324,7 +2508,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = QuestionServiceClient.common_organization_path(organization) assert expected == actual @@ -2342,7 +2528,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = QuestionServiceClient.common_project_path(project) assert expected == actual @@ -2362,7 +2550,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = QuestionServiceClient.common_location_path(project, location) assert expected == actual @@ -2387,7 +2576,8 @@ def test_client_with_default_client_info(): transports.QuestionServiceTransport, "_prep_wrapped_messages" ) as prep: client = QuestionServiceClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2396,7 +2586,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = QuestionServiceClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2404,7 +2595,8 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = QuestionServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) with mock.patch.object( type(getattr(client.transport, "grpc_channel")), "close"