
    FCf                        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      Z G d d	      Z G d
 d      Z G d d      Z G d d      Z	 	 	 	 ddZy)zpTools for working with `collations`_.

.. _collations: https://www.mongodb.com/docs/manual/reference/collation/
    )annotations)AnyMappingOptionalUnion)common)validate_booleanc                  ,    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     Q/var/www/highfloat_scraper/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   1   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#   D   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)   Q   s!    
 E*E*
C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
y)	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

    )
__documentNc
                x   t        j                  d|      }d|i| _        |t        d|      | j                  d<   |#t        j                  d|      | j                  d<   |#t        j                  d|      | j                  d<   |t        d|      | j                  d<   |#t        j                  d|      | j                  d<   |#t        j                  d|      | j                  d<   |t        d|      | j                  d<   |	t        d	|	      | j                  d	<   | j                  j                  |
       y )
Nlocale	caseLevel	caseFirststrengthnumericOrdering	alternatemaxVariablenormalization	backwards)r   validate_string_Collation__documentr	   validate_integerupdate)selfr4   r5   r6   r7   r8   r9   r:   r;   r<   kwargss              r   __init__zCollation.__init__   s,    ''&9+3V*< +;K+SDOOK( +1+A+A+y+YDOOK(*0*A*A*h*WDOOJ'&1A!?2DOO-.  +1+A+A+y+YDOOK("-3-C-CMS^-_DOOM*$/?Q^/_DOOO, +;K+SDOOK(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`.
        )r>   copy)rA   s    r   documentzCollation.document   s     ##%%r   c                n    | j                   dj                  dj                  fdD                    S )NzCollation({})z, c              3  2   K   | ]  }| d |     yw)=Nr   ).0keyrF   s     r   	<genexpr>z%Collation.__repr__.<locals>.<genexpr>   s!     /_s3%q#8I0J/_s   )rF   formatjoin)rA   rF   s    @r   __repr__zCollation.__repr__   s-    ==%%dii/_V^/_&_``r   c                `    t        |t              r| j                  |j                  k(  S t        S N)
isinstancer1   rF   NotImplementedrA   others     r   __eq__zCollation.__eq__   s%    eY'==ENN22r   c                    | |k(   S rQ   r   rT   s     r   __ne__zCollation.__ne__   s    5=  r   )NNNNNNNN)r4   strr5   Optional[bool]r6   Optional[str]r7   zOptional[int]r8   rZ   r9   r[   r:   r[   r;   rZ   r<   rZ   rB   r   returnNone)r\   zdict[str, Any])r\   rY   )rU   r   r\   bool)r   r   r   r   	__slots__rC   propertyrF   rO   rV   rX   r   r   r   r1   r1   a   s    7r  I
 %)#'"&*.#'%)(,$(!'!' "!' !	!'
  !' (!' !!' #!' &!' "!' !' 
!'F & &a
!r   r1   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.)rR   r1   rF   dict	TypeError)values    r   validate_collation_or_nonere      s;     }%#~~%
\
]]r   N)rd   z-Optional[Union[Mapping[str, Any], Collation]]r\   zOptional[dict[str, Any]])r   
__future__r   typingr   r   r   r   pymongor   pymongo.write_concernr	   r   r   r#   r)   r1   re   r   r   r   <module>rj      sj    # 0 0  2O O, &
$ 
$4 4 s! s!l	^8	^	^r   