o
    C©ÌhJ  ã                   @  s”   d Z ddlmZ ddlmZmZmZmZ ddlm	Z	 ddl
mZ G dd„ dƒZG dd	„ d	ƒZG d
d„ dƒZG dd„ dƒZG dd„ dƒZddd„ZdS )zÑTools for working with `collations`_.

.. _collations: https://www.mongodb.com/docs/manual/reference/collation/

.. seealso:: This module is compatible with both the synchronous and asynchronous PyMongo APIs.
é    )Úannotations)ÚAnyÚMappingÚOptionalÚUnion)Úcommon)Úvalidate_booleanc                   @  s,   e Zd ZdZdZ	 dZ	 dZ	 dZ	 dZdS )ÚCollationStrengthzd
    An enum that defines values for `strength` on a
    :class:`~pymongo.collation.Collation`.
    é   é   é   é   é   N)	Ú__name__Ú
__module__Ú__qualname__Ú__doc__ÚPRIMARYÚ	SECONDARYÚTERTIARYÚ
QUATERNARYÚ	IDENTICAL© r   r   ú`/var/www/html/Moveonwheels/move_on_wheels/venv/lib/python3.10/site-packages/pymongo/collation.pyr	      s    r	   c                   @  ó   e Zd ZdZdZ	 dZdS )ÚCollationAlternateze
    An enum that defines values for `alternate` on a
    :class:`~pymongo.collation.Collation`.
    znon-ignorableÚshiftedN)r   r   r   r   ÚNON_IGNORABLEÚSHIFTEDr   r   r   r   r   3   ó    r   c                   @  r   )ÚCollationMaxVariablezh
    An enum that defines values for `max_variable` on a
    :class:`~pymongo.collation.Collation`.
    ÚpunctÚspaceN)r   r   r   r   ÚPUNCTÚSPACEr   r   r   r   r    F   r   r    c                   @  s    e Zd ZdZdZ	 dZ	 dZdS )ÚCollationCaseFirstzf
    An enum that defines values for `case_first` on a
    :class:`~pymongo.collation.Collation`.
    ÚupperÚlowerÚoffN)r   r   r   r   ÚUPPERÚLOWERÚOFFr   r   r   r   r%   S   s    r%   c                   @  s\   e Zd ZdZdZ								d"d#dd„Zed$dd„ƒZd%dd„Zd&dd„Z	d&d d!„Z
dS )'Ú	Collationa'
  Collation

    :param locale: (string) The locale of the collation. This should be a string
        that identifies an `ICU locale ID` exactly. For example, ``en_US`` is
        valid, but ``en_us`` and ``en-US`` are not. Consult the MongoDB
        documentation for a list of supported locales.
    :param caseLevel: (optional) If ``True``, turn on case sensitivity if
        `strength` is 1 or 2 (case sensitivity is implied if `strength` is
        greater than 2). Defaults to ``False``.
    :param caseFirst: (optional) Specify that either uppercase or lowercase
        characters take precedence. Must be one of the following values:

          * :data:`~CollationCaseFirst.UPPER`
          * :data:`~CollationCaseFirst.LOWER`
          * :data:`~CollationCaseFirst.OFF` (the default)

    :param strength: Specify the comparison strength. This is also
        known as the ICU comparison level. This must be one of the following
        values:

          * :data:`~CollationStrength.PRIMARY`
          * :data:`~CollationStrength.SECONDARY`
          * :data:`~CollationStrength.TERTIARY` (the default)
          * :data:`~CollationStrength.QUATERNARY`
          * :data:`~CollationStrength.IDENTICAL`

        Each successive level builds upon the previous. For example, a
        `strength` of :data:`~CollationStrength.SECONDARY` differentiates
        characters based both on the unadorned base character and its accents.

    :param numericOrdering: If ``True``, order numbers numerically
        instead of in collation order (defaults to ``False``).
    :param alternate: Specify whether spaces and punctuation are
        considered base characters. This must be one of the following values:

          * :data:`~CollationAlternate.NON_IGNORABLE` (the default)
          * :data:`~CollationAlternate.SHIFTED`

    :param maxVariable: When `alternate` is
        :data:`~CollationAlternate.SHIFTED`, this option specifies what
        characters may be ignored. This must be one of the following values:

          * :data:`~CollationMaxVariable.PUNCT` (the default)
          * :data:`~CollationMaxVariable.SPACE`

    :param normalization: If ``True``, normalizes text into Unicode
        NFD. Defaults to ``False``.
    :param backwards: If ``True``, accents on characters are
        considered from the back of the word to the front, as it is done in some
        French dictionary ordering traditions. Defaults to ``False``.
    :param kwargs: Keyword arguments supplying any additional options
        to be sent with this Collation object.

    .. versionadded: 3.4

    )Ú
__documentNÚlocaleÚstrÚ	caseLevelúOptional[bool]Ú	caseFirstúOptional[str]ÚstrengthúOptional[int]ÚnumericOrderingÚ	alternateÚmaxVariableÚnormalizationÚ	backwardsÚkwargsr   ÚreturnÚNonec
                 K  sî   t  d|¡}d|i| _|d urtd|ƒ| jd< |d ur$t  d|¡| jd< |d ur1t  d|¡| jd< |d ur=td|ƒ| jd< |d urJt  d|¡| jd< |d urWt  d|¡| jd< |d urctd|ƒ| jd< |	d urotd	|	ƒ| jd	< | j |
¡ d S )
Nr.   r0   r2   r4   r6   r7   r8   r9   r:   )r   Úvalidate_stringÚ_Collation__documentr   Úvalidate_integerÚupdate)Úselfr.   r0   r2   r4   r6   r7   r8   r9   r:   r;   r   r   r   Ú__init__Ÿ   s*   

ÿzCollation.__init__údict[str, Any]c                 C  s
   | j  ¡ S )zÏThe document representation of this collation.

        .. note::
          :class:`Collation` is immutable. Mutating the value of
          :attr:`document` does not mutate this :class:`Collation`.
        )r?   Úcopy©rB   r   r   r   ÚdocumentÂ   s   
zCollation.documentc                   s$   | j ‰ d d ‡ fdd„ˆ D ƒ¡¡S )NzCollation({})z, c                 3  s"   � | ]}|› d ˆ | ›�V  qdS )ú=Nr   )Ú.0Úkey©rG   r   r   Ú	<genexpr>Î   s   €  z%Collation.__repr__.<locals>.<genexpr>)rG   ÚformatÚjoinrF   r   rK   r   Ú__repr__Ì   s   zCollation.__repr__ÚotherÚboolc                 C  s   t |tƒr| j|jkS tS ©N)Ú
isinstancer,   rG   ÚNotImplemented©rB   rP   r   r   r   Ú__eq__Ð   s   
zCollation.__eq__c                 C  s
   | |k S rR   r   rU   r   r   r   Ú__ne__Õ   s   
zCollation.__ne__)NNNNNNNN)r.   r/   r0   r1   r2   r3   r4   r5   r6   r1   r7   r3   r8   r3   r9   r1   r:   r1   r;   r   r<   r=   )r<   rD   )r<   r/   )rP   r   r<   rQ   )r   r   r   r   Ú	__slots__rC   ÚpropertyrG   rO   rV   rW   r   r   r   r   r,   c   s"    9ö#
	
r,   Úvalueú-Optional[Union[Mapping[str, Any], Collation]]r<   úOptional[dict[str, Any]]c                 C  s2   | d u rd S t | tƒr| jS t | tƒr| S tdƒ‚)NzEcollation must be a dict, an instance of collation.Collation, or None)rS   r,   rG   ÚdictÚ	TypeError)rZ   r   r   r   Úvalidate_collation_or_noneÙ   s   

r_   N)rZ   r[   r<   r\   )r   Ú
__future__r   Útypingr   r   r   r   Úpymongor   Úpymongo.write_concernr   r	   r   r    r%   r,   r_   r   r   r   r   Ú<module>   s   v