Skip to content

Commit 069f69f

Browse files
author
Cedric Khin
committed
fix: Use Union in type hinting
Use Union to be compatible with 3.7
1 parent 6a922f0 commit 069f69f

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

google/cloud/firestore_v1/collection.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
from google.cloud.firestore_v1 import aggregation
2626
from google.cloud.firestore_v1.watch import Watch
2727
from google.cloud.firestore_v1 import document
28-
from typing import Any, Callable, Generator, Tuple
28+
from typing import Any, Callable, Generator, Tuple, Union
2929

3030
# Types needed only for Type Hints
3131
from google.cloud.firestore_v1.transaction import Transaction
@@ -79,9 +79,9 @@ def _aggregation_query(self) -> aggregation.AggregationQuery:
7979
def add(
8080
self,
8181
document_data: dict,
82-
document_id: str | None = None,
82+
document_id: Union[str, None] = None,
8383
retry: retries.Retry = gapic_v1.method.DEFAULT,
84-
timeout: float | None = None,
84+
timeout: Union[float, None] = None,
8585
) -> Tuple[Any, Any]:
8686
"""Create a document in the Firestore database with the provided data.
8787
@@ -121,9 +121,9 @@ def add(
121121

122122
def list_documents(
123123
self,
124-
page_size: int | None = None,
124+
page_size: Union[int, None] = None,
125125
retry: retries.Retry = gapic_v1.method.DEFAULT,
126-
timeout: float | None = None,
126+
timeout: Union[float, None] = None,
127127
) -> Generator[Any, Any, None]:
128128
"""List all subdocuments of the current collection.
129129
@@ -156,9 +156,9 @@ def _chunkify(self, chunk_size: int):
156156

157157
def get(
158158
self,
159-
transaction: Transaction | None = None,
159+
transaction: Union[Transaction, None] = None,
160160
retry: retries.Retry = gapic_v1.method.DEFAULT,
161-
timeout: float | None = None,
161+
timeout: Union[float, None] = None,
162162
) -> list:
163163
"""Read the documents in this collection.
164164
@@ -187,9 +187,9 @@ def get(
187187

188188
def stream(
189189
self,
190-
transaction: Transaction | None = None,
190+
transaction: Union[Transaction, None] = None,
191191
retry: retries.Retry = gapic_v1.method.DEFAULT,
192-
timeout: float | None = None,
192+
timeout: Union[float, None] = None,
193193
) -> Generator[document.DocumentSnapshot, Any, None]:
194194
"""Read the documents in this collection.
195195

0 commit comments

Comments
 (0)