Skip to content

Commit

Permalink
docstring
Browse files Browse the repository at this point in the history
  • Loading branch information
Linchin committed Jul 22, 2024
1 parent 7338db9 commit ca6adc1
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions google/cloud/firestore_v1/base_document.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
from google.cloud.firestore_v1 import field_path as field_path_module

# Types needed only for Type Hints
from google.cloud.firestore_v1 import query_profile
from google.cloud.firestore_v1.types import Document, common, firestore, write


Expand Down Expand Up @@ -504,7 +505,25 @@ def _to_protobuf(self) -> Optional[Document]:


class DocumentSnapshotList(list):
def __init__(self, docs, explain_metrics=None):
"""A list of DocumentSnapshot.
This is a subclass of the built-in list. A new property `explain_metrics`
is added to return the query profile results.
Args:
reference (:class:`~google.cloud.firestore_v1.document.DocumentReference`):
A document reference corresponding to the document that contains
the data in this snapshot.
docs (list[DocumentSnapshot]):
The list of DocumentSnapshot.
explain_metrics (Optional[query_profile.ExplainMetrics]):
Query profile results.
"""
def __init__(
self,
docs: list,
explain_metrics: Optional[query_profile.ExplainMetrics]=None,
):
super().__init__(docs)
self._explain_metrics = explain_metrics

Expand All @@ -513,7 +532,7 @@ def explain_metrics(self):
return self._explain_metrics

@explain_metrics.setter
def explain_metrics(self, explain_metrics):
def explain_metrics(self, explain_metrics: query_profile.ExplainMetrics):
self._explain_metrics = explain_metrics


Expand Down

0 comments on commit ca6adc1

Please sign in to comment.