From d7e81304acac461da234e75a8ead0420f4fb9c5f Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 20 Apr 2022 20:06:00 -0400 Subject: [PATCH] chore(python): add nox session to sort python imports (#143) Source-Link: https://github.com/googleapis/synthtool/commit/1b71c10e20de7ed3f97f692f99a0e3399b67049f Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:00c9d764fd1cd56265f12a5ef4b99a0c9e87cf261018099141e2ca5158890416 Co-authored-by: Owl Bot --- .../.github/.OwlBot.lock.yaml | 4 +- packages/google-cloud-data-qna/docs/conf.py | 2 +- .../google/cloud/dataqna/__init__.py | 49 ++++++++-------- .../google/cloud/dataqna_v1alpha/__init__.py | 56 ++++++++++--------- .../auto_suggestion_service/__init__.py | 2 +- .../auto_suggestion_service/async_client.py | 9 +-- .../auto_suggestion_service/client.py | 7 ++- .../transports/__init__.py | 1 - .../transports/base.py | 4 +- .../transports/grpc.py | 9 ++- .../transports/grpc_asyncio.py | 9 ++- .../services/question_service/__init__.py | 2 +- .../services/question_service/async_client.py | 18 +++--- .../services/question_service/client.py | 16 +++--- .../question_service/transports/__init__.py | 1 - .../question_service/transports/base.py | 6 +- .../question_service/transports/grpc.py | 11 ++-- .../transports/grpc_asyncio.py | 11 ++-- .../cloud/dataqna_v1alpha/types/__init__.py | 12 ++-- .../dataqna_v1alpha/types/annotated_string.py | 1 - .../types/auto_suggestion_service.py | 1 - .../cloud/dataqna_v1alpha/types/question.py | 5 +- .../dataqna_v1alpha/types/question_service.py | 5 +- .../dataqna_v1alpha/types/user_feedback.py | 1 - packages/google-cloud-data-qna/noxfile.py | 28 +++++++++- packages/google-cloud-data-qna/setup.py | 1 + .../test_auto_suggestion_service.py | 28 ++++------ .../dataqna_v1alpha/test_question_service.py | 38 ++++++------- 28 files changed, 173 insertions(+), 164 deletions(-) diff --git a/packages/google-cloud-data-qna/.github/.OwlBot.lock.yaml b/packages/google-cloud-data-qna/.github/.OwlBot.lock.yaml index bc893c979e20..7c454abf76f3 100644 --- a/packages/google-cloud-data-qna/.github/.OwlBot.lock.yaml +++ b/packages/google-cloud-data-qna/.github/.OwlBot.lock.yaml @@ -13,5 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:8a5d3f6a2e43ed8293f34e06a2f56931d1e88a2694c3bb11b15df4eb256ad163 -# created: 2022-04-06T10:30:21.687684602Z + digest: sha256:00c9d764fd1cd56265f12a5ef4b99a0c9e87cf261018099141e2ca5158890416 +# created: 2022-04-20T23:42:53.970438194Z diff --git a/packages/google-cloud-data-qna/docs/conf.py b/packages/google-cloud-data-qna/docs/conf.py index 0bd5b3df1972..00158b35f18f 100644 --- a/packages/google-cloud-data-qna/docs/conf.py +++ b/packages/google-cloud-data-qna/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 diff --git a/packages/google-cloud-data-qna/google/cloud/dataqna/__init__.py b/packages/google-cloud-data-qna/google/cloud/dataqna/__init__.py index cec6e4a7afde..7c0ef5a5f470 100644 --- a/packages/google-cloud-data-qna/google/cloud/dataqna/__init__.py +++ b/packages/google-cloud-data-qna/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/packages/google-cloud-data-qna/google/cloud/dataqna_v1alpha/__init__.py b/packages/google-cloud-data-qna/google/cloud/dataqna_v1alpha/__init__.py index a47123c937ee..18533c04300a 100644 --- a/packages/google-cloud-data-qna/google/cloud/dataqna_v1alpha/__init__.py +++ b/packages/google-cloud-data-qna/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/packages/google-cloud-data-qna/google/cloud/dataqna_v1alpha/services/auto_suggestion_service/__init__.py b/packages/google-cloud-data-qna/google/cloud/dataqna_v1alpha/services/auto_suggestion_service/__init__.py index db768015d9f1..2767e9f9e953 100644 --- a/packages/google-cloud-data-qna/google/cloud/dataqna_v1alpha/services/auto_suggestion_service/__init__.py +++ b/packages/google-cloud-data-qna/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/packages/google-cloud-data-qna/google/cloud/dataqna_v1alpha/services/auto_suggestion_service/async_client.py b/packages/google-cloud-data-qna/google/cloud/dataqna_v1alpha/services/auto_suggestion_service/async_client.py index 72f982af1e18..664c4426fb5a 100644 --- a/packages/google-cloud-data-qna/google/cloud/dataqna_v1alpha/services/auto_suggestion_service/async_client.py +++ b/packages/google-cloud-data-qna/google/cloud/dataqna_v1alpha/services/auto_suggestion_service/async_client.py @@ -17,14 +17,14 @@ import functools import re from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union -import pkg_resources -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: diff --git a/packages/google-cloud-data-qna/google/cloud/dataqna_v1alpha/services/auto_suggestion_service/client.py b/packages/google-cloud-data-qna/google/cloud/dataqna_v1alpha/services/auto_suggestion_service/client.py index ce355479b50e..52cf4405b72e 100644 --- a/packages/google-cloud-data-qna/google/cloud/dataqna_v1alpha/services/auto_suggestion_service/client.py +++ b/packages/google-cloud-data-qna/google/cloud/dataqna_v1alpha/services/auto_suggestion_service/client.py @@ -17,17 +17,17 @@ import os import re from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union -import pkg_resources 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 diff --git a/packages/google-cloud-data-qna/google/cloud/dataqna_v1alpha/services/auto_suggestion_service/transports/__init__.py b/packages/google-cloud-data-qna/google/cloud/dataqna_v1alpha/services/auto_suggestion_service/transports/__init__.py index 31dca259365d..cdaa5a518967 100644 --- a/packages/google-cloud-data-qna/google/cloud/dataqna_v1alpha/services/auto_suggestion_service/transports/__init__.py +++ b/packages/google-cloud-data-qna/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/packages/google-cloud-data-qna/google/cloud/dataqna_v1alpha/services/auto_suggestion_service/transports/base.py b/packages/google-cloud-data-qna/google/cloud/dataqna_v1alpha/services/auto_suggestion_service/transports/base.py index 454587305bb1..44704042aa08 100644 --- a/packages/google-cloud-data-qna/google/cloud/dataqna_v1alpha/services/auto_suggestion_service/transports/base.py +++ b/packages/google-cloud-data-qna/google/cloud/dataqna_v1alpha/services/auto_suggestion_service/transports/base.py @@ -15,15 +15,15 @@ # 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 diff --git a/packages/google-cloud-data-qna/google/cloud/dataqna_v1alpha/services/auto_suggestion_service/transports/grpc.py b/packages/google-cloud-data-qna/google/cloud/dataqna_v1alpha/services/auto_suggestion_service/transports/grpc.py index a0e181bb508e..6b00b1117b38 100644 --- a/packages/google-cloud-data-qna/google/cloud/dataqna_v1alpha/services/auto_suggestion_service/transports/grpc.py +++ b/packages/google-cloud-data-qna/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): diff --git a/packages/google-cloud-data-qna/google/cloud/dataqna_v1alpha/services/auto_suggestion_service/transports/grpc_asyncio.py b/packages/google-cloud-data-qna/google/cloud/dataqna_v1alpha/services/auto_suggestion_service/transports/grpc_asyncio.py index 721b7aa133ce..9f9dc5d22788 100644 --- a/packages/google-cloud-data-qna/google/cloud/dataqna_v1alpha/services/auto_suggestion_service/transports/grpc_asyncio.py +++ b/packages/google-cloud-data-qna/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/packages/google-cloud-data-qna/google/cloud/dataqna_v1alpha/services/question_service/__init__.py b/packages/google-cloud-data-qna/google/cloud/dataqna_v1alpha/services/question_service/__init__.py index 3bea59c2bbe5..7976730ff8e1 100644 --- a/packages/google-cloud-data-qna/google/cloud/dataqna_v1alpha/services/question_service/__init__.py +++ b/packages/google-cloud-data-qna/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/packages/google-cloud-data-qna/google/cloud/dataqna_v1alpha/services/question_service/async_client.py b/packages/google-cloud-data-qna/google/cloud/dataqna_v1alpha/services/question_service/async_client.py index 6b252a29bbf5..eae8412af567 100644 --- a/packages/google-cloud-data-qna/google/cloud/dataqna_v1alpha/services/question_service/async_client.py +++ b/packages/google-cloud-data-qna/google/cloud/dataqna_v1alpha/services/question_service/async_client.py @@ -17,31 +17,33 @@ import functools import re from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union -import pkg_resources -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: diff --git a/packages/google-cloud-data-qna/google/cloud/dataqna_v1alpha/services/question_service/client.py b/packages/google-cloud-data-qna/google/cloud/dataqna_v1alpha/services/question_service/client.py index 8f11fbcd52f9..d82d37b274b1 100644 --- a/packages/google-cloud-data-qna/google/cloud/dataqna_v1alpha/services/question_service/client.py +++ b/packages/google-cloud-data-qna/google/cloud/dataqna_v1alpha/services/question_service/client.py @@ -17,32 +17,34 @@ import os import re from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union -import pkg_resources 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 diff --git a/packages/google-cloud-data-qna/google/cloud/dataqna_v1alpha/services/question_service/transports/__init__.py b/packages/google-cloud-data-qna/google/cloud/dataqna_v1alpha/services/question_service/transports/__init__.py index 45be22a776ef..80e9be55d316 100644 --- a/packages/google-cloud-data-qna/google/cloud/dataqna_v1alpha/services/question_service/transports/__init__.py +++ b/packages/google-cloud-data-qna/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/packages/google-cloud-data-qna/google/cloud/dataqna_v1alpha/services/question_service/transports/base.py b/packages/google-cloud-data-qna/google/cloud/dataqna_v1alpha/services/question_service/transports/base.py index 1663dc9fa4f8..777764552f1a 100644 --- a/packages/google-cloud-data-qna/google/cloud/dataqna_v1alpha/services/question_service/transports/base.py +++ b/packages/google-cloud-data-qna/google/cloud/dataqna_v1alpha/services/question_service/transports/base.py @@ -15,21 +15,21 @@ # 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( diff --git a/packages/google-cloud-data-qna/google/cloud/dataqna_v1alpha/services/question_service/transports/grpc.py b/packages/google-cloud-data-qna/google/cloud/dataqna_v1alpha/services/question_service/transports/grpc.py index 6be732337c7c..857bb0dcdcf7 100644 --- a/packages/google-cloud-data-qna/google/cloud/dataqna_v1alpha/services/question_service/transports/grpc.py +++ b/packages/google-cloud-data-qna/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): diff --git a/packages/google-cloud-data-qna/google/cloud/dataqna_v1alpha/services/question_service/transports/grpc_asyncio.py b/packages/google-cloud-data-qna/google/cloud/dataqna_v1alpha/services/question_service/transports/grpc_asyncio.py index bc8b92c89032..befbf1cacc41 100644 --- a/packages/google-cloud-data-qna/google/cloud/dataqna_v1alpha/services/question_service/transports/grpc_asyncio.py +++ b/packages/google-cloud-data-qna/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/packages/google-cloud-data-qna/google/cloud/dataqna_v1alpha/types/__init__.py b/packages/google-cloud-data-qna/google/cloud/dataqna_v1alpha/types/__init__.py index 4cb79f97beba..3c9be403bf0b 100644 --- a/packages/google-cloud-data-qna/google/cloud/dataqna_v1alpha/types/__init__.py +++ b/packages/google-cloud-data-qna/google/cloud/dataqna_v1alpha/types/__init__.py @@ -13,15 +13,13 @@ # See the License for the specific language governing permissions and # limitations under the License. # -from .annotated_string import ( - AnnotatedString, -) +from .annotated_string import AnnotatedString from .auto_suggestion_service import ( Suggestion, SuggestionInfo, + SuggestionType, SuggestQueriesRequest, SuggestQueriesResponse, - SuggestionType, ) from .question import ( BigQueryJob, @@ -31,9 +29,9 @@ HumanReadable, Interpretation, InterpretationStructure, + InterpretEntity, InterpretError, Question, - InterpretEntity, ) from .question_service import ( CreateQuestionRequest, @@ -42,9 +40,7 @@ GetUserFeedbackRequest, UpdateUserFeedbackRequest, ) -from .user_feedback import ( - UserFeedback, -) +from .user_feedback import UserFeedback __all__ = ( "AnnotatedString", diff --git a/packages/google-cloud-data-qna/google/cloud/dataqna_v1alpha/types/annotated_string.py b/packages/google-cloud-data-qna/google/cloud/dataqna_v1alpha/types/annotated_string.py index a3574a9235d5..c678b501d32c 100644 --- a/packages/google-cloud-data-qna/google/cloud/dataqna_v1alpha/types/annotated_string.py +++ b/packages/google-cloud-data-qna/google/cloud/dataqna_v1alpha/types/annotated_string.py @@ -15,7 +15,6 @@ # import proto # type: ignore - __protobuf__ = proto.module( package="google.cloud.dataqna.v1alpha", manifest={ diff --git a/packages/google-cloud-data-qna/google/cloud/dataqna_v1alpha/types/auto_suggestion_service.py b/packages/google-cloud-data-qna/google/cloud/dataqna_v1alpha/types/auto_suggestion_service.py index e222cb960109..8496457bc491 100644 --- a/packages/google-cloud-data-qna/google/cloud/dataqna_v1alpha/types/auto_suggestion_service.py +++ b/packages/google-cloud-data-qna/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={ diff --git a/packages/google-cloud-data-qna/google/cloud/dataqna_v1alpha/types/question.py b/packages/google-cloud-data-qna/google/cloud/dataqna_v1alpha/types/question.py index 80f10900a016..a39684df846a 100644 --- a/packages/google-cloud-data-qna/google/cloud/dataqna_v1alpha/types/question.py +++ b/packages/google-cloud-data-qna/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", diff --git a/packages/google-cloud-data-qna/google/cloud/dataqna_v1alpha/types/question_service.py b/packages/google-cloud-data-qna/google/cloud/dataqna_v1alpha/types/question_service.py index 354b3d7ddf9f..6dea8345bd71 100644 --- a/packages/google-cloud-data-qna/google/cloud/dataqna_v1alpha/types/question_service.py +++ b/packages/google-cloud-data-qna/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", diff --git a/packages/google-cloud-data-qna/google/cloud/dataqna_v1alpha/types/user_feedback.py b/packages/google-cloud-data-qna/google/cloud/dataqna_v1alpha/types/user_feedback.py index 41765660bc1f..c573b62f07f6 100644 --- a/packages/google-cloud-data-qna/google/cloud/dataqna_v1alpha/types/user_feedback.py +++ b/packages/google-cloud-data-qna/google/cloud/dataqna_v1alpha/types/user_feedback.py @@ -15,7 +15,6 @@ # import proto # type: ignore - __protobuf__ = proto.module( package="google.cloud.dataqna.v1alpha", manifest={ diff --git a/packages/google-cloud-data-qna/noxfile.py b/packages/google-cloud-data-qna/noxfile.py index 6ee5e8ab96d9..7c1742d2cc93 100644 --- a/packages/google-cloud-data-qna/noxfile.py +++ b/packages/google-cloud-data-qna/noxfile.py @@ -17,6 +17,7 @@ # Generated by synthtool. DO NOT EDIT! from __future__ import absolute_import + import os import pathlib import shutil @@ -25,7 +26,8 @@ import nox BLACK_VERSION = "black==22.3.0" -BLACK_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"] +ISORT_VERSION = "isort==5.10.1" +LINT_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"] DEFAULT_PYTHON_VERSION = "3.8" @@ -83,7 +85,7 @@ def lint(session): session.run( "black", "--check", - *BLACK_PATHS, + *LINT_PATHS, ) session.run("flake8", "google", "tests") @@ -94,7 +96,27 @@ def blacken(session): session.install(BLACK_VERSION) session.run( "black", - *BLACK_PATHS, + *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, ) diff --git a/packages/google-cloud-data-qna/setup.py b/packages/google-cloud-data-qna/setup.py index 74d4b421f9a2..b844644088a8 100644 --- a/packages/google-cloud-data-qna/setup.py +++ b/packages/google-cloud-data-qna/setup.py @@ -17,6 +17,7 @@ import io import os + import setuptools # type: ignore version = "0.6.2" diff --git a/packages/google-cloud-data-qna/tests/unit/gapic/dataqna_v1alpha/test_auto_suggestion_service.py b/packages/google-cloud-data-qna/tests/unit/gapic/dataqna_v1alpha/test_auto_suggestion_service.py index 8a39d296a208..5999733de15b 100644 --- a/packages/google-cloud-data-qna/tests/unit/gapic/dataqna_v1alpha/test_auto_suggestion_service.py +++ b/packages/google-cloud-data-qna/tests/unit/gapic/dataqna_v1alpha/test_auto_suggestion_service.py @@ -13,34 +13,28 @@ # See the License for the specific language governing permissions and # 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 - +import os +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 +import mock +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(): diff --git a/packages/google-cloud-data-qna/tests/unit/gapic/dataqna_v1alpha/test_question_service.py b/packages/google-cloud-data-qna/tests/unit/gapic/dataqna_v1alpha/test_question_service.py index b8a7df280658..a2bea912bcd8 100644 --- a/packages/google-cloud-data-qna/tests/unit/gapic/dataqna_v1alpha/test_question_service.py +++ b/packages/google-cloud-data-qna/tests/unit/gapic/dataqna_v1alpha/test_question_service.py @@ -13,41 +13,37 @@ # See the License for the specific language governing permissions and # 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 - +import os +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 +import mock +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():