From cfdc79d9262bf200418d09d8109b3e15f7894cbb Mon Sep 17 00:00:00 2001 From: Ted Romer Date: Wed, 15 Jan 2025 22:47:48 -0800 Subject: [PATCH] add optional timeout arg on basic DocumentReference operations --- mockfirestore/document.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mockfirestore/document.py b/mockfirestore/document.py index 24aa433..17ebdac 100644 --- a/mockfirestore/document.py +++ b/mockfirestore/document.py @@ -39,7 +39,7 @@ def read_time(self) -> Timestamp: timestamp = Timestamp.from_now() return timestamp - def get(self, field_path: str) -> Any: + def get(self, field_path: str, timeout: float = None) -> Any: if not self.exists: return None else: @@ -63,13 +63,13 @@ def __init__(self, data: Store, path: List[str], def id(self): return self._path[-1] - def get(self) -> DocumentSnapshot: + def get(self, timeout: float=None) -> DocumentSnapshot: return DocumentSnapshot(self, get_by_path(self._data, self._path)) - def delete(self): + def delete(self, timeout: float=None): delete_by_path(self._data, self._path) - def set(self, data: Dict, merge=False): + def set(self, data: Dict, merge=False, timeout: float=None): if merge: try: self.update(deepcopy(data)) @@ -78,7 +78,7 @@ def set(self, data: Dict, merge=False): else: set_by_path(self._data, self._path, deepcopy(data)) - def update(self, data: Dict[str, Any]): + def update(self, data: Dict[str, Any], timeout: float=None): document = get_by_path(self._data, self._path) if document == {}: raise NotFound('No document to update: {}'.format(self._path))