fdZddlmZddlmZmZmZmZddlm Z ddl m Z GddZ Gdd Z Gd d ZGd d ZGddZ ddZy)zpTools for working with `collations`_. .. _collations: https://www.mongodb.com/docs/manual/reference/collation/ ) annotations)AnyMappingOptionalUnion)common)validate_booleanc,eZdZdZdZ dZ dZ dZ dZy)CollationStrengthzd An enum that defines values for `strength` on a :class:`~pymongo.collation.Collation`. N) __name__ __module__ __qualname____doc__PRIMARY SECONDARYTERTIARY QUATERNARY IDENTICALZ/var/lib/jenkins/workspace/mettalog/venv/lib/python3.12/site-packages/pymongo/collation.pyr r s1 G4I*H'J;INrr ceZdZdZdZ dZy)CollationAlternateze An enum that defines values for `alternate` on a :class:`~pymongo.collation.Collation`. z non-ignorableshiftedN)rrrr NON_IGNORABLESHIFTEDrrrrr1s $M@GrrceZdZdZdZ dZy)CollationMaxVariablezh An enum that defines values for `max_variable` on a :class:`~pymongo.collation.Collation`. punctspaceN)rrrrPUNCTSPACErrrr#r#Ds E2 E#rr#c eZdZdZdZ dZ dZy)CollationCaseFirstzf An enum that defines values for `case_first` on a :class:`~pymongo.collation.Collation`. upperloweroffN)rrrrUPPERLOWEROFFrrrr)r)Qs! E* E* C3rr)ceZdZdZdZ d d dZed dZd dZd dZ d dZ 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  xtjd|}d|i|_|td||jd<|#tjd||jd<|#tjd||jd<|td||jd<|#tjd||jd<|#tjd||jd<|td||jd<| td | |jd <|jj | y) Nlocale caseLevel caseFirststrengthnumericOrdering alternate maxVariable normalization backwards)rvalidate_string_Collation__documentr validate_integerupdate) selfr4r5r6r7r8r9r:r;r<kwargss r__init__zCollation.__init__s,''&9+3V*<  +;K+SDOOK (  +1+A+A+y+YDOOK (  *0*A*A*h*WDOOJ '  &1A!?2DOO- .  +1+A+A+y+YDOOK (  "-3-C-CMS^-_DOOM *  $/?Q^/_DOOO ,  +;K+SDOOK ( v&rc6|jjS)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)rAs rdocumentzCollation.documents##%%rcn|jdjdjfdDS)Nz Collation({})z, c32K|]}|d|yw)=Nr).0keyrFs r z%Collation.__repr__..s!/_s3%q#8I0J/_s)rFformatjoin)rArFs @r__repr__zCollation.__repr__s-==%%dii/_V^/_&_``rc`t|tr|j|jk(StSN) isinstancer1rFNotImplementedrAothers r__eq__zCollation.__eq__s% eY '==ENN2 2rc||k( SrQrrTs r__ne__zCollation.__ne__s5=  r)NNNNNNNN)r4strr5Optional[bool]r6 Optional[str]r7z Optional[int]r8rZr9r[r:r[r;rZr<rZrBrreturnNone)r\zdict[str, Any])r\rY)rUrr\bool) rrrr __slots__rCpropertyrFrOrVrXrrrr1r1as7r I %)#'"&*.#'%)(,$(!'!'"!'! !'  !' ( !'!!'#!'&!'"!'!' !'F&&a !rr1cz|yt|tr |jSt|tr|St d)NzFcollation must be a dict, an instance of collation.Collation, or None.)rRr1rFdict TypeError)values rvalidate_collation_or_noneres; }%#~~% \ ]]rN)rdz-Optional[Union[Mapping[str, Any], Collation]]r\zOptional[dict[str, Any]])r __future__rtypingrrrrpymongorpymongo.write_concernr r rr#r)r1rerrrrjsj#002OO,& $ $ 4 4 s!s!l ^ 8 ^ ^r