Skip to content

Commit 719bf49

Browse files
authored
chore: sort imports (#936)
1 parent 2de1620 commit 719bf49

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+666
-761
lines changed

google/cloud/firestore_v1/__init__.py

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -23,42 +23,45 @@
2323

2424
__version__ = package_version.__version__
2525

26+
from typing import List
27+
2628
from google.cloud.firestore_v1 import types
27-
from google.cloud.firestore_v1._helpers import GeoPoint
28-
from google.cloud.firestore_v1._helpers import ExistsOption
29-
from google.cloud.firestore_v1._helpers import LastUpdateOption
30-
from google.cloud.firestore_v1._helpers import ReadAfterWriteError
31-
from google.cloud.firestore_v1._helpers import WriteOption
32-
from google.cloud.firestore_v1.base_aggregation import CountAggregation
33-
from google.cloud.firestore_v1.base_query import And
34-
from google.cloud.firestore_v1.base_query import FieldFilter
35-
from google.cloud.firestore_v1.base_query import Or
29+
from google.cloud.firestore_v1._helpers import (
30+
ExistsOption,
31+
GeoPoint,
32+
LastUpdateOption,
33+
ReadAfterWriteError,
34+
WriteOption,
35+
)
3636
from google.cloud.firestore_v1.async_batch import AsyncWriteBatch
3737
from google.cloud.firestore_v1.async_client import AsyncClient
3838
from google.cloud.firestore_v1.async_collection import AsyncCollectionReference
3939
from google.cloud.firestore_v1.async_document import AsyncDocumentReference
4040
from google.cloud.firestore_v1.async_query import AsyncQuery
41-
from google.cloud.firestore_v1.async_transaction import async_transactional
42-
from google.cloud.firestore_v1.async_transaction import AsyncTransaction
41+
from google.cloud.firestore_v1.async_transaction import (
42+
AsyncTransaction,
43+
async_transactional,
44+
)
45+
from google.cloud.firestore_v1.base_aggregation import CountAggregation
4346
from google.cloud.firestore_v1.base_document import DocumentSnapshot
47+
from google.cloud.firestore_v1.base_query import And, FieldFilter, Or
4448
from google.cloud.firestore_v1.batch import WriteBatch
4549
from google.cloud.firestore_v1.client import Client
4650
from google.cloud.firestore_v1.collection import CollectionReference
4751
from google.cloud.firestore_v1.document import DocumentReference
48-
from google.cloud.firestore_v1.query import CollectionGroup
49-
from google.cloud.firestore_v1.query import Query
50-
from google.cloud.firestore_v1.transaction import Transaction
51-
from google.cloud.firestore_v1.transaction import transactional
52-
from google.cloud.firestore_v1.transforms import ArrayRemove
53-
from google.cloud.firestore_v1.transforms import ArrayUnion
54-
from google.cloud.firestore_v1.transforms import DELETE_FIELD
55-
from google.cloud.firestore_v1.transforms import Increment
56-
from google.cloud.firestore_v1.transforms import Maximum
57-
from google.cloud.firestore_v1.transforms import Minimum
58-
from google.cloud.firestore_v1.transforms import SERVER_TIMESTAMP
52+
from google.cloud.firestore_v1.query import CollectionGroup, Query
53+
from google.cloud.firestore_v1.transaction import Transaction, transactional
54+
from google.cloud.firestore_v1.transforms import (
55+
DELETE_FIELD,
56+
SERVER_TIMESTAMP,
57+
ArrayRemove,
58+
ArrayUnion,
59+
Increment,
60+
Maximum,
61+
Minimum,
62+
)
5963
from google.cloud.firestore_v1.watch import Watch
6064

61-
6265
# TODO(https://github.com/googleapis/python-firestore/issues/93): this is all on the generated surface. We require this to match
6366
# firestore.py. So comment out until needed on customer level for certain.
6467
# from .services.firestore import FirestoreClient
@@ -102,8 +105,6 @@
102105
# from .types.write import DocumentDelete
103106
# from .types.write import DocumentRemove
104107
from .types.write import DocumentTransform
105-
from typing import List
106-
107108

108109
# from .types.write import ExistenceFilter
109110
# from .types.write import Write

google/cloud/firestore_v1/_helpers.py

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -16,26 +16,6 @@
1616

1717
import datetime
1818
import json
19-
20-
import google
21-
from google.api_core.datetime_helpers import DatetimeWithNanoseconds
22-
from google.api_core import gapic_v1
23-
from google.protobuf import struct_pb2
24-
from google.type import latlng_pb2 # type: ignore
25-
import grpc # type: ignore
26-
27-
from google.cloud import exceptions # type: ignore
28-
from google.cloud._helpers import _datetime_to_pb_timestamp # type: ignore
29-
from google.cloud.firestore_v1.vector import Vector
30-
from google.cloud.firestore_v1.types.write import DocumentTransform
31-
from google.cloud.firestore_v1 import transforms
32-
from google.cloud.firestore_v1 import types
33-
from google.cloud.firestore_v1.field_path import FieldPath
34-
from google.cloud.firestore_v1.field_path import parse_field_path
35-
from google.cloud.firestore_v1.types import common
36-
from google.cloud.firestore_v1.types import document
37-
from google.cloud.firestore_v1.types import write
38-
from google.protobuf.timestamp_pb2 import Timestamp # type: ignore
3919
from typing import (
4020
Any,
4121
Dict,
@@ -48,6 +28,22 @@
4828
Union,
4929
)
5030

31+
import grpc # type: ignore
32+
from google.api_core import gapic_v1
33+
from google.api_core.datetime_helpers import DatetimeWithNanoseconds
34+
from google.cloud._helpers import _datetime_to_pb_timestamp # type: ignore
35+
from google.protobuf import struct_pb2
36+
from google.protobuf.timestamp_pb2 import Timestamp # type: ignore
37+
from google.type import latlng_pb2 # type: ignore
38+
39+
import google
40+
from google.cloud import exceptions # type: ignore
41+
from google.cloud.firestore_v1 import transforms, types
42+
from google.cloud.firestore_v1.field_path import FieldPath, parse_field_path
43+
from google.cloud.firestore_v1.types import common, document, write
44+
from google.cloud.firestore_v1.types.write import DocumentTransform
45+
from google.cloud.firestore_v1.vector import Vector
46+
5147
_EmptyDict: transforms.Sentinel
5248
_GRPC_ERROR_MAPPING: dict
5349

google/cloud/firestore_v1/aggregation.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@
2020
"""
2121
from __future__ import annotations
2222

23-
from google.api_core import exceptions
24-
from google.api_core import gapic_v1
25-
from google.api_core import retry as retries
23+
from typing import TYPE_CHECKING, Any, Generator, List, Optional, Union
2624

25+
from google.api_core import exceptions, gapic_v1
26+
from google.api_core import retry as retries
2727

2828
from google.cloud.firestore_v1.base_aggregation import (
2929
AggregationResult,
@@ -33,8 +33,6 @@
3333
from google.cloud.firestore_v1.base_document import DocumentSnapshot
3434
from google.cloud.firestore_v1.stream_generator import StreamGenerator
3535

36-
from typing import Any, Generator, List, Optional, TYPE_CHECKING, Union
37-
3836
# Types needed only for Type Hints
3937
if TYPE_CHECKING:
4038
from google.cloud.firestore_v1 import transaction # pragma: NO COVER

google/cloud/firestore_v1/async_aggregation.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,18 @@
2020
"""
2121
from __future__ import annotations
2222

23+
from typing import TYPE_CHECKING, AsyncGenerator, List, Optional, Union
24+
2325
from google.api_core import gapic_v1
2426
from google.api_core import retry_async as retries
2527

26-
from typing import AsyncGenerator, List, Optional, Union, TYPE_CHECKING
27-
28+
from google.cloud.firestore_v1 import transaction
2829
from google.cloud.firestore_v1.async_stream_generator import AsyncStreamGenerator
2930
from google.cloud.firestore_v1.base_aggregation import (
3031
AggregationResult,
31-
_query_response_to_result,
3232
BaseAggregationQuery,
33+
_query_response_to_result,
3334
)
34-
from google.cloud.firestore_v1 import transaction
3535

3636
if TYPE_CHECKING: # pragma: NO COVER
3737
from google.cloud.firestore_v1.base_document import DocumentSnapshot

google/cloud/firestore_v1/async_client.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,32 +24,28 @@
2424
:class:`~google.cloud.firestore_v1.async_document.AsyncDocumentReference`
2525
"""
2626

27+
from typing import TYPE_CHECKING, Any, AsyncGenerator, Iterable, List, Optional, Union
28+
2729
from google.api_core import gapic_v1
2830
from google.api_core import retry_async as retries
2931

30-
from google.cloud.firestore_v1.base_client import (
31-
BaseClient,
32-
_CLIENT_INFO,
33-
_parse_batch_get, # type: ignore
34-
_path_helper,
35-
)
36-
37-
from google.cloud.firestore_v1.async_query import AsyncCollectionGroup
3832
from google.cloud.firestore_v1.async_batch import AsyncWriteBatch
3933
from google.cloud.firestore_v1.async_collection import AsyncCollectionReference
4034
from google.cloud.firestore_v1.async_document import (
4135
AsyncDocumentReference,
4236
DocumentSnapshot,
4337
)
38+
from google.cloud.firestore_v1.async_query import AsyncCollectionGroup
4439
from google.cloud.firestore_v1.async_transaction import AsyncTransaction
40+
from google.cloud.firestore_v1.base_client import _parse_batch_get # type: ignore
41+
from google.cloud.firestore_v1.base_client import _CLIENT_INFO, BaseClient, _path_helper
4542
from google.cloud.firestore_v1.field_path import FieldPath
4643
from google.cloud.firestore_v1.services.firestore import (
4744
async_client as firestore_client,
4845
)
4946
from google.cloud.firestore_v1.services.firestore.transports import (
5047
grpc_asyncio as firestore_grpc_transport,
5148
)
52-
from typing import Any, AsyncGenerator, Iterable, List, Optional, Union, TYPE_CHECKING
5349

5450
if TYPE_CHECKING:
5551
from google.cloud.firestore_v1.bulk_writer import BulkWriter # pragma: NO COVER

google/cloud/firestore_v1/async_collection.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,23 @@
1414

1515
"""Classes for representing collections for the Google Cloud Firestore API."""
1616

17+
from typing import TYPE_CHECKING, Any, AsyncGenerator, Optional, Tuple
18+
1719
from google.api_core import gapic_v1
1820
from google.api_core import retry_async as retries
1921

20-
from google.cloud.firestore_v1.base_collection import (
21-
BaseCollectionReference,
22-
_item_to_document_ref,
23-
)
2422
from google.cloud.firestore_v1 import (
2523
async_aggregation,
2624
async_document,
2725
async_query,
2826
transaction,
2927
)
30-
28+
from google.cloud.firestore_v1.base_collection import (
29+
BaseCollectionReference,
30+
_item_to_document_ref,
31+
)
3132
from google.cloud.firestore_v1.document import DocumentReference
3233

33-
from typing import Any, AsyncGenerator, Optional, Tuple, TYPE_CHECKING
34-
3534
if TYPE_CHECKING: # pragma: NO COVER
3635
from google.cloud.firestore_v1.async_stream_generator import AsyncStreamGenerator
3736
from google.cloud.firestore_v1.base_document import DocumentSnapshot

google/cloud/firestore_v1/async_document.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,20 @@
1515
"""Classes for representing documents for the Google Cloud Firestore API."""
1616
import datetime
1717
import logging
18+
from typing import AsyncGenerator, Iterable
1819

1920
from google.api_core import gapic_v1
2021
from google.api_core import retry_async as retries
2122
from google.cloud._helpers import _datetime_to_pb_timestamp # type: ignore
23+
from google.protobuf.timestamp_pb2 import Timestamp
2224

25+
from google.cloud.firestore_v1 import _helpers
2326
from google.cloud.firestore_v1.base_document import (
2427
BaseDocumentReference,
2528
DocumentSnapshot,
2629
_first_write_result,
2730
)
28-
from google.cloud.firestore_v1 import _helpers
2931
from google.cloud.firestore_v1.types import write
30-
from google.protobuf.timestamp_pb2 import Timestamp
31-
from typing import AsyncGenerator, Iterable
32-
3332

3433
logger = logging.getLogger(__name__)
3534

google/cloud/firestore_v1/async_query.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,26 +20,25 @@
2020
"""
2121
from __future__ import annotations
2222

23+
from typing import TYPE_CHECKING, AsyncGenerator, List, Optional, Type
24+
2325
from google.api_core import gapic_v1
2426
from google.api_core import retry_async as retries
2527

2628
from google.cloud import firestore_v1
29+
from google.cloud.firestore_v1 import async_document, transaction
30+
from google.cloud.firestore_v1.async_aggregation import AsyncAggregationQuery
31+
from google.cloud.firestore_v1.async_stream_generator import AsyncStreamGenerator
32+
from google.cloud.firestore_v1.async_vector_query import AsyncVectorQuery
2733
from google.cloud.firestore_v1.base_query import (
2834
BaseCollectionGroup,
2935
BaseQuery,
3036
QueryPartition,
31-
_query_response_to_snapshot,
3237
_collection_group_query_response_to_snapshot,
3338
_enum_from_direction,
39+
_query_response_to_snapshot,
3440
)
3541

36-
from google.cloud.firestore_v1 import async_document
37-
from google.cloud.firestore_v1.async_aggregation import AsyncAggregationQuery
38-
from google.cloud.firestore_v1.async_vector_query import AsyncVectorQuery
39-
from google.cloud.firestore_v1.async_stream_generator import AsyncStreamGenerator
40-
from google.cloud.firestore_v1 import transaction
41-
from typing import AsyncGenerator, List, Optional, Type, TYPE_CHECKING
42-
4342
if TYPE_CHECKING: # pragma: NO COVER
4443
# Types needed only for Type Hints
4544
from google.cloud.firestore_v1.base_document import DocumentSnapshot

google/cloud/firestore_v1/async_transaction.py

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,34 +17,31 @@
1717

1818
import asyncio
1919
import random
20+
from typing import Any, AsyncGenerator, Callable, Coroutine
2021

21-
from google.api_core import gapic_v1
22+
from google.api_core import exceptions, gapic_v1
2223
from google.api_core import retry_async as retries
2324

25+
from google.cloud.firestore_v1 import _helpers, async_batch, types
26+
from google.cloud.firestore_v1.async_document import (
27+
AsyncDocumentReference,
28+
DocumentSnapshot,
29+
)
30+
from google.cloud.firestore_v1.async_query import AsyncQuery
2431
from google.cloud.firestore_v1.base_transaction import (
25-
_BaseTransactional,
26-
BaseTransaction,
27-
MAX_ATTEMPTS,
2832
_CANT_BEGIN,
29-
_CANT_ROLLBACK,
3033
_CANT_COMMIT,
31-
_WRITE_READ_ONLY,
34+
_CANT_ROLLBACK,
35+
_EXCEED_ATTEMPTS_TEMPLATE,
3236
_INITIAL_SLEEP,
3337
_MAX_SLEEP,
3438
_MULTIPLIER,
35-
_EXCEED_ATTEMPTS_TEMPLATE,
39+
_WRITE_READ_ONLY,
40+
MAX_ATTEMPTS,
41+
BaseTransaction,
42+
_BaseTransactional,
3643
)
3744

38-
from google.api_core import exceptions
39-
from google.cloud.firestore_v1 import async_batch
40-
from google.cloud.firestore_v1 import _helpers
41-
from google.cloud.firestore_v1 import types
42-
43-
from google.cloud.firestore_v1.async_document import AsyncDocumentReference
44-
from google.cloud.firestore_v1.async_document import DocumentSnapshot
45-
from google.cloud.firestore_v1.async_query import AsyncQuery
46-
from typing import Any, AsyncGenerator, Callable, Coroutine
47-
4845
# Types needed only for Type Hints
4946
from google.cloud.firestore_v1.client import Client
5047

google/cloud/firestore_v1/async_vector_query.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,19 @@
1414

1515
from __future__ import annotations
1616

17+
from typing import AsyncGenerator, List, Optional, TypeVar, Union
18+
1719
from google.api_core import gapic_v1
1820
from google.api_core import retry_async as retries
21+
1922
from google.cloud.firestore_v1 import async_document
2023
from google.cloud.firestore_v1.base_document import DocumentSnapshot
2124
from google.cloud.firestore_v1.base_query import (
2225
BaseQuery,
23-
_query_response_to_snapshot,
2426
_collection_group_query_response_to_snapshot,
27+
_query_response_to_snapshot,
2528
)
2629
from google.cloud.firestore_v1.base_vector_query import BaseVectorQuery
27-
from typing import AsyncGenerator, List, Union, Optional, TypeVar
2830

2931
TAsyncVectorQuery = TypeVar("TAsyncVectorQuery", bound="AsyncVectorQuery")
3032

0 commit comments

Comments
 (0)