Ë
    V¼SfD  ã                   ó¢  — U d Z ddlmZ ddlmZ ddlmZmZm	Z	m
Z
mZ eed<   eed<   eed<   eed<   eed	<   eed
<   eed<   eed<   eed<   eed<   dZ	 dZeed<   dZeed<   ej%                  d«      Zeed<   ej%                  d«      Zeed<   dZeed<   dZeed
<   	 dZeed<   	 dZeed<   	 dZeed	<   dZeed<    G d„ de«      Z G d„ de«      Zy)zEHelpers for applying Google Cloud Firestore changes in a transaction.é    )Úretry)Útypes)ÚAnyÚ	CoroutineÚNoReturnÚOptionalÚUnionÚ_CANT_BEGINÚ_CANT_COMMITÚ_CANT_RETRY_READ_ONLYÚ_CANT_ROLLBACKÚ_EXCEED_ATTEMPTS_TEMPLATEÚ_INITIAL_SLEEPÚ
_MAX_SLEEPÚ_MISSING_ID_TEMPLATEÚ_MULTIPLIERÚ_WRITE_READ_ONLYé   z@The transaction has already begun. Current transaction ID: {!r}.z:The transaction has no transaction ID, so it cannot be {}.zrolled backÚ	committedz8Cannot perform write operation in read-only transaction.g      ð?g      >@g       @z.Failed to commit transaction in {:d} attempts.z,Only read-write transactions can be retried.c            	       ó6  — e Zd ZdZedfdd„Zdefd„Zdee	df   de
ej                  j                     fd„Zed	„ «       Zed
„ «       Zdd„Zddefd„Zdefd„Zdeeeeeef   f   fd„Z	 	 ddedej4                  dedefd„Z	 	 ddej4                  dedefd„Zy)ÚBaseTransactionaÊ  Accumulate read-and-write operations to be sent in a transaction.

    Args:
        max_attempts (Optional[int]): The maximum number of attempts for
            the transaction (i.e. allowing retries). Defaults to
            :attr:`~google.cloud.firestore_v1.transaction.MAX_ATTEMPTS`.
        read_only (Optional[bool]): Flag indicating if the transaction
            should be read-only or should allow writes. Defaults to
            :data:`False`.
    FÚreturnNc                 ó.   — || _         || _        d | _        y ©N)Ú_max_attemptsÚ
_read_onlyÚ_id)ÚselfÚmax_attemptsÚ	read_onlys      úiC:\Users\user\Documents\project_loop\venv\Lib\site-packages\google/cloud/firestore_v1/base_transaction.pyÚ__init__zBaseTransaction.__init__?   s   € Ø)ˆÔØ#ˆŒØˆ�ó    c                 ó   — t         ‚r   ©ÚNotImplementedError)r   Ú	write_pbss     r!   Ú_add_write_pbszBaseTransaction._add_write_pbsD   ó   € Ü!Ð!r#   Úretry_idc                 ó"  — |�O| j                   rt        t        «      ‚t        j                  t        j                  j                  |¬«      ¬«      S | j                   r2t        j                  t        j                  j                  «       ¬«      S y)a÷  Convert the current object to protobuf.

        The ``retry_id`` value is used when retrying a transaction that
        failed (e.g. due to contention). It is intended to be the "first"
        transaction that failed (i.e. if multiple retries are needed).

        Args:
            retry_id (Union[bytes, NoneType]): Transaction ID of a transaction
                to be retried.

        Returns:
            Optional[google.cloud.firestore_v1.types.TransactionOptions]:
            The protobuf ``TransactionOptions`` if ``read_only==True`` or if
            there is a transaction ID to be retried, else :data:`None`.

        Raises:
            ValueError: If ``retry_id`` is not :data:`None` but the
                transaction is read-only.
        N)Úretry_transaction)Ú
read_write)r    )r   Ú
ValueErrorr   r   ÚTransactionOptionsÚ	ReadWriteÚReadOnly©r   r*   s     r!   Ú_options_protobufz!BaseTransaction._options_protobufG   s   € ð, ÐØ�ŠÜ Ô!6Ó7Ð7ä×+Ñ+Ü ×3Ñ3×=Ñ=Ø&.ð >ó ôð ð
 �_Š_Ü×+Ñ+Ü×2Ñ2×;Ñ;Ó=ôð ð r#   c                 ó   — | j                   duS )z‡Determine if this transaction has already begun.

        Returns:
            bool: Indicates if the transaction has started.
        N©r   ©r   s    r!   Úin_progresszBaseTransaction.in_progressm   s   € ð �x‰x˜tÐ#Ð#r#   c                 ó   — | j                   S )z·Get the current transaction ID.

        Returns:
            Optional[bytes]: The transaction ID (or :data:`None` if the
            current transaction is not in progress).
        r5   r6   s    r!   ÚidzBaseTransaction.idv   s   € ð �x‰xˆr#   c                 ó    — g | _         d| _        y)zšClean up the instance after :meth:`_rollback`` or :meth:`_commit``.

        This intended to occur on success or failure of the associated RPCs.
        N)Ú
