Skip to content

Commit 15b579f

Browse files
tseavercrwilcox
andauthored
fix: use correct type hint for '*path' args (#300)
PEP 484 specifies that they be hinted as the type of a single element, as seen from the caller's perspective. Closes #289. Co-authored-by: Christopher Wilcox <[email protected]>
1 parent ca7cc5b commit 15b579f

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

google/cloud/firestore_v1/async_client.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
from google.cloud.firestore_v1.services.firestore.transports import (
5050
grpc_asyncio as firestore_grpc_transport,
5151
)
52-
from typing import Any, AsyncGenerator, Iterable, Tuple
52+
from typing import Any, AsyncGenerator, Iterable
5353

5454

5555
class AsyncClient(BaseClient):
@@ -119,7 +119,7 @@ def _target(self):
119119
"""
120120
return self._target_helper(firestore_client.FirestoreAsyncClient)
121121

122-
def collection(self, *collection_path: Tuple[str]) -> AsyncCollectionReference:
122+
def collection(self, *collection_path: str) -> AsyncCollectionReference:
123123
"""Get a reference to a collection.
124124
125125
For a top-level collection:
@@ -139,7 +139,7 @@ def collection(self, *collection_path: Tuple[str]) -> AsyncCollectionReference:
139139
Sub-collections can be nested deeper in a similar fashion.
140140
141141
Args:
142-
collection_path (Tuple[str, ...]): Can either be
142+
collection_path: Can either be
143143
144144
* A single ``/``-delimited path to a collection
145145
* A tuple of collection path segments
@@ -172,7 +172,7 @@ def collection_group(self, collection_id: str) -> AsyncCollectionGroup:
172172
"""
173173
return AsyncCollectionGroup(self._get_collection_reference(collection_id))
174174

175-
def document(self, *document_path: Tuple[str]) -> AsyncDocumentReference:
175+
def document(self, *document_path: str) -> AsyncDocumentReference:
176176
"""Get a reference to a document in a collection.
177177
178178
For a top-level document:
@@ -194,7 +194,7 @@ def document(self, *document_path: Tuple[str]) -> AsyncDocumentReference:
194194
Documents in sub-collections can be nested deeper in a similar fashion.
195195
196196
Args:
197-
document_path (Tuple[str, ...]): Can either be
197+
document_path: Can either be
198198
199199
* A single ``/``-delimited path to a document
200200
* A tuple of document path segments

google/cloud/firestore_v1/base_client.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ def _document_path_helper(self, *document_path) -> List[str]:
314314
return joined_path.split(_helpers.DOCUMENT_PATH_DELIMITER)
315315

316316
@staticmethod
317-
def field_path(*field_names: Tuple[str]) -> str:
317+
def field_path(*field_names: str) -> str:
318318
"""Create a **field path** from a list of nested field names.
319319
320320
A **field path** is a ``.``-delimited concatenation of the field
@@ -335,7 +335,7 @@ def field_path(*field_names: Tuple[str]) -> str:
335335
``data['aa']['bb']['cc']``.
336336
337337
Args:
338-
field_names (Tuple[str, ...]): The list of field names.
338+
field_names: The list of field names.
339339
340340
Returns:
341341
str: The ``.``-delimited field path.

google/cloud/firestore_v1/client.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
from google.cloud.firestore_v1.services.firestore.transports import (
4545
grpc as firestore_grpc_transport,
4646
)
47-
from typing import Any, Generator, Iterable, Tuple
47+
from typing import Any, Generator, Iterable
4848

4949
# Types needed only for Type Hints
5050
from google.cloud.firestore_v1.base_document import DocumentSnapshot
@@ -117,7 +117,7 @@ def _target(self):
117117
"""
118118
return self._target_helper(firestore_client.FirestoreClient)
119119

120-
def collection(self, *collection_path: Tuple[str]) -> CollectionReference:
120+
def collection(self, *collection_path: str) -> CollectionReference:
121121
"""Get a reference to a collection.
122122
123123
For a top-level collection:
@@ -137,7 +137,7 @@ def collection(self, *collection_path: Tuple[str]) -> CollectionReference:
137137
Sub-collections can be nested deeper in a similar fashion.
138138
139139
Args:
140-
collection_path (Tuple[str, ...]): Can either be
140+
collection_path: Can either be
141141
142142
* A single ``/``-delimited path to a collection
143143
* A tuple of collection path segments
@@ -170,7 +170,7 @@ def collection_group(self, collection_id: str) -> CollectionGroup:
170170
"""
171171
return CollectionGroup(self._get_collection_reference(collection_id))
172172

173-
def document(self, *document_path: Tuple[str]) -> DocumentReference:
173+
def document(self, *document_path: str) -> DocumentReference:
174174
"""Get a reference to a document in a collection.
175175
176176
For a top-level document:
@@ -192,7 +192,7 @@ def document(self, *document_path: Tuple[str]) -> DocumentReference:
192192
Documents in sub-collections can be nested deeper in a similar fashion.
193193
194194
Args:
195-
document_path (Tuple[str, ...]): Can either be
195+
document_path): Can either be
196196
197197
* A single ``/``-delimited path to a document
198198
* A tuple of document path segments

0 commit comments

Comments
 (0)