From b2eb47b8ac4ef713bf097facd2b825cbb448815a Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Wed, 20 Apr 2022 23:47:56 +0000 Subject: [PATCH] chore(python): add nox session to sort python imports Source-Link: https://github.com/googleapis/synthtool/commit/1b71c10e20de7ed3f97f692f99a0e3399b67049f Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:00c9d764fd1cd56265f12a5ef4b99a0c9e87cf261018099141e2ca5158890416 --- .github/.OwlBot.lock.yaml | 4 +- 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 - noxfile.py | 28 +++++++++- 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/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index bc893c9..7c454ab 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.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/docs/conf.py b/docs/conf.py index 0bd5b3d..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 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 72f982a..664c442 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 @@ -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/google/cloud/dataqna_v1alpha/services/auto_suggestion_service/client.py b/google/cloud/dataqna_v1alpha/services/auto_suggestion_service/client.py index ce35547..52cf440 100644 --- a/google/cloud/dataqna_v1alpha/services/auto_suggestion_service/client.py +++ b/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/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 4545873..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,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/google/cloud/dataqna_v1alpha/services/auto_suggestion_service/transports/grpc.py b/google/cloud/dataqna_v1alpha/services/auto_suggestion_service/transports/grpc.py index a0e181b..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): 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 6b252a2..eae8412 100644 --- a/google/cloud/dataqna_v1alpha/services/question_service/async_client.py +++ b/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/google/cloud/dataqna_v1alpha/services/question_service/client.py b/google/cloud/dataqna_v1alpha/services/question_service/client.py index 8f11fbc..d82d37b 100644 --- a/google/cloud/dataqna_v1alpha/services/question_service/client.py +++ b/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/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 1663dc9..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,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/google/cloud/dataqna_v1alpha/services/question_service/transports/grpc.py b/google/cloud/dataqna_v1alpha/services/question_service/transports/grpc.py index 6be7323..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): 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 4cb79f9..3c9be40 100644 --- a/google/cloud/dataqna_v1alpha/types/__init__.py +++ b/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/google/cloud/dataqna_v1alpha/types/annotated_string.py b/google/cloud/dataqna_v1alpha/types/annotated_string.py index a3574a9..c678b50 100644 --- a/google/cloud/dataqna_v1alpha/types/annotated_string.py +++ b/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/google/cloud/dataqna_v1alpha/types/auto_suggestion_service.py b/google/cloud/dataqna_v1alpha/types/auto_suggestion_service.py index e222cb9..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={ diff --git a/google/cloud/dataqna_v1alpha/types/question.py b/google/cloud/dataqna_v1alpha/types/question.py index 80f1090..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", diff --git a/google/cloud/dataqna_v1alpha/types/question_service.py b/google/cloud/dataqna_v1alpha/types/question_service.py index 354b3d7..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", diff --git a/google/cloud/dataqna_v1alpha/types/user_feedback.py b/google/cloud/dataqna_v1alpha/types/user_feedback.py index 4176566..c573b62 100644 --- a/google/cloud/dataqna_v1alpha/types/user_feedback.py +++ b/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/noxfile.py b/noxfile.py index 6ee5e8a..7c1742d 100644 --- a/noxfile.py +++ b/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/setup.py b/setup.py index 74d4b42..b844644 100644 --- a/setup.py +++ b/setup.py @@ -17,6 +17,7 @@ import io import os + import setuptools # type: ignore version = "0.6.2" 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 8a39d29..5999733 100644 --- a/tests/unit/gapic/dataqna_v1alpha/test_auto_suggestion_service.py +++ b/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/tests/unit/gapic/dataqna_v1alpha/test_question_service.py b/tests/unit/gapic/dataqna_v1alpha/test_question_service.py index b8a7df2..a2bea91 100644 --- a/tests/unit/gapic/dataqna_v1alpha/test_question_service.py +++ b/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():