Skip to content

Commit

Permalink
fix: use correct type hint for '*path' args (pylint-dev#300)
Browse files Browse the repository at this point in the history
PEP 484 specifies that they be hinted as the type of a single element,
as seen from the caller's perspective.

Closes pylint-dev#289.

Co-authored-by: Christopher Wilcox <[email protected]>
  • Loading branch information
tseaver and crwilcox authored Feb 4, 2021
1 parent ca7cc5b commit 15b579f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
10 changes: 5 additions & 5 deletions google/cloud/firestore_v1/async_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
from google.cloud.firestore_v1.services.firestore.transports import (
grpc_asyncio as firestore_grpc_transport,
)
from typing import Any, AsyncGenerator, Iterable, Tuple
from typing import Any, AsyncGenerator, Iterable


class AsyncClient(BaseClient):
Expand Down Expand Up @@ -119,7 +119,7 @@ def _target(self):
"""
return self._target_helper(firestore_client.FirestoreAsyncClient)

def collection(self, *collection_path: Tuple[str]) -> AsyncCollectionReference:
def collection(self, *collection_path: str) -> AsyncCollectionReference:
"""Get a reference to a collection.
For a top-level collection:
Expand All @@ -139,7 +139,7 @@ def collection(self, *collection_path: Tuple[str]) -> AsyncCollectionReference:
Sub-collections can be nested deeper in a similar fashion.
Args:
collection_path (Tuple[str, ...]): Can either be
collection_path: Can either be
* A single ``/``-delimited path to a collection
* A tuple of collection path segments
Expand Down Expand Up @@ -172,7 +172,7 @@ def collection_group(self, collection_id: str) -> AsyncCollectionGroup:
"""
return AsyncCollectionGroup(self._get_collection_reference(collection_id))

def document(self, *document_path: Tuple[str]) -> AsyncDocumentReference:
def document(self, *document_path: str) -> AsyncDocumentReference:
"""Get a reference to a document in a collection.
For a top-level document:
Expand All @@ -194,7 +194,7 @@ def document(self, *document_path: Tuple[str]) -> AsyncDocumentReference:
Documents in sub-collections can be nested deeper in a similar fashion.
Args:
document_path (Tuple[str, ...]): Can either be
document_path: Can either be
* A single ``/``-delimited path to a document
* A tuple of document path segments
Expand Down
4 changes: 2 additions & 2 deletions google/cloud/firestore_v1/base_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ def _document_path_helper(self, *document_path) -> List[str]:
return joined_path.split(_helpers.DOCUMENT_PATH_DELIMITER)

@staticmethod
def field_path(*field_names: Tuple[str]) -> str:
def field_path(*field_names: str) -> str:
"""Create a **field path** from a list of nested field names.
A **field path** is a ``.``-delimited concatenation of the field
Expand All @@ -335,7 +335,7 @@ def field_path(*field_names: Tuple[str]) -> str:
``data['aa']['bb']['cc']``.
Args:
field_names (Tuple[str, ...]): The list of field names.
field_names: The list of field names.
Returns:
str: The ``.``-delimited field path.
Expand Down
10 changes: 5 additions & 5 deletions google/cloud/firestore_v1/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
from google.cloud.firestore_v1.services.firestore.transports import (
grpc as firestore_grpc_transport,
)
from typing import Any, Generator, Iterable, Tuple
from typing import Any, Generator, Iterable

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

def collection(self, *collection_path: Tuple[str]) -> CollectionReference:
def collection(self, *collection_path: str) -> CollectionReference:
"""Get a reference to a collection.
For a top-level collection:
Expand All @@ -137,7 +137,7 @@ def collection(self, *collection_path: Tuple[str]) -> CollectionReference:
Sub-collections can be nested deeper in a similar fashion.
Args:
collection_path (Tuple[str, ...]): Can either be
collection_path: Can either be
* A single ``/``-delimited path to a collection
* A tuple of collection path segments
Expand Down Expand Up @@ -170,7 +170,7 @@ def collection_group(self, collection_id: str) -> CollectionGroup:
"""
return CollectionGroup(self._get_collection_reference(collection_id))

def document(self, *document_path: Tuple[str]) -> DocumentReference:
def document(self, *document_path: str) -> DocumentReference:
"""Get a reference to a document in a collection.
For a top-level document:
Expand All @@ -192,7 +192,7 @@ def document(self, *document_path: Tuple[str]) -> DocumentReference:
Documents in sub-collections can be nested deeper in a similar fashion.
Args:
document_path (Tuple[str, ...]): Can either be
document_path): Can either be
* A single ``/``-delimited path to a document
* A tuple of document path segments
Expand Down

0 comments on commit 15b579f

Please sign in to comment.