From bc806aea19ddc1c2fde52bf1abac23b209bd44b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Swe=C3=B1a=20=28Swast=29?= Date: Tue, 19 Mar 2024 13:01:45 -0500 Subject: [PATCH] chore: sort imports (#761) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: sort imports * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot --- docs/conf.py | 2 +- google/cloud/bigquery_storage/__init__.py | 77 ++++++++++--------- google/cloud/bigquery_storage_v1/__init__.py | 3 +- google/cloud/bigquery_storage_v1/client.py | 4 +- .../cloud/bigquery_storage_v1/gapic_types.py | 10 +-- .../services/big_query_read/__init__.py | 2 +- .../services/big_query_read/async_client.py | 21 +++-- .../services/big_query_read/client.py | 17 ++-- .../big_query_read/transports/__init__.py | 1 - .../big_query_read/transports/base.py | 8 +- .../big_query_read/transports/grpc.py | 12 ++- .../big_query_read/transports/grpc_asyncio.py | 12 ++- .../services/big_query_write/__init__.py | 2 +- .../services/big_query_write/async_client.py | 22 +++--- .../services/big_query_write/client.py | 18 ++--- .../big_query_write/transports/__init__.py | 1 - .../big_query_write/transports/base.py | 8 +- .../big_query_write/transports/grpc.py | 12 ++- .../transports/grpc_asyncio.py | 12 ++- .../bigquery_storage_v1/types/__init__.py | 31 ++------ .../bigquery_storage_v1/types/annotations.py | 1 - .../cloud/bigquery_storage_v1/types/arrow.py | 1 - .../cloud/bigquery_storage_v1/types/avro.py | 1 - .../bigquery_storage_v1/types/protobuf.py | 4 +- .../bigquery_storage_v1/types/storage.py | 9 +-- .../cloud/bigquery_storage_v1/types/stream.py | 6 +- .../cloud/bigquery_storage_v1/types/table.py | 1 - google/cloud/bigquery_storage_v1/writer.py | 5 +- .../bigquery_storage_v1beta2/__init__.py | 3 +- .../cloud/bigquery_storage_v1beta2/client.py | 1 - .../services/big_query_read/__init__.py | 2 +- .../services/big_query_read/async_client.py | 21 +++-- .../services/big_query_read/client.py | 17 ++-- .../big_query_read/transports/__init__.py | 1 - .../big_query_read/transports/base.py | 8 +- .../big_query_read/transports/grpc.py | 12 ++- .../big_query_read/transports/grpc_asyncio.py | 12 ++- .../services/big_query_write/__init__.py | 2 +- .../services/big_query_write/async_client.py | 22 +++--- .../services/big_query_write/client.py | 18 ++--- .../big_query_write/transports/__init__.py | 1 - .../big_query_write/transports/base.py | 8 +- .../big_query_write/transports/grpc.py | 12 ++- .../transports/grpc_asyncio.py | 12 ++- .../types/__init__.py | 29 ++----- .../bigquery_storage_v1beta2/types/arrow.py | 1 - .../bigquery_storage_v1beta2/types/avro.py | 1 - .../types/protobuf.py | 4 +- .../bigquery_storage_v1beta2/types/storage.py | 15 ++-- .../bigquery_storage_v1beta2/types/stream.py | 6 +- .../bigquery_storage_v1beta2/types/table.py | 1 - .../cloud/bigquery_storage_v1beta2/writer.py | 5 +- owlbot.py | 2 +- samples/quickstart/noxfile.py | 1 - samples/quickstart/quickstart.py | 3 +- samples/snippets/append_rows_pending.py | 3 +- samples/snippets/append_rows_pending_test.py | 1 - samples/snippets/append_rows_proto2.py | 3 +- samples/snippets/append_rows_proto2_test.py | 1 - samples/snippets/conftest.py | 1 - samples/snippets/noxfile.py | 1 - samples/to_dataframe/noxfile.py | 1 - tests/system/conftest.py | 4 +- tests/system/reader/conftest.py | 3 +- tests/system/reader/test_reader.py | 4 +- tests/system/test_writer.py | 5 +- .../test_big_query_read.py | 34 ++++---- .../test_big_query_write.py | 38 ++++----- .../test_big_query_read.py | 34 ++++---- .../test_big_query_write.py | 38 ++++----- tests/unit/helpers.py | 1 - tests/unit/test_client_v1.py | 1 - tests/unit/test_reader_v1.py | 8 +- tests/unit/test_reader_v1_arrow.py | 3 +- tests/unit/test_writer_v1.py | 9 +-- tests/unit/test_writer_v1beta2.py | 9 +-- 76 files changed, 291 insertions(+), 434 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index c8343d49..f9da5d3a 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/bigquery_storage/__init__.py b/google/cloud/bigquery_storage/__init__.py index d0971c51..54a40387 100644 --- a/google/cloud/bigquery_storage/__init__.py +++ b/google/cloud/bigquery_storage/__init__.py @@ -19,52 +19,53 @@ from google.cloud.bigquery_storage_v1 import BigQueryReadClient +from google.cloud.bigquery_storage_v1 import gapic_types as types +from google.cloud.bigquery_storage_v1.services.big_query_write.async_client import ( + BigQueryWriteAsyncClient, +) from google.cloud.bigquery_storage_v1.services.big_query_write.client import ( BigQueryWriteClient, ) -from google.cloud.bigquery_storage_v1.services.big_query_write.async_client import ( - BigQueryWriteAsyncClient, +from google.cloud.bigquery_storage_v1.types.arrow import ( + ArrowRecordBatch, + ArrowSchema, + ArrowSerializationOptions, ) - -from google.cloud.bigquery_storage_v1 import gapic_types as types -from google.cloud.bigquery_storage_v1.types.arrow import ArrowRecordBatch -from google.cloud.bigquery_storage_v1.types.arrow import ArrowSchema -from google.cloud.bigquery_storage_v1.types.arrow import ArrowSerializationOptions -from google.cloud.bigquery_storage_v1.types.avro import AvroRows -from google.cloud.bigquery_storage_v1.types.avro import AvroSchema -from google.cloud.bigquery_storage_v1.types.avro import AvroSerializationOptions -from google.cloud.bigquery_storage_v1.types.protobuf import ProtoRows -from google.cloud.bigquery_storage_v1.types.protobuf import ProtoSchema -from google.cloud.bigquery_storage_v1.types.storage import AppendRowsRequest -from google.cloud.bigquery_storage_v1.types.storage import AppendRowsResponse -from google.cloud.bigquery_storage_v1.types.storage import ( - BatchCommitWriteStreamsRequest, +from google.cloud.bigquery_storage_v1.types.avro import ( + AvroRows, + AvroSchema, + AvroSerializationOptions, ) +from google.cloud.bigquery_storage_v1.types.protobuf import ProtoRows, ProtoSchema from google.cloud.bigquery_storage_v1.types.storage import ( + AppendRowsRequest, + AppendRowsResponse, + BatchCommitWriteStreamsRequest, BatchCommitWriteStreamsResponse, + CreateReadSessionRequest, + CreateWriteStreamRequest, + FinalizeWriteStreamRequest, + FinalizeWriteStreamResponse, + FlushRowsRequest, + FlushRowsResponse, + GetWriteStreamRequest, + ReadRowsRequest, + ReadRowsResponse, + RowError, + SplitReadStreamRequest, + SplitReadStreamResponse, + StorageError, + StreamStats, + ThrottleState, +) +from google.cloud.bigquery_storage_v1.types.stream import ( + DataFormat, + ReadSession, + ReadStream, + WriteStream, + WriteStreamView, ) -from google.cloud.bigquery_storage_v1.types.storage import CreateReadSessionRequest -from google.cloud.bigquery_storage_v1.types.storage import CreateWriteStreamRequest -from google.cloud.bigquery_storage_v1.types.storage import FinalizeWriteStreamRequest -from google.cloud.bigquery_storage_v1.types.storage import FinalizeWriteStreamResponse -from google.cloud.bigquery_storage_v1.types.storage import FlushRowsRequest -from google.cloud.bigquery_storage_v1.types.storage import FlushRowsResponse -from google.cloud.bigquery_storage_v1.types.storage import GetWriteStreamRequest -from google.cloud.bigquery_storage_v1.types.storage import ReadRowsRequest -from google.cloud.bigquery_storage_v1.types.storage import ReadRowsResponse -from google.cloud.bigquery_storage_v1.types.storage import RowError -from google.cloud.bigquery_storage_v1.types.storage import SplitReadStreamRequest -from google.cloud.bigquery_storage_v1.types.storage import SplitReadStreamResponse -from google.cloud.bigquery_storage_v1.types.storage import StorageError -from google.cloud.bigquery_storage_v1.types.storage import StreamStats -from google.cloud.bigquery_storage_v1.types.storage import ThrottleState -from google.cloud.bigquery_storage_v1.types.stream import ReadSession -from google.cloud.bigquery_storage_v1.types.stream import ReadStream -from google.cloud.bigquery_storage_v1.types.stream import WriteStream -from google.cloud.bigquery_storage_v1.types.stream import DataFormat -from google.cloud.bigquery_storage_v1.types.stream import WriteStreamView -from google.cloud.bigquery_storage_v1.types.table import TableFieldSchema -from google.cloud.bigquery_storage_v1.types.table import TableSchema +from google.cloud.bigquery_storage_v1.types.table import TableFieldSchema, TableSchema __all__ = ( "BigQueryReadClient", diff --git a/google/cloud/bigquery_storage_v1/__init__.py b/google/cloud/bigquery_storage_v1/__init__.py index 007183b4..c9c3915e 100644 --- a/google/cloud/bigquery_storage_v1/__init__.py +++ b/google/cloud/bigquery_storage_v1/__init__.py @@ -20,8 +20,7 @@ __version__ = package_version.__version__ -from google.cloud.bigquery_storage_v1 import client -from google.cloud.bigquery_storage_v1 import types +from google.cloud.bigquery_storage_v1 import client, types class BigQueryReadClient(client.BigQueryReadClient): diff --git a/google/cloud/bigquery_storage_v1/client.py b/google/cloud/bigquery_storage_v1/client.py index 05f91ae9..c891a1b8 100644 --- a/google/cloud/bigquery_storage_v1/client.py +++ b/google/cloud/bigquery_storage_v1/client.py @@ -24,9 +24,7 @@ import google.api_core.gapic_v1.method from google.cloud.bigquery_storage_v1 import reader -from google.cloud.bigquery_storage_v1.services import big_query_read -from google.cloud.bigquery_storage_v1.services import big_query_write - +from google.cloud.bigquery_storage_v1.services import big_query_read, big_query_write _SCOPES = ( "https://www.googleapis.com/auth/bigquery", diff --git a/google/cloud/bigquery_storage_v1/gapic_types.py b/google/cloud/bigquery_storage_v1/gapic_types.py index 55b90e9f..fd37531a 100644 --- a/google/cloud/bigquery_storage_v1/gapic_types.py +++ b/google/cloud/bigquery_storage_v1/gapic_types.py @@ -20,15 +20,11 @@ import inspect import sys -import proto - -from google.cloud.bigquery_storage_v1.types import arrow -from google.cloud.bigquery_storage_v1.types import avro -from google.cloud.bigquery_storage_v1.types import storage -from google.cloud.bigquery_storage_v1.types import stream - from google.protobuf import message as protobuf_message from google.protobuf import timestamp_pb2 +import proto + +from google.cloud.bigquery_storage_v1.types import arrow, avro, storage, stream # The current api core helper does not find new proto messages of type proto.Message, diff --git a/google/cloud/bigquery_storage_v1/services/big_query_read/__init__.py b/google/cloud/bigquery_storage_v1/services/big_query_read/__init__.py index 98bf125b..4736b914 100644 --- a/google/cloud/bigquery_storage_v1/services/big_query_read/__init__.py +++ b/google/cloud/bigquery_storage_v1/services/big_query_read/__init__.py @@ -13,8 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # -from .client import BigQueryReadClient from .async_client import BigQueryReadAsyncClient +from .client import BigQueryReadClient __all__ = ( "BigQueryReadClient", diff --git a/google/cloud/bigquery_storage_v1/services/big_query_read/async_client.py b/google/cloud/bigquery_storage_v1/services/big_query_read/async_client.py index e573ca47..d20049ec 100644 --- a/google/cloud/bigquery_storage_v1/services/big_query_read/async_client.py +++ b/google/cloud/bigquery_storage_v1/services/big_query_read/async_client.py @@ -17,41 +17,40 @@ import functools import re from typing import ( + AsyncIterable, + Awaitable, Dict, Mapping, MutableMapping, MutableSequence, Optional, - AsyncIterable, - Awaitable, Sequence, Tuple, Type, Union, ) -from google.cloud.bigquery_storage_v1 import gapic_version as package_version - -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_async 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 +from google.cloud.bigquery_storage_v1 import gapic_version as package_version + try: OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None] except AttributeError: # pragma: NO COVER OptionalRetry = Union[retries.AsyncRetry, object, None] # type: ignore -from google.cloud.bigquery_storage_v1.types import arrow -from google.cloud.bigquery_storage_v1.types import avro -from google.cloud.bigquery_storage_v1.types import storage -from google.cloud.bigquery_storage_v1.types import stream from google.protobuf import timestamp_pb2 # type: ignore -from .transports.base import BigQueryReadTransport, DEFAULT_CLIENT_INFO -from .transports.grpc_asyncio import BigQueryReadGrpcAsyncIOTransport + +from google.cloud.bigquery_storage_v1.types import arrow, avro, storage, stream + from .client import BigQueryReadClient +from .transports.base import DEFAULT_CLIENT_INFO, BigQueryReadTransport +from .transports.grpc_asyncio import BigQueryReadGrpcAsyncIOTransport class BigQueryReadAsyncClient: diff --git a/google/cloud/bigquery_storage_v1/services/big_query_read/client.py b/google/cloud/bigquery_storage_v1/services/big_query_read/client.py index fa204db4..a1d736e4 100644 --- a/google/cloud/bigquery_storage_v1/services/big_query_read/client.py +++ b/google/cloud/bigquery_storage_v1/services/big_query_read/client.py @@ -18,11 +18,11 @@ import re from typing import ( Dict, + Iterable, Mapping, MutableMapping, MutableSequence, Optional, - Iterable, Sequence, Tuple, Type, @@ -31,29 +31,28 @@ ) import warnings -from google.cloud.bigquery_storage_v1 import gapic_version as package_version - 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 +from google.cloud.bigquery_storage_v1 import gapic_version as package_version + try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault, None] except AttributeError: # pragma: NO COVER OptionalRetry = Union[retries.Retry, object, None] # type: ignore -from google.cloud.bigquery_storage_v1.types import arrow -from google.cloud.bigquery_storage_v1.types import avro -from google.cloud.bigquery_storage_v1.types import storage -from google.cloud.bigquery_storage_v1.types import stream from google.protobuf import timestamp_pb2 # type: ignore -from .transports.base import BigQueryReadTransport, DEFAULT_CLIENT_INFO + +from google.cloud.bigquery_storage_v1.types import arrow, avro, storage, stream + +from .transports.base import DEFAULT_CLIENT_INFO, BigQueryReadTransport from .transports.grpc import BigQueryReadGrpcTransport from .transports.grpc_asyncio import BigQueryReadGrpcAsyncIOTransport diff --git a/google/cloud/bigquery_storage_v1/services/big_query_read/transports/__init__.py b/google/cloud/bigquery_storage_v1/services/big_query_read/transports/__init__.py index 05c54fc7..b936a07e 100644 --- a/google/cloud/bigquery_storage_v1/services/big_query_read/transports/__init__.py +++ b/google/cloud/bigquery_storage_v1/services/big_query_read/transports/__init__.py @@ -20,7 +20,6 @@ from .grpc import BigQueryReadGrpcTransport from .grpc_asyncio import BigQueryReadGrpcAsyncIOTransport - # Compile a registry of transports. _transport_registry = OrderedDict() # type: Dict[str, Type[BigQueryReadTransport]] _transport_registry["grpc"] = BigQueryReadGrpcTransport diff --git a/google/cloud/bigquery_storage_v1/services/big_query_read/transports/base.py b/google/cloud/bigquery_storage_v1/services/big_query_read/transports/base.py index 93600ddb..8c514333 100644 --- a/google/cloud/bigquery_storage_v1/services/big_query_read/transports/base.py +++ b/google/cloud/bigquery_storage_v1/services/big_query_read/transports/base.py @@ -16,18 +16,16 @@ import abc from typing import Awaitable, Callable, Dict, Optional, Sequence, Union -from google.cloud.bigquery_storage_v1 import gapic_version as package_version - -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 -from google.cloud.bigquery_storage_v1.types import storage -from google.cloud.bigquery_storage_v1.types import stream +from google.cloud.bigquery_storage_v1 import gapic_version as package_version +from google.cloud.bigquery_storage_v1.types import storage, stream DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( gapic_version=package_version.__version__ diff --git a/google/cloud/bigquery_storage_v1/services/big_query_read/transports/grpc.py b/google/cloud/bigquery_storage_v1/services/big_query_read/transports/grpc.py index b905da0f..9c2bb8be 100644 --- a/google/cloud/bigquery_storage_v1/services/big_query_read/transports/grpc.py +++ b/google/cloud/bigquery_storage_v1/services/big_query_read/transports/grpc.py @@ -13,20 +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.bigquery_storage_v1.types import storage -from google.cloud.bigquery_storage_v1.types import stream -from .base import BigQueryReadTransport, DEFAULT_CLIENT_INFO +from google.cloud.bigquery_storage_v1.types import storage, stream + +from .base import DEFAULT_CLIENT_INFO, BigQueryReadTransport class BigQueryReadGrpcTransport(BigQueryReadTransport): diff --git a/google/cloud/bigquery_storage_v1/services/big_query_read/transports/grpc_asyncio.py b/google/cloud/bigquery_storage_v1/services/big_query_read/transports/grpc_asyncio.py index f72bb8f2..e7feb4d8 100644 --- a/google/cloud/bigquery_storage_v1/services/big_query_read/transports/grpc_asyncio.py +++ b/google/cloud/bigquery_storage_v1/services/big_query_read/transports/grpc_asyncio.py @@ -13,20 +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.bigquery_storage_v1.types import storage -from google.cloud.bigquery_storage_v1.types import stream -from .base import BigQueryReadTransport, DEFAULT_CLIENT_INFO +from google.cloud.bigquery_storage_v1.types import storage, stream + +from .base import DEFAULT_CLIENT_INFO, BigQueryReadTransport from .grpc import BigQueryReadGrpcTransport diff --git a/google/cloud/bigquery_storage_v1/services/big_query_write/__init__.py b/google/cloud/bigquery_storage_v1/services/big_query_write/__init__.py index 87ac1b98..699700ae 100644 --- a/google/cloud/bigquery_storage_v1/services/big_query_write/__init__.py +++ b/google/cloud/bigquery_storage_v1/services/big_query_write/__init__.py @@ -13,8 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # -from .client import BigQueryWriteClient from .async_client import BigQueryWriteAsyncClient +from .client import BigQueryWriteClient __all__ = ( "BigQueryWriteClient", diff --git a/google/cloud/bigquery_storage_v1/services/big_query_write/async_client.py b/google/cloud/bigquery_storage_v1/services/big_query_write/async_client.py index f6958e7c..9c3ef210 100644 --- a/google/cloud/bigquery_storage_v1/services/big_query_write/async_client.py +++ b/google/cloud/bigquery_storage_v1/services/big_query_write/async_client.py @@ -17,42 +17,42 @@ import functools import re from typing import ( + AsyncIterable, + AsyncIterator, + Awaitable, Dict, Mapping, MutableMapping, MutableSequence, Optional, - AsyncIterable, - Awaitable, - AsyncIterator, Sequence, Tuple, Type, Union, ) -from google.cloud.bigquery_storage_v1 import gapic_version as package_version - -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_async 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 +from google.cloud.bigquery_storage_v1 import gapic_version as package_version + try: OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None] except AttributeError: # pragma: NO COVER OptionalRetry = Union[retries.AsyncRetry, object, None] # type: ignore -from google.cloud.bigquery_storage_v1.types import storage -from google.cloud.bigquery_storage_v1.types import stream -from google.cloud.bigquery_storage_v1.types import table from google.protobuf import timestamp_pb2 # type: ignore from google.rpc import status_pb2 # type: ignore -from .transports.base import BigQueryWriteTransport, DEFAULT_CLIENT_INFO -from .transports.grpc_asyncio import BigQueryWriteGrpcAsyncIOTransport + +from google.cloud.bigquery_storage_v1.types import storage, stream, table + from .client import BigQueryWriteClient +from .transports.base import DEFAULT_CLIENT_INFO, BigQueryWriteTransport +from .transports.grpc_asyncio import BigQueryWriteGrpcAsyncIOTransport class BigQueryWriteAsyncClient: diff --git a/google/cloud/bigquery_storage_v1/services/big_query_write/client.py b/google/cloud/bigquery_storage_v1/services/big_query_write/client.py index 2c69f99e..5e8f1060 100644 --- a/google/cloud/bigquery_storage_v1/services/big_query_write/client.py +++ b/google/cloud/bigquery_storage_v1/services/big_query_write/client.py @@ -18,12 +18,12 @@ import re from typing import ( Dict, + Iterable, + Iterator, Mapping, MutableMapping, MutableSequence, Optional, - Iterable, - Iterator, Sequence, Tuple, Type, @@ -32,29 +32,29 @@ ) import warnings -from google.cloud.bigquery_storage_v1 import gapic_version as package_version - 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 +from google.cloud.bigquery_storage_v1 import gapic_version as package_version + try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault, None] except AttributeError: # pragma: NO COVER OptionalRetry = Union[retries.Retry, object, None] # type: ignore -from google.cloud.bigquery_storage_v1.types import storage -from google.cloud.bigquery_storage_v1.types import stream -from google.cloud.bigquery_storage_v1.types import table from google.protobuf import timestamp_pb2 # type: ignore from google.rpc import status_pb2 # type: ignore -from .transports.base import BigQueryWriteTransport, DEFAULT_CLIENT_INFO + +from google.cloud.bigquery_storage_v1.types import storage, stream, table + +from .transports.base import DEFAULT_CLIENT_INFO, BigQueryWriteTransport from .transports.grpc import BigQueryWriteGrpcTransport from .transports.grpc_asyncio import BigQueryWriteGrpcAsyncIOTransport diff --git a/google/cloud/bigquery_storage_v1/services/big_query_write/transports/__init__.py b/google/cloud/bigquery_storage_v1/services/big_query_write/transports/__init__.py index 31424521..5f98e039 100644 --- a/google/cloud/bigquery_storage_v1/services/big_query_write/transports/__init__.py +++ b/google/cloud/bigquery_storage_v1/services/big_query_write/transports/__init__.py @@ -20,7 +20,6 @@ from .grpc import BigQueryWriteGrpcTransport from .grpc_asyncio import BigQueryWriteGrpcAsyncIOTransport - # Compile a registry of transports. _transport_registry = OrderedDict() # type: Dict[str, Type[BigQueryWriteTransport]] _transport_registry["grpc"] = BigQueryWriteGrpcTransport diff --git a/google/cloud/bigquery_storage_v1/services/big_query_write/transports/base.py b/google/cloud/bigquery_storage_v1/services/big_query_write/transports/base.py index d35d9d1f..da5beafc 100644 --- a/google/cloud/bigquery_storage_v1/services/big_query_write/transports/base.py +++ b/google/cloud/bigquery_storage_v1/services/big_query_write/transports/base.py @@ -16,18 +16,16 @@ import abc from typing import Awaitable, Callable, Dict, Optional, Sequence, Union -from google.cloud.bigquery_storage_v1 import gapic_version as package_version - -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 -from google.cloud.bigquery_storage_v1.types import storage -from google.cloud.bigquery_storage_v1.types import stream +from google.cloud.bigquery_storage_v1 import gapic_version as package_version +from google.cloud.bigquery_storage_v1.types import storage, stream DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( gapic_version=package_version.__version__ diff --git a/google/cloud/bigquery_storage_v1/services/big_query_write/transports/grpc.py b/google/cloud/bigquery_storage_v1/services/big_query_write/transports/grpc.py index d9f45a54..04959531 100644 --- a/google/cloud/bigquery_storage_v1/services/big_query_write/transports/grpc.py +++ b/google/cloud/bigquery_storage_v1/services/big_query_write/transports/grpc.py @@ -13,20 +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.bigquery_storage_v1.types import storage -from google.cloud.bigquery_storage_v1.types import stream -from .base import BigQueryWriteTransport, DEFAULT_CLIENT_INFO +from google.cloud.bigquery_storage_v1.types import storage, stream + +from .base import DEFAULT_CLIENT_INFO, BigQueryWriteTransport class BigQueryWriteGrpcTransport(BigQueryWriteTransport): diff --git a/google/cloud/bigquery_storage_v1/services/big_query_write/transports/grpc_asyncio.py b/google/cloud/bigquery_storage_v1/services/big_query_write/transports/grpc_asyncio.py index aac80336..3400924e 100644 --- a/google/cloud/bigquery_storage_v1/services/big_query_write/transports/grpc_asyncio.py +++ b/google/cloud/bigquery_storage_v1/services/big_query_write/transports/grpc_asyncio.py @@ -13,20 +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.bigquery_storage_v1.types import storage -from google.cloud.bigquery_storage_v1.types import stream -from .base import BigQueryWriteTransport, DEFAULT_CLIENT_INFO +from google.cloud.bigquery_storage_v1.types import storage, stream + +from .base import DEFAULT_CLIENT_INFO, BigQueryWriteTransport from .grpc import BigQueryWriteGrpcTransport diff --git a/google/cloud/bigquery_storage_v1/types/__init__.py b/google/cloud/bigquery_storage_v1/types/__init__.py index e19a3d32..1ea19463 100644 --- a/google/cloud/bigquery_storage_v1/types/__init__.py +++ b/google/cloud/bigquery_storage_v1/types/__init__.py @@ -13,20 +13,9 @@ # See the License for the specific language governing permissions and # limitations under the License. # -from .arrow import ( - ArrowRecordBatch, - ArrowSchema, - ArrowSerializationOptions, -) -from .avro import ( - AvroRows, - AvroSchema, - AvroSerializationOptions, -) -from .protobuf import ( - ProtoRows, - ProtoSchema, -) +from .arrow import ArrowRecordBatch, ArrowSchema, ArrowSerializationOptions +from .avro import AvroRows, AvroSchema, AvroSerializationOptions +from .protobuf import ProtoRows, ProtoSchema from .storage import ( AppendRowsRequest, AppendRowsResponse, @@ -48,18 +37,8 @@ StreamStats, ThrottleState, ) -from .stream import ( - DataFormat, - ReadSession, - ReadStream, - WriteStream, - DataFormat, - WriteStreamView, -) -from .table import ( - TableFieldSchema, - TableSchema, -) +from .stream import DataFormat, ReadSession, ReadStream, WriteStream, WriteStreamView +from .table import TableFieldSchema, TableSchema __all__ = ( "ArrowRecordBatch", diff --git a/google/cloud/bigquery_storage_v1/types/annotations.py b/google/cloud/bigquery_storage_v1/types/annotations.py index b26e1235..ffc4a774 100644 --- a/google/cloud/bigquery_storage_v1/types/annotations.py +++ b/google/cloud/bigquery_storage_v1/types/annotations.py @@ -15,7 +15,6 @@ # import proto # type: ignore - __protobuf__ = proto.module( package="google.cloud.bigquery.storage.v1", manifest={}, diff --git a/google/cloud/bigquery_storage_v1/types/arrow.py b/google/cloud/bigquery_storage_v1/types/arrow.py index c7ecd20b..bc6216cf 100644 --- a/google/cloud/bigquery_storage_v1/types/arrow.py +++ b/google/cloud/bigquery_storage_v1/types/arrow.py @@ -19,7 +19,6 @@ import proto # type: ignore - __protobuf__ = proto.module( package="google.cloud.bigquery.storage.v1", manifest={ diff --git a/google/cloud/bigquery_storage_v1/types/avro.py b/google/cloud/bigquery_storage_v1/types/avro.py index 100c5706..16342502 100644 --- a/google/cloud/bigquery_storage_v1/types/avro.py +++ b/google/cloud/bigquery_storage_v1/types/avro.py @@ -19,7 +19,6 @@ import proto # type: ignore - __protobuf__ = proto.module( package="google.cloud.bigquery.storage.v1", manifest={ diff --git a/google/cloud/bigquery_storage_v1/types/protobuf.py b/google/cloud/bigquery_storage_v1/types/protobuf.py index c5e7ac76..f842db06 100644 --- a/google/cloud/bigquery_storage_v1/types/protobuf.py +++ b/google/cloud/bigquery_storage_v1/types/protobuf.py @@ -17,10 +17,8 @@ from typing import MutableMapping, MutableSequence -import proto # type: ignore - from google.protobuf import descriptor_pb2 # type: ignore - +import proto # type: ignore __protobuf__ = proto.module( package="google.cloud.bigquery.storage.v1", diff --git a/google/cloud/bigquery_storage_v1/types/storage.py b/google/cloud/bigquery_storage_v1/types/storage.py index 20f07e4d..77c44f92 100644 --- a/google/cloud/bigquery_storage_v1/types/storage.py +++ b/google/cloud/bigquery_storage_v1/types/storage.py @@ -17,17 +17,12 @@ from typing import MutableMapping, MutableSequence -import proto # type: ignore - -from google.cloud.bigquery_storage_v1.types import arrow -from google.cloud.bigquery_storage_v1.types import avro -from google.cloud.bigquery_storage_v1.types import protobuf -from google.cloud.bigquery_storage_v1.types import stream -from google.cloud.bigquery_storage_v1.types import table from google.protobuf import timestamp_pb2 # type: ignore from google.protobuf import wrappers_pb2 # type: ignore from google.rpc import status_pb2 # type: ignore +import proto # type: ignore +from google.cloud.bigquery_storage_v1.types import arrow, avro, protobuf, stream, table __protobuf__ = proto.module( package="google.cloud.bigquery.storage.v1", diff --git a/google/cloud/bigquery_storage_v1/types/stream.py b/google/cloud/bigquery_storage_v1/types/stream.py index 93748a2b..eefb7421 100644 --- a/google/cloud/bigquery_storage_v1/types/stream.py +++ b/google/cloud/bigquery_storage_v1/types/stream.py @@ -17,13 +17,11 @@ from typing import MutableMapping, MutableSequence +from google.protobuf import timestamp_pb2 # type: ignore import proto # type: ignore -from google.cloud.bigquery_storage_v1.types import arrow -from google.cloud.bigquery_storage_v1.types import avro +from google.cloud.bigquery_storage_v1.types import arrow, avro from google.cloud.bigquery_storage_v1.types import table as gcbs_table -from google.protobuf import timestamp_pb2 # type: ignore - __protobuf__ = proto.module( package="google.cloud.bigquery.storage.v1", diff --git a/google/cloud/bigquery_storage_v1/types/table.py b/google/cloud/bigquery_storage_v1/types/table.py index 49b26a65..0f3e2dfd 100644 --- a/google/cloud/bigquery_storage_v1/types/table.py +++ b/google/cloud/bigquery_storage_v1/types/table.py @@ -19,7 +19,6 @@ import proto # type: ignore - __protobuf__ = proto.module( package="google.cloud.bigquery.storage.v1", manifest={ diff --git a/google/cloud/bigquery_storage_v1/writer.py b/google/cloud/bigquery_storage_v1/writer.py index 9c9a4927..e7e68b65 100644 --- a/google/cloud/bigquery_storage_v1/writer.py +++ b/google/cloud/bigquery_storage_v1/writer.py @@ -18,13 +18,12 @@ import itertools import logging import queue -import time import threading +import time from typing import Callable, Optional, Sequence, Tuple -from google.api_core import bidi +from google.api_core import bidi, exceptions from google.api_core.future import polling as polling_future -from google.api_core import exceptions import google.api_core.retry import grpc diff --git a/google/cloud/bigquery_storage_v1beta2/__init__.py b/google/cloud/bigquery_storage_v1beta2/__init__.py index c1ec2745..52a44471 100644 --- a/google/cloud/bigquery_storage_v1beta2/__init__.py +++ b/google/cloud/bigquery_storage_v1beta2/__init__.py @@ -20,8 +20,7 @@ __version__ = package_version.__version__ -from google.cloud.bigquery_storage_v1beta2 import client -from google.cloud.bigquery_storage_v1beta2 import types +from google.cloud.bigquery_storage_v1beta2 import client, types class BigQueryReadClient(client.BigQueryReadClient): diff --git a/google/cloud/bigquery_storage_v1beta2/client.py b/google/cloud/bigquery_storage_v1beta2/client.py index 0dc428b9..a02f7651 100644 --- a/google/cloud/bigquery_storage_v1beta2/client.py +++ b/google/cloud/bigquery_storage_v1beta2/client.py @@ -28,7 +28,6 @@ big_query_write, ) - _SCOPES = ( "https://www.googleapis.com/auth/bigquery", "https://www.googleapis.com/auth/cloud-platform", diff --git a/google/cloud/bigquery_storage_v1beta2/services/big_query_read/__init__.py b/google/cloud/bigquery_storage_v1beta2/services/big_query_read/__init__.py index 98bf125b..4736b914 100644 --- a/google/cloud/bigquery_storage_v1beta2/services/big_query_read/__init__.py +++ b/google/cloud/bigquery_storage_v1beta2/services/big_query_read/__init__.py @@ -13,8 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # -from .client import BigQueryReadClient from .async_client import BigQueryReadAsyncClient +from .client import BigQueryReadClient __all__ = ( "BigQueryReadClient", diff --git a/google/cloud/bigquery_storage_v1beta2/services/big_query_read/async_client.py b/google/cloud/bigquery_storage_v1beta2/services/big_query_read/async_client.py index 0aab6d76..9eb8fd84 100644 --- a/google/cloud/bigquery_storage_v1beta2/services/big_query_read/async_client.py +++ b/google/cloud/bigquery_storage_v1beta2/services/big_query_read/async_client.py @@ -17,41 +17,40 @@ import functools import re from typing import ( + AsyncIterable, + Awaitable, Dict, Mapping, MutableMapping, MutableSequence, Optional, - AsyncIterable, - Awaitable, Sequence, Tuple, Type, Union, ) -from google.cloud.bigquery_storage_v1beta2 import gapic_version as package_version - -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_async 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 +from google.cloud.bigquery_storage_v1beta2 import gapic_version as package_version + try: OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None] except AttributeError: # pragma: NO COVER OptionalRetry = Union[retries.AsyncRetry, object, None] # type: ignore -from google.cloud.bigquery_storage_v1beta2.types import arrow -from google.cloud.bigquery_storage_v1beta2.types import avro -from google.cloud.bigquery_storage_v1beta2.types import storage -from google.cloud.bigquery_storage_v1beta2.types import stream from google.protobuf import timestamp_pb2 # type: ignore -from .transports.base import BigQueryReadTransport, DEFAULT_CLIENT_INFO -from .transports.grpc_asyncio import BigQueryReadGrpcAsyncIOTransport + +from google.cloud.bigquery_storage_v1beta2.types import arrow, avro, storage, stream + from .client import BigQueryReadClient +from .transports.base import DEFAULT_CLIENT_INFO, BigQueryReadTransport +from .transports.grpc_asyncio import BigQueryReadGrpcAsyncIOTransport class BigQueryReadAsyncClient: diff --git a/google/cloud/bigquery_storage_v1beta2/services/big_query_read/client.py b/google/cloud/bigquery_storage_v1beta2/services/big_query_read/client.py index 87f22144..e93c80df 100644 --- a/google/cloud/bigquery_storage_v1beta2/services/big_query_read/client.py +++ b/google/cloud/bigquery_storage_v1beta2/services/big_query_read/client.py @@ -18,11 +18,11 @@ import re from typing import ( Dict, + Iterable, Mapping, MutableMapping, MutableSequence, Optional, - Iterable, Sequence, Tuple, Type, @@ -31,29 +31,28 @@ ) import warnings -from google.cloud.bigquery_storage_v1beta2 import gapic_version as package_version - 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 +from google.cloud.bigquery_storage_v1beta2 import gapic_version as package_version + try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault, None] except AttributeError: # pragma: NO COVER OptionalRetry = Union[retries.Retry, object, None] # type: ignore -from google.cloud.bigquery_storage_v1beta2.types import arrow -from google.cloud.bigquery_storage_v1beta2.types import avro -from google.cloud.bigquery_storage_v1beta2.types import storage -from google.cloud.bigquery_storage_v1beta2.types import stream from google.protobuf import timestamp_pb2 # type: ignore -from .transports.base import BigQueryReadTransport, DEFAULT_CLIENT_INFO + +from google.cloud.bigquery_storage_v1beta2.types import arrow, avro, storage, stream + +from .transports.base import DEFAULT_CLIENT_INFO, BigQueryReadTransport from .transports.grpc import BigQueryReadGrpcTransport from .transports.grpc_asyncio import BigQueryReadGrpcAsyncIOTransport diff --git a/google/cloud/bigquery_storage_v1beta2/services/big_query_read/transports/__init__.py b/google/cloud/bigquery_storage_v1beta2/services/big_query_read/transports/__init__.py index 05c54fc7..b936a07e 100644 --- a/google/cloud/bigquery_storage_v1beta2/services/big_query_read/transports/__init__.py +++ b/google/cloud/bigquery_storage_v1beta2/services/big_query_read/transports/__init__.py @@ -20,7 +20,6 @@ from .grpc import BigQueryReadGrpcTransport from .grpc_asyncio import BigQueryReadGrpcAsyncIOTransport - # Compile a registry of transports. _transport_registry = OrderedDict() # type: Dict[str, Type[BigQueryReadTransport]] _transport_registry["grpc"] = BigQueryReadGrpcTransport diff --git a/google/cloud/bigquery_storage_v1beta2/services/big_query_read/transports/base.py b/google/cloud/bigquery_storage_v1beta2/services/big_query_read/transports/base.py index 3ca25216..d5548e14 100644 --- a/google/cloud/bigquery_storage_v1beta2/services/big_query_read/transports/base.py +++ b/google/cloud/bigquery_storage_v1beta2/services/big_query_read/transports/base.py @@ -16,18 +16,16 @@ import abc from typing import Awaitable, Callable, Dict, Optional, Sequence, Union -from google.cloud.bigquery_storage_v1beta2 import gapic_version as package_version - -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 -from google.cloud.bigquery_storage_v1beta2.types import storage -from google.cloud.bigquery_storage_v1beta2.types import stream +from google.cloud.bigquery_storage_v1beta2 import gapic_version as package_version +from google.cloud.bigquery_storage_v1beta2.types import storage, stream DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( gapic_version=package_version.__version__ diff --git a/google/cloud/bigquery_storage_v1beta2/services/big_query_read/transports/grpc.py b/google/cloud/bigquery_storage_v1beta2/services/big_query_read/transports/grpc.py index 62d504f5..5e94a2ca 100644 --- a/google/cloud/bigquery_storage_v1beta2/services/big_query_read/transports/grpc.py +++ b/google/cloud/bigquery_storage_v1beta2/services/big_query_read/transports/grpc.py @@ -13,20 +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.bigquery_storage_v1beta2.types import storage -from google.cloud.bigquery_storage_v1beta2.types import stream -from .base import BigQueryReadTransport, DEFAULT_CLIENT_INFO +from google.cloud.bigquery_storage_v1beta2.types import storage, stream + +from .base import DEFAULT_CLIENT_INFO, BigQueryReadTransport class BigQueryReadGrpcTransport(BigQueryReadTransport): diff --git a/google/cloud/bigquery_storage_v1beta2/services/big_query_read/transports/grpc_asyncio.py b/google/cloud/bigquery_storage_v1beta2/services/big_query_read/transports/grpc_asyncio.py index ddbae3a2..9656cffc 100644 --- a/google/cloud/bigquery_storage_v1beta2/services/big_query_read/transports/grpc_asyncio.py +++ b/google/cloud/bigquery_storage_v1beta2/services/big_query_read/transports/grpc_asyncio.py @@ -13,20 +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.bigquery_storage_v1beta2.types import storage -from google.cloud.bigquery_storage_v1beta2.types import stream -from .base import BigQueryReadTransport, DEFAULT_CLIENT_INFO +from google.cloud.bigquery_storage_v1beta2.types import storage, stream + +from .base import DEFAULT_CLIENT_INFO, BigQueryReadTransport from .grpc import BigQueryReadGrpcTransport diff --git a/google/cloud/bigquery_storage_v1beta2/services/big_query_write/__init__.py b/google/cloud/bigquery_storage_v1beta2/services/big_query_write/__init__.py index 87ac1b98..699700ae 100644 --- a/google/cloud/bigquery_storage_v1beta2/services/big_query_write/__init__.py +++ b/google/cloud/bigquery_storage_v1beta2/services/big_query_write/__init__.py @@ -13,8 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # -from .client import BigQueryWriteClient from .async_client import BigQueryWriteAsyncClient +from .client import BigQueryWriteClient __all__ = ( "BigQueryWriteClient", diff --git a/google/cloud/bigquery_storage_v1beta2/services/big_query_write/async_client.py b/google/cloud/bigquery_storage_v1beta2/services/big_query_write/async_client.py index 1a31e242..1f953403 100644 --- a/google/cloud/bigquery_storage_v1beta2/services/big_query_write/async_client.py +++ b/google/cloud/bigquery_storage_v1beta2/services/big_query_write/async_client.py @@ -17,14 +17,14 @@ import functools import re from typing import ( + AsyncIterable, + AsyncIterator, + Awaitable, Dict, Mapping, MutableMapping, MutableSequence, Optional, - AsyncIterable, - Awaitable, - AsyncIterator, Sequence, Tuple, Type, @@ -32,28 +32,28 @@ ) import warnings -from google.cloud.bigquery_storage_v1beta2 import gapic_version as package_version - -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_async 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 +from google.cloud.bigquery_storage_v1beta2 import gapic_version as package_version + try: OptionalRetry = Union[retries.AsyncRetry, gapic_v1.method._MethodDefault, None] except AttributeError: # pragma: NO COVER OptionalRetry = Union[retries.AsyncRetry, object, None] # type: ignore -from google.cloud.bigquery_storage_v1beta2.types import storage -from google.cloud.bigquery_storage_v1beta2.types import stream -from google.cloud.bigquery_storage_v1beta2.types import table from google.protobuf import timestamp_pb2 # type: ignore from google.rpc import status_pb2 # type: ignore -from .transports.base import BigQueryWriteTransport, DEFAULT_CLIENT_INFO -from .transports.grpc_asyncio import BigQueryWriteGrpcAsyncIOTransport + +from google.cloud.bigquery_storage_v1beta2.types import storage, stream, table + from .client import BigQueryWriteClient +from .transports.base import DEFAULT_CLIENT_INFO, BigQueryWriteTransport +from .transports.grpc_asyncio import BigQueryWriteGrpcAsyncIOTransport class BigQueryWriteAsyncClient: diff --git a/google/cloud/bigquery_storage_v1beta2/services/big_query_write/client.py b/google/cloud/bigquery_storage_v1beta2/services/big_query_write/client.py index 6312041c..21b75f77 100644 --- a/google/cloud/bigquery_storage_v1beta2/services/big_query_write/client.py +++ b/google/cloud/bigquery_storage_v1beta2/services/big_query_write/client.py @@ -18,12 +18,12 @@ import re from typing import ( Dict, + Iterable, + Iterator, Mapping, MutableMapping, MutableSequence, Optional, - Iterable, - Iterator, Sequence, Tuple, Type, @@ -32,29 +32,29 @@ ) import warnings -from google.cloud.bigquery_storage_v1beta2 import gapic_version as package_version - 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 +from google.cloud.bigquery_storage_v1beta2 import gapic_version as package_version + try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault, None] except AttributeError: # pragma: NO COVER OptionalRetry = Union[retries.Retry, object, None] # type: ignore -from google.cloud.bigquery_storage_v1beta2.types import storage -from google.cloud.bigquery_storage_v1beta2.types import stream -from google.cloud.bigquery_storage_v1beta2.types import table from google.protobuf import timestamp_pb2 # type: ignore from google.rpc import status_pb2 # type: ignore -from .transports.base import BigQueryWriteTransport, DEFAULT_CLIENT_INFO + +from google.cloud.bigquery_storage_v1beta2.types import storage, stream, table + +from .transports.base import DEFAULT_CLIENT_INFO, BigQueryWriteTransport from .transports.grpc import BigQueryWriteGrpcTransport from .transports.grpc_asyncio import BigQueryWriteGrpcAsyncIOTransport diff --git a/google/cloud/bigquery_storage_v1beta2/services/big_query_write/transports/__init__.py b/google/cloud/bigquery_storage_v1beta2/services/big_query_write/transports/__init__.py index 31424521..5f98e039 100644 --- a/google/cloud/bigquery_storage_v1beta2/services/big_query_write/transports/__init__.py +++ b/google/cloud/bigquery_storage_v1beta2/services/big_query_write/transports/__init__.py @@ -20,7 +20,6 @@ from .grpc import BigQueryWriteGrpcTransport from .grpc_asyncio import BigQueryWriteGrpcAsyncIOTransport - # Compile a registry of transports. _transport_registry = OrderedDict() # type: Dict[str, Type[BigQueryWriteTransport]] _transport_registry["grpc"] = BigQueryWriteGrpcTransport diff --git a/google/cloud/bigquery_storage_v1beta2/services/big_query_write/transports/base.py b/google/cloud/bigquery_storage_v1beta2/services/big_query_write/transports/base.py index b63248cc..2395160c 100644 --- a/google/cloud/bigquery_storage_v1beta2/services/big_query_write/transports/base.py +++ b/google/cloud/bigquery_storage_v1beta2/services/big_query_write/transports/base.py @@ -16,18 +16,16 @@ import abc from typing import Awaitable, Callable, Dict, Optional, Sequence, Union -from google.cloud.bigquery_storage_v1beta2 import gapic_version as package_version - -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 -from google.cloud.bigquery_storage_v1beta2.types import storage -from google.cloud.bigquery_storage_v1beta2.types import stream +from google.cloud.bigquery_storage_v1beta2 import gapic_version as package_version +from google.cloud.bigquery_storage_v1beta2.types import storage, stream DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( gapic_version=package_version.__version__ diff --git a/google/cloud/bigquery_storage_v1beta2/services/big_query_write/transports/grpc.py b/google/cloud/bigquery_storage_v1beta2/services/big_query_write/transports/grpc.py index 4127d93c..fdbda23e 100644 --- a/google/cloud/bigquery_storage_v1beta2/services/big_query_write/transports/grpc.py +++ b/google/cloud/bigquery_storage_v1beta2/services/big_query_write/transports/grpc.py @@ -13,20 +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.bigquery_storage_v1beta2.types import storage -from google.cloud.bigquery_storage_v1beta2.types import stream -from .base import BigQueryWriteTransport, DEFAULT_CLIENT_INFO +from google.cloud.bigquery_storage_v1beta2.types import storage, stream + +from .base import DEFAULT_CLIENT_INFO, BigQueryWriteTransport class BigQueryWriteGrpcTransport(BigQueryWriteTransport): diff --git a/google/cloud/bigquery_storage_v1beta2/services/big_query_write/transports/grpc_asyncio.py b/google/cloud/bigquery_storage_v1beta2/services/big_query_write/transports/grpc_asyncio.py index 9cbc83bf..730b03f3 100644 --- a/google/cloud/bigquery_storage_v1beta2/services/big_query_write/transports/grpc_asyncio.py +++ b/google/cloud/bigquery_storage_v1beta2/services/big_query_write/transports/grpc_asyncio.py @@ -13,20 +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.bigquery_storage_v1beta2.types import storage -from google.cloud.bigquery_storage_v1beta2.types import stream -from .base import BigQueryWriteTransport, DEFAULT_CLIENT_INFO +from google.cloud.bigquery_storage_v1beta2.types import storage, stream + +from .base import DEFAULT_CLIENT_INFO, BigQueryWriteTransport from .grpc import BigQueryWriteGrpcTransport diff --git a/google/cloud/bigquery_storage_v1beta2/types/__init__.py b/google/cloud/bigquery_storage_v1beta2/types/__init__.py index 1042a542..08ca4287 100644 --- a/google/cloud/bigquery_storage_v1beta2/types/__init__.py +++ b/google/cloud/bigquery_storage_v1beta2/types/__init__.py @@ -13,19 +13,9 @@ # See the License for the specific language governing permissions and # limitations under the License. # -from .arrow import ( - ArrowRecordBatch, - ArrowSchema, - ArrowSerializationOptions, -) -from .avro import ( - AvroRows, - AvroSchema, -) -from .protobuf import ( - ProtoRows, - ProtoSchema, -) +from .arrow import ArrowRecordBatch, ArrowSchema, ArrowSerializationOptions +from .avro import AvroRows, AvroSchema +from .protobuf import ProtoRows, ProtoSchema from .storage import ( AppendRowsRequest, AppendRowsResponse, @@ -46,17 +36,8 @@ StreamStats, ThrottleState, ) -from .stream import ( - DataFormat, - ReadSession, - ReadStream, - WriteStream, - DataFormat, -) -from .table import ( - TableFieldSchema, - TableSchema, -) +from .stream import DataFormat, ReadSession, ReadStream, WriteStream +from .table import TableFieldSchema, TableSchema __all__ = ( "ArrowRecordBatch", diff --git a/google/cloud/bigquery_storage_v1beta2/types/arrow.py b/google/cloud/bigquery_storage_v1beta2/types/arrow.py index 7f1b21bf..c1fab46f 100644 --- a/google/cloud/bigquery_storage_v1beta2/types/arrow.py +++ b/google/cloud/bigquery_storage_v1beta2/types/arrow.py @@ -19,7 +19,6 @@ import proto # type: ignore - __protobuf__ = proto.module( package="google.cloud.bigquery.storage.v1beta2", manifest={ diff --git a/google/cloud/bigquery_storage_v1beta2/types/avro.py b/google/cloud/bigquery_storage_v1beta2/types/avro.py index f451d6be..536628f4 100644 --- a/google/cloud/bigquery_storage_v1beta2/types/avro.py +++ b/google/cloud/bigquery_storage_v1beta2/types/avro.py @@ -19,7 +19,6 @@ import proto # type: ignore - __protobuf__ = proto.module( package="google.cloud.bigquery.storage.v1beta2", manifest={ diff --git a/google/cloud/bigquery_storage_v1beta2/types/protobuf.py b/google/cloud/bigquery_storage_v1beta2/types/protobuf.py index ab040354..52fee257 100644 --- a/google/cloud/bigquery_storage_v1beta2/types/protobuf.py +++ b/google/cloud/bigquery_storage_v1beta2/types/protobuf.py @@ -17,10 +17,8 @@ from typing import MutableMapping, MutableSequence -import proto # type: ignore - from google.protobuf import descriptor_pb2 # type: ignore - +import proto # type: ignore __protobuf__ = proto.module( package="google.cloud.bigquery.storage.v1beta2", diff --git a/google/cloud/bigquery_storage_v1beta2/types/storage.py b/google/cloud/bigquery_storage_v1beta2/types/storage.py index 3404687a..cbd5bbaf 100644 --- a/google/cloud/bigquery_storage_v1beta2/types/storage.py +++ b/google/cloud/bigquery_storage_v1beta2/types/storage.py @@ -17,17 +17,18 @@ from typing import MutableMapping, MutableSequence -import proto # type: ignore - -from google.cloud.bigquery_storage_v1beta2.types import arrow -from google.cloud.bigquery_storage_v1beta2.types import avro -from google.cloud.bigquery_storage_v1beta2.types import protobuf -from google.cloud.bigquery_storage_v1beta2.types import stream -from google.cloud.bigquery_storage_v1beta2.types import table from google.protobuf import timestamp_pb2 # type: ignore from google.protobuf import wrappers_pb2 # type: ignore from google.rpc import status_pb2 # type: ignore +import proto # type: ignore +from google.cloud.bigquery_storage_v1beta2.types import ( + arrow, + avro, + protobuf, + stream, + table, +) __protobuf__ = proto.module( package="google.cloud.bigquery.storage.v1beta2", diff --git a/google/cloud/bigquery_storage_v1beta2/types/stream.py b/google/cloud/bigquery_storage_v1beta2/types/stream.py index 29a6e268..7c0e314a 100644 --- a/google/cloud/bigquery_storage_v1beta2/types/stream.py +++ b/google/cloud/bigquery_storage_v1beta2/types/stream.py @@ -17,13 +17,11 @@ from typing import MutableMapping, MutableSequence +from google.protobuf import timestamp_pb2 # type: ignore import proto # type: ignore -from google.cloud.bigquery_storage_v1beta2.types import arrow -from google.cloud.bigquery_storage_v1beta2.types import avro +from google.cloud.bigquery_storage_v1beta2.types import arrow, avro from google.cloud.bigquery_storage_v1beta2.types import table as gcbs_table -from google.protobuf import timestamp_pb2 # type: ignore - __protobuf__ = proto.module( package="google.cloud.bigquery.storage.v1beta2", diff --git a/google/cloud/bigquery_storage_v1beta2/types/table.py b/google/cloud/bigquery_storage_v1beta2/types/table.py index 4d55bc3e..75a76ed6 100644 --- a/google/cloud/bigquery_storage_v1beta2/types/table.py +++ b/google/cloud/bigquery_storage_v1beta2/types/table.py @@ -19,7 +19,6 @@ import proto # type: ignore - __protobuf__ = proto.module( package="google.cloud.bigquery.storage.v1beta2", manifest={ diff --git a/google/cloud/bigquery_storage_v1beta2/writer.py b/google/cloud/bigquery_storage_v1beta2/writer.py index 20019afe..58299f15 100644 --- a/google/cloud/bigquery_storage_v1beta2/writer.py +++ b/google/cloud/bigquery_storage_v1beta2/writer.py @@ -18,13 +18,12 @@ import itertools import logging import queue -import time import threading +import time from typing import Callable, Optional, Sequence, Tuple -from google.api_core import bidi +from google.api_core import bidi, exceptions from google.api_core.future import polling as polling_future -from google.api_core import exceptions import google.api_core.retry import grpc diff --git a/owlbot.py b/owlbot.py index b412127e..99d99b19 100644 --- a/owlbot.py +++ b/owlbot.py @@ -125,4 +125,4 @@ # run format session for all directories which have a noxfile for noxfile in Path(".").glob("**/noxfile.py"): - s.shell.run(["nox", "-s", "blacken"], cwd=noxfile.parent, hide_output=False) \ No newline at end of file + s.shell.run(["nox", "-s", "format"], cwd=noxfile.parent, hide_output=False) diff --git a/samples/quickstart/noxfile.py b/samples/quickstart/noxfile.py index 3b713594..c36d5f2d 100644 --- a/samples/quickstart/noxfile.py +++ b/samples/quickstart/noxfile.py @@ -22,7 +22,6 @@ import nox - # WARNING - WARNING - WARNING - WARNING - WARNING # WARNING - WARNING - WARNING - WARNING - WARNING # DO NOT EDIT THIS FILE EVER! diff --git a/samples/quickstart/quickstart.py b/samples/quickstart/quickstart.py index 6fbbdb31..2d065083 100644 --- a/samples/quickstart/quickstart.py +++ b/samples/quickstart/quickstart.py @@ -17,8 +17,7 @@ def main(project_id="your-project-id", snapshot_millis=0): # [START bigquerystorage_quickstart] - from google.cloud.bigquery_storage import BigQueryReadClient - from google.cloud.bigquery_storage import types + from google.cloud.bigquery_storage import BigQueryReadClient, types # TODO(developer): Set the project_id variable. # project_id = 'your-project-id' diff --git a/samples/snippets/append_rows_pending.py b/samples/snippets/append_rows_pending.py index 1c391a09..13fdab6c 100644 --- a/samples/snippets/append_rows_pending.py +++ b/samples/snippets/append_rows_pending.py @@ -19,8 +19,7 @@ """ from google.cloud import bigquery_storage_v1 -from google.cloud.bigquery_storage_v1 import types -from google.cloud.bigquery_storage_v1 import writer +from google.cloud.bigquery_storage_v1 import types, writer from google.protobuf import descriptor_pb2 # If you update the customer_record.proto protocol buffer definition, run: diff --git a/samples/snippets/append_rows_pending_test.py b/samples/snippets/append_rows_pending_test.py index dc0e690d..508ce60b 100644 --- a/samples/snippets/append_rows_pending_test.py +++ b/samples/snippets/append_rows_pending_test.py @@ -20,7 +20,6 @@ from . import append_rows_pending - DIR = pathlib.Path(__file__).parent diff --git a/samples/snippets/append_rows_proto2.py b/samples/snippets/append_rows_proto2.py index a06c29d7..667f775e 100644 --- a/samples/snippets/append_rows_proto2.py +++ b/samples/snippets/append_rows_proto2.py @@ -21,8 +21,7 @@ import decimal from google.cloud import bigquery_storage_v1 -from google.cloud.bigquery_storage_v1 import types -from google.cloud.bigquery_storage_v1 import writer +from google.cloud.bigquery_storage_v1 import types, writer from google.protobuf import descriptor_pb2 # If you make updates to the sample_data.proto protocol buffers definition, diff --git a/samples/snippets/append_rows_proto2_test.py b/samples/snippets/append_rows_proto2_test.py index d35e9a78..f88c9248 100644 --- a/samples/snippets/append_rows_proto2_test.py +++ b/samples/snippets/append_rows_proto2_test.py @@ -22,7 +22,6 @@ from . import append_rows_proto2 - DIR = pathlib.Path(__file__).parent diff --git a/samples/snippets/conftest.py b/samples/snippets/conftest.py index 531f0b9d..b5a9c444 100644 --- a/samples/snippets/conftest.py +++ b/samples/snippets/conftest.py @@ -16,7 +16,6 @@ import pytest import test_utils.prefixer - prefixer = test_utils.prefixer.Prefixer("python-bigquery-storage", "samples/snippets") diff --git a/samples/snippets/noxfile.py b/samples/snippets/noxfile.py index 3b713594..c36d5f2d 100644 --- a/samples/snippets/noxfile.py +++ b/samples/snippets/noxfile.py @@ -22,7 +22,6 @@ import nox - # WARNING - WARNING - WARNING - WARNING - WARNING # WARNING - WARNING - WARNING - WARNING - WARNING # DO NOT EDIT THIS FILE EVER! diff --git a/samples/to_dataframe/noxfile.py b/samples/to_dataframe/noxfile.py index 3b713594..c36d5f2d 100644 --- a/samples/to_dataframe/noxfile.py +++ b/samples/to_dataframe/noxfile.py @@ -22,7 +22,6 @@ import nox - # WARNING - WARNING - WARNING - WARNING - WARNING # WARNING - WARNING - WARNING - WARNING - WARNING # DO NOT EDIT THIS FILE EVER! diff --git a/tests/system/conftest.py b/tests/system/conftest.py index 800da736..8007dcad 100644 --- a/tests/system/conftest.py +++ b/tests/system/conftest.py @@ -19,12 +19,12 @@ import uuid import google.auth -from google.cloud import bigquery import pytest import test_utils.prefixer -from . import helpers +from google.cloud import bigquery +from . import helpers prefixer = test_utils.prefixer.Prefixer("python-bigquery-storage", "tests/system") diff --git a/tests/system/reader/conftest.py b/tests/system/reader/conftest.py index c27bd771..2078dbae 100644 --- a/tests/system/reader/conftest.py +++ b/tests/system/reader/conftest.py @@ -17,8 +17,7 @@ import pytest -from google.cloud import bigquery_storage -from google.cloud import bigquery_storage_v1beta2 +from google.cloud import bigquery_storage, bigquery_storage_v1beta2 @pytest.fixture(scope="session") diff --git a/tests/system/reader/test_reader.py b/tests/system/reader/test_reader.py index 24905c59..e2b9c9de 100644 --- a/tests/system/reader/test_reader.py +++ b/tests/system/reader/test_reader.py @@ -21,12 +21,12 @@ import re import uuid -from google.cloud import bigquery import pytest import pytz -from .. import helpers +from google.cloud import bigquery +from .. import helpers _TABLE_FORMAT = "projects/{}/datasets/{}/tables/{}" diff --git a/tests/system/test_writer.py b/tests/system/test_writer.py index a5b19b3e..eaaefa18 100644 --- a/tests/system/test_writer.py +++ b/tests/system/test_writer.py @@ -12,12 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. +import uuid + from google.api_core import exceptions import pytest from google.cloud.bigquery_storage_v1 import types as gapic_types from google.cloud.bigquery_storage_v1.writer import AppendRowsStream -import uuid @pytest.fixture @@ -57,8 +58,8 @@ def test_append_rows_with_invalid_stream_name_fails_fast(bqstorage_write_client) def test_append_rows_with_proto3(bqstorage_write_client, table): - import proto from google.protobuf import descriptor_pb2 + import proto # Using Proto Plus to build proto3 # Declare proto3 field `optional` for presence diff --git a/tests/unit/gapic/bigquery_storage_v1/test_big_query_read.py b/tests/unit/gapic/bigquery_storage_v1/test_big_query_read.py index 7273456e..3fe90196 100644 --- a/tests/unit/gapic/bigquery_storage_v1/test_big_query_read.py +++ b/tests/unit/gapic/bigquery_storage_v1/test_big_query_read.py @@ -22,34 +22,28 @@ except ImportError: # pragma: NO COVER import mock -import grpc -from grpc.experimental import aio import math -import pytest -from google.api_core import api_core_version -from proto.marshal.rules.dates import DurationRule, TimestampRule -from proto.marshal.rules import wrappers -from google.api_core import client_options +from google.api_core import gapic_v1, grpc_helpers, grpc_helpers_async, path_template +from google.api_core import api_core_version, 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 timestamp_pb2 # type: ignore +import grpc +from grpc.experimental import aio +from proto.marshal.rules import wrappers +from proto.marshal.rules.dates import DurationRule, TimestampRule +import pytest + from google.cloud.bigquery_storage_v1.services.big_query_read import ( BigQueryReadAsyncClient, + BigQueryReadClient, + transports, ) -from google.cloud.bigquery_storage_v1.services.big_query_read import BigQueryReadClient -from google.cloud.bigquery_storage_v1.services.big_query_read import transports -from google.cloud.bigquery_storage_v1.types import arrow -from google.cloud.bigquery_storage_v1.types import avro -from google.cloud.bigquery_storage_v1.types import storage -from google.cloud.bigquery_storage_v1.types import stream -from google.oauth2 import service_account -from google.protobuf import timestamp_pb2 # type: ignore -import google.auth +from google.cloud.bigquery_storage_v1.types import arrow, avro, storage, stream def client_cert_source_callback(): diff --git a/tests/unit/gapic/bigquery_storage_v1/test_big_query_write.py b/tests/unit/gapic/bigquery_storage_v1/test_big_query_write.py index b88a2cdc..9359f142 100644 --- a/tests/unit/gapic/bigquery_storage_v1/test_big_query_write.py +++ b/tests/unit/gapic/bigquery_storage_v1/test_big_query_write.py @@ -22,39 +22,31 @@ except ImportError: # pragma: NO COVER import mock -import grpc -from grpc.experimental import aio import math -import pytest -from google.api_core import api_core_version -from proto.marshal.rules.dates import DurationRule, TimestampRule -from proto.marshal.rules import wrappers -from google.api_core import client_options +from google.api_core import gapic_v1, grpc_helpers, grpc_helpers_async, path_template +from google.api_core import api_core_version, 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.cloud.bigquery_storage_v1.services.big_query_write import ( - BigQueryWriteAsyncClient, -) -from google.cloud.bigquery_storage_v1.services.big_query_write import ( - BigQueryWriteClient, -) -from google.cloud.bigquery_storage_v1.services.big_query_write import transports -from google.cloud.bigquery_storage_v1.types import protobuf -from google.cloud.bigquery_storage_v1.types import storage -from google.cloud.bigquery_storage_v1.types import stream -from google.cloud.bigquery_storage_v1.types import table from google.oauth2 import service_account from google.protobuf import descriptor_pb2 # type: ignore from google.protobuf import timestamp_pb2 # type: ignore from google.protobuf import wrappers_pb2 # type: ignore from google.rpc import status_pb2 # type: ignore -import google.auth +import grpc +from grpc.experimental import aio +from proto.marshal.rules import wrappers +from proto.marshal.rules.dates import DurationRule, TimestampRule +import pytest + +from google.cloud.bigquery_storage_v1.services.big_query_write import ( + BigQueryWriteAsyncClient, + BigQueryWriteClient, + transports, +) +from google.cloud.bigquery_storage_v1.types import protobuf, storage, stream, table def client_cert_source_callback(): diff --git a/tests/unit/gapic/bigquery_storage_v1beta2/test_big_query_read.py b/tests/unit/gapic/bigquery_storage_v1beta2/test_big_query_read.py index 94ea7a06..1b5f84cc 100644 --- a/tests/unit/gapic/bigquery_storage_v1beta2/test_big_query_read.py +++ b/tests/unit/gapic/bigquery_storage_v1beta2/test_big_query_read.py @@ -22,36 +22,28 @@ except ImportError: # pragma: NO COVER import mock -import grpc -from grpc.experimental import aio import math -import pytest -from google.api_core import api_core_version -from proto.marshal.rules.dates import DurationRule, TimestampRule -from proto.marshal.rules import wrappers -from google.api_core import client_options +from google.api_core import gapic_v1, grpc_helpers, grpc_helpers_async, path_template +from google.api_core import api_core_version, 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 timestamp_pb2 # type: ignore +import grpc +from grpc.experimental import aio +from proto.marshal.rules import wrappers +from proto.marshal.rules.dates import DurationRule, TimestampRule +import pytest + from google.cloud.bigquery_storage_v1beta2.services.big_query_read import ( BigQueryReadAsyncClient, -) -from google.cloud.bigquery_storage_v1beta2.services.big_query_read import ( BigQueryReadClient, + transports, ) -from google.cloud.bigquery_storage_v1beta2.services.big_query_read import transports -from google.cloud.bigquery_storage_v1beta2.types import arrow -from google.cloud.bigquery_storage_v1beta2.types import avro -from google.cloud.bigquery_storage_v1beta2.types import storage -from google.cloud.bigquery_storage_v1beta2.types import stream -from google.oauth2 import service_account -from google.protobuf import timestamp_pb2 # type: ignore -import google.auth +from google.cloud.bigquery_storage_v1beta2.types import arrow, avro, storage, stream def client_cert_source_callback(): diff --git a/tests/unit/gapic/bigquery_storage_v1beta2/test_big_query_write.py b/tests/unit/gapic/bigquery_storage_v1beta2/test_big_query_write.py index ddfbba3e..3aff9acf 100644 --- a/tests/unit/gapic/bigquery_storage_v1beta2/test_big_query_write.py +++ b/tests/unit/gapic/bigquery_storage_v1beta2/test_big_query_write.py @@ -22,39 +22,31 @@ except ImportError: # pragma: NO COVER import mock -import grpc -from grpc.experimental import aio import math -import pytest -from google.api_core import api_core_version -from proto.marshal.rules.dates import DurationRule, TimestampRule -from proto.marshal.rules import wrappers -from google.api_core import client_options +from google.api_core import gapic_v1, grpc_helpers, grpc_helpers_async, path_template +from google.api_core import api_core_version, 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.cloud.bigquery_storage_v1beta2.services.big_query_write import ( - BigQueryWriteAsyncClient, -) -from google.cloud.bigquery_storage_v1beta2.services.big_query_write import ( - BigQueryWriteClient, -) -from google.cloud.bigquery_storage_v1beta2.services.big_query_write import transports -from google.cloud.bigquery_storage_v1beta2.types import protobuf -from google.cloud.bigquery_storage_v1beta2.types import storage -from google.cloud.bigquery_storage_v1beta2.types import stream -from google.cloud.bigquery_storage_v1beta2.types import table from google.oauth2 import service_account from google.protobuf import descriptor_pb2 # type: ignore from google.protobuf import timestamp_pb2 # type: ignore from google.protobuf import wrappers_pb2 # type: ignore from google.rpc import status_pb2 # type: ignore -import google.auth +import grpc +from grpc.experimental import aio +from proto.marshal.rules import wrappers +from proto.marshal.rules.dates import DurationRule, TimestampRule +import pytest + +from google.cloud.bigquery_storage_v1beta2.services.big_query_write import ( + BigQueryWriteAsyncClient, + BigQueryWriteClient, + transports, +) +from google.cloud.bigquery_storage_v1beta2.types import protobuf, storage, stream, table def client_cert_source_callback(): diff --git a/tests/unit/helpers.py b/tests/unit/helpers.py index c7cf6cc4..cd387042 100644 --- a/tests/unit/helpers.py +++ b/tests/unit/helpers.py @@ -19,7 +19,6 @@ import pytz - SCALAR_COLUMNS = [ {"name": "int_col", "type": "int64"}, {"name": "float_col", "type": "float64"}, diff --git a/tests/unit/test_client_v1.py b/tests/unit/test_client_v1.py index 8ee701c5..ab56019a 100644 --- a/tests/unit/test_client_v1.py +++ b/tests/unit/test_client_v1.py @@ -19,7 +19,6 @@ from google.cloud.bigquery_storage import types - PROJECT = "my-project" SERVICE_ACCOUNT_PROJECT = "project-from-credentials" diff --git a/tests/unit/test_reader_v1.py b/tests/unit/test_reader_v1.py index f4c10321..e2e8870d 100644 --- a/tests/unit/test_reader_v1.py +++ b/tests/unit/test_reader_v1.py @@ -14,21 +14,21 @@ # See the License for the specific language governing permissions and # limitations under the License. -import itertools import io +import itertools import json from unittest import mock import fastavro +import google.api_core.exceptions +import google.rpc.error_details_pb2 import pandas import pandas.testing import pytest -import google.api_core.exceptions from google.cloud.bigquery_storage import types -from .helpers import SCALAR_COLUMNS, SCALAR_COLUMN_NAMES, SCALAR_BLOCKS -import google.rpc.error_details_pb2 +from .helpers import SCALAR_BLOCKS, SCALAR_COLUMN_NAMES, SCALAR_COLUMNS PROJECT = "my-project" BQ_TO_AVRO_TYPES = { diff --git a/tests/unit/test_reader_v1_arrow.py b/tests/unit/test_reader_v1_arrow.py index e0d1142c..a79502d2 100644 --- a/tests/unit/test_reader_v1_arrow.py +++ b/tests/unit/test_reader_v1_arrow.py @@ -27,9 +27,10 @@ import importlib_metadata as metadata import google.api_core.exceptions + from google.cloud.bigquery_storage import types -from .helpers import SCALAR_COLUMNS, SCALAR_COLUMN_NAMES, SCALAR_BLOCKS +from .helpers import SCALAR_BLOCKS, SCALAR_COLUMN_NAMES, SCALAR_COLUMNS pyarrow = pytest.importorskip("pyarrow") diff --git a/tests/unit/test_writer_v1.py b/tests/unit/test_writer_v1.py index 9ecb1858..fc544a00 100644 --- a/tests/unit/test_writer_v1.py +++ b/tests/unit/test_writer_v1.py @@ -15,14 +15,13 @@ import time from unittest import mock -import pytest - from google.api_core import exceptions -from google.cloud.bigquery_storage_v1.services import big_query_write -from google.cloud.bigquery_storage_v1 import types as gapic_types -from google.cloud.bigquery_storage_v1 import exceptions as bqstorage_exceptions from google.protobuf import descriptor_pb2 +import pytest +from google.cloud.bigquery_storage_v1 import exceptions as bqstorage_exceptions +from google.cloud.bigquery_storage_v1 import types as gapic_types +from google.cloud.bigquery_storage_v1.services import big_query_write REQUEST_TEMPLATE = gapic_types.AppendRowsRequest() diff --git a/tests/unit/test_writer_v1beta2.py b/tests/unit/test_writer_v1beta2.py index 15fc8c8a..008666c5 100644 --- a/tests/unit/test_writer_v1beta2.py +++ b/tests/unit/test_writer_v1beta2.py @@ -15,14 +15,13 @@ import time from unittest import mock -import pytest - from google.api_core import exceptions -from google.cloud.bigquery_storage_v1beta2.services import big_query_write -from google.cloud.bigquery_storage_v1beta2 import types as gapic_types -from google.cloud.bigquery_storage_v1beta2 import exceptions as bqstorage_exceptions from google.protobuf import descriptor_pb2 +import pytest +from google.cloud.bigquery_storage_v1beta2 import exceptions as bqstorage_exceptions +from google.cloud.bigquery_storage_v1beta2 import types as gapic_types +from google.cloud.bigquery_storage_v1beta2.services import big_query_write REQUEST_TEMPLATE = gapic_types.AppendRowsRequest()