_write_pbsr   r6   s    r!   Ú	_clean_upzBaseTransaction._clean_up€   s   € ð
 ˆŒØˆ�r#   c                 ó   — t         ‚r   r%   r2   s     r!   Ú_beginzBaseTransaction._beginˆ   r)   r#   c                 ó   — t         ‚r   r%   r6   s    r!   Ú	_rollbackzBaseTransaction._rollback‹   r)   r#   c                 ó   — t         ‚r   r%   r6   s    r!   Ú_commitzBaseTransaction._commitŽ   r)   r#   Ú
referencesr   Útimeoutc                 ó   — t         ‚r   r%   )r   rC   r   rD   s       r!   Úget_allzBaseTransaction.get_all‘   ó
   € ô "Ð!r#   c                 ó   — t         ‚r   r%   )r   Úref_or_queryr   rD   s       r!   ÚgetzBaseTransaction.get™   rG   r#   ©r   Nr   )NN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__ÚMAX_ATTEMPTSr"   r   r(   r	   Úbytesr   r   Úcommonr/   r3   Úpropertyr7   r9   r<   r>   r@   Úlistr   r   rB   ÚretriesÚRetryÚfloatrF   rJ   © r#   r!   r   r   3   s  „ ñ	ð %1¸Eô ð
"¨8ó "ð$Ø˜e T˜kÑ*ð$à	�%—,‘,×1Ñ1Ñ	2ó$ðL ñ$ó ð$ð ñó ðóñ" xó "ð"˜8ó "ð"˜˜t Y¨s°C¸¨~Ñ%>Ð>Ñ?ó "ð  $Øñ	"àð"ð �}‰}ð"ð ð	"ð
 
ó"ð  $Øñ	"ð �}‰}ð"ð ð	"ð
 
ô"r#   r   c                   ó2   — e Zd ZdZdd„Zdd„Zdefd„Zd„ Zy)	Ú_BaseTransactionalaY  Provide a callable object to use as a transactional decorater.

    This is surfaced via
    :func:`~google.cloud.firestore_v1.transaction.transactional`.

    Args:
        to_wrap (Callable[[:class:`~google.cloud.firestore_v1.transaction.Transaction`, ...], Any]):
            A callable that should be run (and retried) in a transaction.
    r   Nc                 ó0   — || _         d | _        	 d | _        y r   )Úto_wrapÚ
current_idr*   )r   r\   s     r!   r"   z_BaseTransactional.__init__­   s   € ØˆŒØˆŒØ:ØˆŒØIr#   c                 ó    — d| _         d| _        y)zUnset the transaction IDs.N)r]   r*   r6   s    r!   Ú_resetz_BaseTransactional._reset´   s   € àˆŒØˆ�r#   c                 ó   — t         ‚r   r%   ©r   ÚtransactionÚargsÚkwargss       r!   Ú_pre_commitz_BaseTransactional._pre_commit¹   r)   r#   c                 ó   — t         ‚r   r%   ra   s       r!   Ú__call__z_BaseTransactional.__call__¼   r)   r#   rK   )	rL   rM   rN   rO   r"   r_   r   re   rg   rX   r#   r!   rZ   rZ   ¢   s#   „ ñóJóð
"¸8ó "ó"r#   rZ   N)rO   Úgoogle.api_corer   rU   Úgoogle.cloud.firestore_v1r   Útypingr   r   r   r   r	   ÚstrÚ__annotations__rW   rP   r
   r   Úformatr   r   r   r   r   r   r   r   Úobjectr   rZ   rX   r#   r!   ú<module>ro      sÿ   ðò Lå ,å +ß <Õ <àÓ ØÓ ØÓ ØÓ ØÓ ØÓ ØÓ ØÓ ØÓ ØÓ ð €Ø AØU€ˆSÓ UØXÐ �cÓ XØ*×1Ñ1°-Ó@€�Ó @Ø(×/Ñ/°Ó<€ˆcÓ <ØRÐ �#Ó RØ€�Ó Ø LØ€
ˆEÓ Ø EØ€ˆUÓ Ø NØ!QÐ ˜3Ó QØKÐ �sÓ Kôl"�fô l"ô^"˜õ "r#   