
    [j<                        d Z ddlmZ ddlmZmZmZmZ ddlm	Z	  G d d          Z
 G d d          Z G d	 d
          Z G d d          Z G d d          ZddZdS )zpTools for working with `collations`_.

.. _collations: https://www.mongodb.com/docs/manual/reference/collation/
    )annotations)AnyMappingOptionalUnion)commonc                  .    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     U/var/www/app.qaans.com/backend/venv/lib/python3.11/site-packages/pymongo/collation.pyr
   r
      sA         
 G4I*H'J;INNr   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   0   s-         
 $M@G r   r   c                      e Zd ZdZdZ	 dZdS )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"   C   s)         
 E2E##r   r"   c                  "    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(   P   s1         
 E*E*
C33r   r(   c                  `    e Zd ZdZdZ	 	 	 	 	 	 	 	 dddZedd            Zd dZd!dZ	d!dZ
dS )"	Collationa{
  Collation

    :Parameters:
      - `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.
      - `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``.
      - `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)

      - `strength`: (optional) 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.

      - `numericOrdering`: (optional) If ``True``, order numbers numerically
        instead of in collation order (defaults to ``False``).
      - `alternate`: (optional) 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`

      - `maxVariable`: (optional) 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`

      - `normalization`: (optional) If ``True``, normalizes text into Unicode
        NFD. Defaults to ``False``.
      - `backwards`: (optional) 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``.
      - `kwargs`: (optional) 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
                f   t          j        d|          }d|i| _        |t          j        d|          | j        d<   |t          j        d|          | j        d<   |t          j        d|          | j        d<   |t          j        d|          | j        d<   |t          j        d|          | j        d<   |t          j        d|          | j        d<   |t          j        d|          | j        d<   |	t          j        d	|	          | j        d	<   | j                            |
           d S )
Nr2   r4   r6   r8   r:   r;   r<   r=   r>   )r   validate_string_Collation__documentvalidate_booleanvalidate_integerupdate)selfr2   r4   r6   r8   r:   r;   r<   r=   r>   r?   s              r   __init__zCollation.__init__   sH    '&99+3V*< +1+B;PY+Z+ZDOK( +1+A+y+Y+YDOK(*0*A*h*W*WDOJ'&171H!?2 2DO-.  +1+A+y+Y+YDOK("-3-CMS^-_-_DOM*$/5/F0 0DOO,  +1+B;PY+Z+ZDOK(v&&&&&r   dict[str, Any]c                4    | j                                         S )zThe document representation of this collation.

        .. note::
          :class:`Collation` is immutable. Mutating the value of
          :attr:`document` does not mutate this :class:`Collation`.
        )rD   copy)rH   s    r   documentzCollation.document   s     ##%%%r   c                z    | j         d                    d                    fdD                                 S )NzCollation({})z, c              3  2   K   | ]}| d |         V  dS )=Nr   ).0keyrM   s     r   	<genexpr>z%Collation.__repr__.<locals>.<genexpr>   s5      /_/_s30J0J#0J0J/_/_/_/_/_/_r   )rM   formatjoin)rH   rM   s    @r   __repr__zCollation.__repr__   s@    =%%dii/_/_/_/_V^/_/_/_&_&_```r   otherboolc                Z    t          |t                    r| j        |j        k    S t          S N)
isinstancer0   rM   NotImplementedrH   rW   s     r   __eq__zCollation.__eq__   s)    eY'' 	3=EN22r   c                    | |k     S rZ   r   r]   s     r   __ne__zCollation.__ne__   s    5=  r   )NNNNNNNN)r2   r3   r4   r5   r6   r7   r8   r9   r:   r5   r;   r7   r<   r7   r=   r5   r>   r5   r?   r   r@   rA   )r@   rJ   )r@   r3   )rW   r   r@   rX   )r   r   r   r   	__slots__rI   propertyrM   rV   r^   r`   r   r   r   r0   r0   `   s        8 8t  I
 %)#'"&*.#'%)(,$(#' #' #' #' #'J & & & X&a a a a   
! ! ! ! ! !r   r0   value-Optional[Union[Mapping[str, Any], Collation]]r@   Optional[dict[str, Any]]c                    | d S t          | t                    r| j        S t          | t                    r| S t	          d          )NzFcollation must be a dict, an instance of collation.Collation, or None.)r[   r0   rM   dict	TypeError)rc   s    r   validate_collation_or_noneri      sN     }t%## ~% 
\
]
]]r   N)rc   rd   r@   re   )r   
__future__r   typingr   r   r   r   pymongor   r
   r   r"   r(   r0   ri   r   r   r   <module>rm      sV    # " " " " " 0 0 0 0 0 0 0 0 0 0 0 0      O O O O O O O O,       &
$ 
$ 
$ 
$ 
$ 
$ 
$ 
$4 4 4 4 4 4 4 4 v! v! v! v! v! v! v! v!r	^ 	^ 	^ 	^ 	^ 	^r   