o
    'h	                     @  s8   d Z ddlmZ ddlmZmZ G dd dZe ZdS )zTools for working with read concerns.

.. seealso:: This module is compatible with both the synchronous and asynchronous PyMongo APIs.
    )annotations)AnyOptionalc                   @  sZ   e Zd ZdZddddZedd	d
ZedddZedddZdddZ	dddZ
dS )ReadConcerna  ReadConcern

    :param level: (string) The read concern level specifies the level of
          isolation for read operations.  For example, a read operation using a
          read concern level of ``majority`` will only return data that has been
          written to a majority of nodes. If the level is left unspecified, the
          server default will be used.

    .. versionadded:: 3.2

    NlevelOptional[str]returnNonec                 C  s.   |d u s	t |tr|| _d S tdt| )Nz$level must be a string or None, not )
isinstancestr_ReadConcern__level	TypeErrortype)selfr    r   P/var/www/html/olx_land/venv/lib/python3.10/site-packages/pymongo/read_concern.py__init__%   s   
zReadConcern.__init__c                 C  s   | j S )zThe read concern level.)r   r   r   r   r   r   +   s   zReadConcern.levelboolc                 C  s   | j du p	| j dkS )zdReturn ``True`` if this read concern is compatible with
        old wire protocol versions.
        Nlocalr   r   r   r   r   ok_for_legacy0   s   zReadConcern.ok_for_legacydict[str, Any]c                 C  s   i }| j r
| j|d< |S )zThe document representation of this read concern.

        .. note::
          :class:`ReadConcern` is immutable. Mutating the value of
          :attr:`document` does not mutate this :class:`ReadConcern`.
        r   )r   r   )r   docr   r   r   document7   s   
zReadConcern.documentotherr   c                 C  s   t |tr| j|jkS tS N)r
   r   r   NotImplemented)r   r   r   r   r   __eq__D   s   
zReadConcern.__eq__r   c                 C  s   | j rd| j  S dS )NzReadConcern(%s)zReadConcern()r   r   r   r   r   __repr__I   s   
zReadConcern.__repr__r   )r   r   r   r	   )r   r   )r   r   )r   r   )r   r   r   r   )r   r   )__name__
__module____qualname____doc__r   propertyr   r   r   r   r   r   r   r   r   r      s    
r   N)r#   
__future__r   typingr   r   r   DEFAULT_READ_CONCERNr   r   r   r   <module>   s
   
7