2525"""
2626from __future__ import annotations
2727
28- from typing import TYPE_CHECKING , Any , AsyncGenerator , Iterable , List , Optional , Union
28+ from typing import (
29+ TYPE_CHECKING ,
30+ Any ,
31+ AsyncGenerator ,
32+ Iterable ,
33+ List ,
34+ Optional ,
35+ Union ,
36+ )
2937
3038from google .api_core import gapic_v1
3139from google .api_core import retry_async as retries
4048from google .cloud .firestore_v1 .async_transaction import AsyncTransaction
4149from google .cloud .firestore_v1 .base_client import _parse_batch_get # type: ignore
4250from google .cloud .firestore_v1 .base_client import _CLIENT_INFO , BaseClient , _path_helper
51+ from google .cloud .firestore_v1 .base_transaction import MAX_ATTEMPTS
4352from google .cloud .firestore_v1 .field_path import FieldPath
4453from google .cloud .firestore_v1 .services .firestore import (
4554 async_client as firestore_client ,
@@ -410,7 +419,9 @@ def batch(self) -> AsyncWriteBatch:
410419 """
411420 return AsyncWriteBatch (self )
412421
413- def transaction (self , ** kwargs ) -> AsyncTransaction :
422+ def transaction (
423+ self , max_attempts : int = MAX_ATTEMPTS , read_only : bool = False
424+ ) -> AsyncTransaction :
414425 """Get a transaction that uses this client.
415426
416427 See :class:`~google.cloud.firestore_v1.async_transaction.AsyncTransaction` for
@@ -426,4 +437,4 @@ def transaction(self, **kwargs) -> AsyncTransaction:
426437 :class:`~google.cloud.firestore_v1.async_transaction.AsyncTransaction`:
427438 A transaction attached to this client.
428439 """
429- return AsyncTransaction (self , ** kwargs )
440+ return AsyncTransaction (self , max_attempts = max_attempts , read_only = read_only )
0 commit comments