
    h                         d Z ddlmZ  G d de      Z G d de      Z G d de      Z G d	 d
e      Z G d de      Zd Z	y)zkTools for working with `collations`_.

.. _collations: http://userguide.icu-project.org/collation/concepts
    )commonc                   ,    e Zd ZdZdZ	 dZ	 dZ	 dZ	 dZy)CollationStrengthzd
    An enum that defines values for `strength` on a
    :class:`~pymongo.collation.Collation`.
                   N)	__name__
__module____qualname____doc__PRIMARY	SECONDARYTERTIARY
QUATERNARY	IDENTICAL     T/var/www/html/ranktracker/api/venv/lib/python3.12/site-packages/pymongo/collation.pyr   r      s1    
 G4I*H'J;INr   r   c                       e Zd ZdZdZ	 dZy)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   -   s    
 $M@Gr   r   c                       e Zd ZdZdZ	 dZy)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   @   s    
 E2E#r   r   c                        e Zd ZdZdZ	 dZ	 dZy)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#   M   s!    
 E*E*
C3r   r#   c                   N    e Zd ZdZdZ	 	 	 	 	 	 	 	 d	dZed        Zd Zd Z	d Z
y)
	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

    )
__documentNc
                    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                  j                  |
       y )
Nlocale	caseLevel	caseFirststrengthnumericOrdering	alternatemaxVariablenormalization	backwards)r   validate_string_Collation__documentvalidate_booleanvalidate_integerupdate)selfr.   r/   r0   r1   r2   r3   r4   r5   r6   kwargss              r   __init__zCollation.__init__   sU    ''&9#V, +1+B+BY,(DOOK( +1+A+AY,(DOOK(*0*A*AH+&DOOJ'&171H1H!?24DOO-. +1+A+AY,(DOOK("-3-C-C{.,DOOM*$/5/F/F00DOOO, +1+B+BY,(DOOK(v&r   c                 6    | j                   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`.
        )r8   copy)r<   s    r   documentzCollation.document   s     ##%%r   c                 X    | j                   ddj                  fdD              dS )Nz
Collation(z, c              3   2   K   | ]  }|d |     yw)=Nr   ).0keyrA   s     r   	<genexpr>z%Collation.__repr__.<locals>.<genexpr>   s     Ihsm4Is   ))rA   join)r<   rA   s    @r   __repr__zCollation.__repr__   s*    ==IIIIIL 	Lr   c                 `    t        |t              r| j                  |j                  k(  S t        S N)
isinstancer+   rA   NotImplementedr<   others     r   __eq__zCollation.__eq__   s%    eY'==ENN22r   c                     | |k(   S rL   r   rO   s     r   __ne__zCollation.__ne__   s    5=  r   )NNNNNNNN)r   r   r   r   	__slots__r>   propertyrA   rJ   rQ   rS   r   r   r   r+   r+   ]   sS    8t  I  !%!#$'L & &L

!r   r+   c                 z    | y t        | t              r| j                  S t        | t              r| S t	        d      )NzFcollation must be a dict, an instance of collation.Collation, or None.)rM   r+   rA   dict	TypeError)values    r   validate_collation_or_nonerZ      s?    }%#~~%
	 r   N)
r   pymongor   objectr   r   r   r#   r+   rZ   r   r   r   <module>r]      sU   
 O O, &
$6 
$4 4 x! x!v	r   