
    &g                    `    S r SSKJr  SSKJrJrJr  SSKJr  S	S jr	 " S S5      r
\
" 5       rg)
zTools for working with write concerns.

.. seealso:: This module is compatible with both the synchronous and asynchronous PyMongo APIs.
    )annotations)AnyOptionalUnion)ConfigurationErrorc                V    [        U[        5      (       a  U$ [        U  SU  SU 35      e)z(Validates that 'value' is True or False.z must be True or False, was: =)
isinstancebool	TypeError)optionvalues     ZC:\Suresh\moveshuttle\MDcreated\moveengine\venv\Lib\site-packages\pymongo/write_concern.pyvalidate_booleanr      s1    %
vh;F81UGL
MM    c                      \ rS rSrSrSr    S         SS jjr\SS j5       r\SS j5       r	\SS j5       r
SS	 jrSS
 jrSS jrSrg)WriteConcern"   a  WriteConcern

:param w: (integer or string) Used with replication, write operations
      will block until they have been replicated to the specified number
      or tagged set of servers. `w=<integer>` always includes the replica
      set primary (e.g. w=3 means write to the primary and wait until
      replicated to **two** secondaries). **w=0 disables acknowledgement
      of write operations and can not be used with other write concern
      options.**
:param wtimeout: (integer) **DEPRECATED** Used in conjunction with `w`.
      Specify a value in milliseconds to control how long to wait for write
      propagation to complete. If replication does not complete in the given
      timeframe, a timeout exception is raised.
:param j: If ``True`` block until write operations have been committed
      to the journal. Cannot be used in combination with `fsync`. Write
      operations will fail with an exception if this option is used when
      the server is running without journaling.
:param fsync: If ``True`` and the server is running without journaling,
      blocks until the server has synced all data files to disk. If the
      server is running with journaling, this acts the same as the `j`
      option, blocking until write operations have been committed to the
      journal. Cannot be used in combination with `j`.


.. versionchanged:: 4.7
    Deprecated parameter ``wtimeout``, use :meth:`~pymongo.timeout`.
)
__document__acknowledged__server_defaultNc                   0 U l         SU l        UbK  [        U[        5      (       d  [	        S[        U5       35      eUS:  a  [        S5      eX R                   S'   Ub  [        SU5        X0R                   S'   Ub3  [        SU5        U(       a  U(       a  [        S5      eX@R                   S'   US:X  a  USL a  [        S	5      eUbk  [        U[        5      (       a  US:  a  [        S
5      eUS:  U l        O,[        U[        5      (       d  [	        S[        U5       35      eXR                   S'   U R                   (       + U l
        g )NTz!wtimeout must be an integer, not r   zwtimeout cannot be less than 0wtimeoutjfsyncz+Can't set both j and fsync at the same timezCannot set w to 0 and j to Truezw cannot be less than 0z$w must be an integer or string, not w)_WriteConcern__document_WriteConcern__acknowledgedr
   intr   type
ValueErrorr   r   str_WriteConcern__server_default)selfr   r   r   r   s        r   __init__WriteConcern.__init__A   s.    +-"h,,"CDNCS TUU!| !ABB*2OOJ'=S!$#$OOC We,U()VWW',OOG$6a4i$%FGG=!S!!q5$%>??&'!e#3''"FtAwi PQQ#$OOC $(OO 3r   c                    U R                   $ )z0Does this WriteConcern match the server default.)r#   r$   s    r   is_server_defaultWriteConcern.is_server_defaultj   s     $$$r   c                6    U R                   R                  5       $ )zThe document representation of this write concern.

.. note::
  :class:`WriteConcern` is immutable. Mutating the value of
  :attr:`document` does not mutate this :class:`WriteConcern`.
)r   copyr(   s    r   documentWriteConcern.documento   s     ##%%r   c                    U R                   $ )zMIf ``True`` write operations will wait for acknowledgement before
returning.
)r   r(   s    r   acknowledgedWriteConcern.acknowledgedy   s    
 """r   c                    SR                  SR                  S U R                  R                  5        5       5      5      $ )NzWriteConcern({})z, c              3  @   #    U  H  nS R                   " U6 v   M     g7f)z{}={}N)format).0kvts     r   	<genexpr>(WriteConcern.__repr__.<locals>.<genexpr>   s     N6Msgnnc*6Ms   )r4   joinr   itemsr(   s    r   __repr__WriteConcern.__repr__   s4    !((IINdoo6K6K6MNN
 	
r   c                j    [        U[        5      (       a  U R                  UR                  :H  $ [        $ Nr
   r   r   r-   NotImplementedr$   others     r   __eq__WriteConcern.__eq__   (    e\**??enn44r   c                j    [        U[        5      (       a  U R                  UR                  :g  $ [        $ r>   r?   rA   s     r   __ne__WriteConcern.__ne__   rE   r   )r   r   r   )NNNN)
r   zOptional[Union[int, str]]r   zOptional[int]r   Optional[bool]r   rI   returnNone)rJ   r   )rJ   zdict[str, Any])rJ   r"   )rB   r   rJ   r   )__name__
__module____qualname____firstlineno____doc__	__slots__r%   propertyr)   r-   r0   r;   rC   rG   __static_attributes__ r   r   r   r   "   s    8 EI (,"&  $'4$'4  '4 	'4
 '4 
'4R % % & & # #


r   r   N)r   r"   r   r   rJ   r   )rP   
__future__r   typingr   r   r   pymongo.errorsr   r   r   DEFAULT_WRITE_CONCERNrT   r   r   <module>rY      s5    # ' ' -Nk k\ % r   