+
    *:žgHZ  ã            	      óì  a € 0 t $ R t^ RIHt ^ RIt^ RIt^ RIHtHt ^ RI	H
t
HtHt RBtRtR R lt ! R R	4      tR
 R ltR R ltR R ltR R ltR R ltR R lt ! R R]4      t0 RCmtR]P4                  ! R]P6                  4      3R]P4                  ! RRP9                  ]4       R24      3R]P4                  ! R4      3R]P4                  ! R 4      3R!]P4                  ! R"]P6                  4      3.tR#]R$&   R% R& ltRDR' R( llt RDR) R* llt!R+ R, lt"R- R. lt#R/ R0 lt$R1 R2 lt% ! R3 R44      t&R5 t'R6 t(R7 t) ! R8 R94      t* ! R: R;]*4      t+ ! R< R=]*4      t, ! R> R?],4      t- ! R@ RA]*4      t.R# )Ezœ
babel.numbers
~~~~~~~~~~~~~

CLDR Plural support.  See UTS #35.

:copyright: (c) 2013-2025 by the Babel Team.
:license: BSD, see LICENSE for more details.
)ÚannotationsN)ÚIterableÚMapping)ÚAnyÚCallableÚLiteralÚotherc               ó    € V ^8„  d   QhRRRR/# )é   Úsourceúfloat | decimal.DecimalÚreturnzMtuple[decimal.Decimal | int, int, int, int, int, int, Literal[0], Literal[0]]© )Úformats   "Ú./usr/lib/python3/dist-packages/babel/plural.pyÚ__annotate__r      s   € ÷ 8"ñ 8"Ð4ð 8"ð  :Gñ 8"ó    c                óF  € \        V 4      p\        V4      p\        V\        4      '       d)   W!8X  d   TpM\        P
                  ! \        V4      4      p\        V\        P
                  4      '       dŸ   VP                  4       pVP                  pV^ 8  d   VP                  VR MRpRP                  R V 4       4      pVP                  R4      p\        V4      p\        V4      p	\        T;'       g    ^ 4      p
\        T;'       g    ^ 4      pM^ ;p;p	;r«^ ;rÍWW‰W«WÍ3# )u«  Extract operands from a decimal, a float or an int, according to `CLDR rules`_.

The result is an 8-tuple (n, i, v, w, f, t, c, e), where those symbols are as follows:

====== ===============================================================
Symbol Value
------ ---------------------------------------------------------------
n      absolute value of the source number (integer and decimals).
i      integer digits of n.
v      number of visible fraction digits in n, with trailing zeros.
w      number of visible fraction digits in n, without trailing zeros.
f      visible fractional digits in n, with trailing zeros.
t      visible fractional digits in n, without trailing zeros.
c      compact decimal exponent value: exponent of the power of 10 used in compact decimal formatting.
e      currently, synonym for â€˜câ€™. however, may be redefined in the future.
====== ===============================================================

.. _`CLDR rules`: https://www.unicode.org/reports/tr35/tr35-61/tr35-numbers.html#Operands

:param source: A real number
:type source: int|float|decimal.Decimal
:return: A n-i-v-w-f-t-c-e tuple
:rtype: tuple[decimal.Decimal, int, int, int, int, int, int, int]
NÚ c              3  ó8   "  € T F  p\        V4      x € K  	  R # 5i©N©Ústr)Ú.0Úds   & r   Ú	<genexpr>Ú#extract_operands.<locals>.<genexpr>D   s   é € Ð;©? aœ3˜qŸ6˜6«?ùs   ‚Ú0r   )ÚabsÚintÚ
isinstanceÚfloatÚdecimalÚDecimalr   Úas_tupleÚexponentÚdigitsÚjoinÚrstripÚlen)r   ÚnÚiÚ	dec_tupleÚexpÚfraction_digitsÚtrailingÚno_trailingÚvÚwÚfÚtÚcÚes   &             r   Úextract_operandsr7      s  € ô2 	ˆF‹€AÜˆA‹€AÜ�!”U×ÒØŒ6Ø‰Aô —’¤ A£Ó'ˆAä�!”W—_‘_×%Ò%Ø—J‘J“Lˆ	Ø× Ñ ˆØ47¸!´G˜)×*Ñ*¨3¨4Ñ0ÀˆØ—7‘7Ñ;©?Ó;Ó;ˆØ—o‘o cÓ*ˆÜ�‹MˆÜ�ÓˆÜ�—�˜AÓˆÜ�× Ð ˜qÓ!‰àÐˆÐˆAÐ�Ø€I€AØ��q˜QÐ!Ð!r   c                  óœ   € ] tR t^PtRtRtR R ltR R lt]R R l4       t	]
R R	 l4       t]
R
 R l4       tR R ltR R ltR R ltRtR# )Ú
PluralRulea*  Represents a set of language pluralization rules.  The constructor
accepts a list of (tag, expr) tuples or a dict of `CLDR rules`_. The
resulting object is callable and accepts one parameter with a positive or
negative number (both integer and float) for the number that indicates the
plural form for a string and returns the tag for the format:

>>> rule = PluralRule({'one': 'n is 1'})
>>> rule(1)
'one'
>>> rule(2)
'other'

Currently the CLDR defines these tags: zero, one, two, few, many and
other where other is an implicit default.  Rules should be mutually
exclusive; for a given numeric value, only one rule should apply (i.e.
the condition should only be true for one of the plural rule elements.

.. _`CLDR rules`: https://www.unicode.org/reports/tr35/tr35-33/tr35-numbers.html#Language_Plural_Rules
c               ó    € V ^8„  d   QhRRRR/# )r
   Úrulesz-Mapping[str, str] | Iterable[tuple[str, str]]r   ÚNoner   )r   s   "r   r   ÚPluralRule.__annotate__g   s   € ÷ 1ñ 1ÐKð 1ÐPTñ 1r   c                ó”  € \        V\        4      '       d   VP                  4       p\        4       p. V n        \        V4       F�  w  r4V\        9  d   \        RV: 24      hW29   d   \        RV: R24      hVP                  V4       \        V4      P                  pV'       g   Ke  V P                  P                  W534       Kƒ  	  R# )züInitialize the rule instance.

:param rules: a list of ``(tag, expr)``) tuples with the rules
              conforming to UTS #35 or a dict with the tags as keys
              and expressions as values.
:raise RuleError: if the expression is malformed
zunknown tag ztag z defined twiceN)r    r   ÚitemsÚsetÚabstractÚsortedÚ_plural_tagsÚ
ValueErrorÚaddÚ_ParserÚastÚappend)Úselfr;   ÚfoundÚkeyÚexprrG   s   &&    r   Ú__init__ÚPluralRule.__init__g   s    € ô �eœW×%Ò%Ø—K‘K“MˆEÜ“ˆØ/1ˆŒÜ ž‰IˆCØœ,Ô&Ü  <°©wÐ!7Ó8Ð8Ø”Ü  4¨¡w¨nÐ!=Ó>Ð>Ø�I‰I�cŒNÜ˜$“-×#Ñ#ˆCß‰sØ—‘×$Ñ$ c ZÖ0ó 'r   c               ó   € V ^8„  d   QhRR/# )r
   r   r   r   )r   s   "r   r   r=   }   s   € ÷ 3ñ 3˜#ñ 3r   c           	     	óÎ   € V P                   pR P                  \         Uu. uF  q"V9   g   K  V RW,           2NK  	  up4      pR\        V 4      P                   RV: R2# u upi )ú, z: Ú<Ú Ú>)r;   r'   rC   ÚtypeÚ__name__)rI   r;   ÚtagÚargss   &   r   Ú__repr__ÚPluralRule.__repr__}   sc   € Ø—
‘
ˆØ�y‰y½LÓY¹L°SÐSXÉLÔ0˜S˜E  E¥J <Ó0¹LÑYÓZˆØ”4˜“:×&Ñ&Ð' q¨©°Ð2Ð2ùò Zs
    A"­A"c               ó    € V ^8„  d   QhRRRR/# )r
   r;   ú:Mapping[str, str] | Iterable[tuple[str, str]] | PluralRuler   r9   r   )r   s   "r   r   r=   ƒ   s   € ÷ 	ñ 	ÐTð 	ÐYcñ 	r   c                óB   € \        V\        4      '       d   V# V ! V4      # )zêCreate a `PluralRule` instance for the given rules.  If the rules
are a `PluralRule` object, that object is returned.

:param rules: the rules as list or dict, or a `PluralRule` object
:raise RuleError: if the expression is malformed
)r    r9   )Úclsr;   s   &&r   ÚparseÚPluralRule.parse‚   s    € ô �eœZ×(Ò(ØˆLÙ�5‹zÐr   c               ó   € V ^8„  d   QhRR/# )r
   r   zMapping[str, str]r   )r   s   "r   r   r=   �   s   € ÷ Bñ BÐ(ñ Br   c                ó‚   € \        4       P                  pV P                   UUu/ uF  w  r#W!! V4      bK  	  upp# u uppi )zThe `PluralRule` as a dict of unicode plural rules.

>>> rule = PluralRule({'one': 'n is 1'})
>>> rule.rules
{'one': 'n is 1'}
)Ú_UnicodeCompilerÚcompilerA   )rI   Ú_compilerW   rG   s   &   r   r;   ÚPluralRule.rulesŽ   s9   € ô $Ó%×-Ñ-ˆØ37·=²=ÔA±=¡x s��X˜c“]Ò"±=ÒAÐAùÓAs   ¤;c               ó   € V ^8„  d   QhRR/# )r
   r   zfrozenset[str]r   )r   s   "r   r   r=   š   s   € ÷ 6ñ 6�nñ 6r   c                ó:   € \        R V P                   4       4      # )z˜A set of explicitly defined tags in this rule.  The implicit default
``'other'`` rules is not part of this set unless there is an explicit
rule for it.
c              3  ó2   "  € T F  q^ ,          x € K  	  R# 5i)é    Nr   )r   r+   s   & r   r   Ú"PluralRule.tags.<locals>.<genexpr>Ÿ   s   é € Ð5¡} !˜1Ÿš£}ùs   ‚)Ú	frozensetrA   ©rI   s   &r   ÚtagsÚPluralRule.tags™   s   € ô Ñ5 t§}¢}Ó5Ó5Ð5r   c               ó   € V ^8„  d   QhRR/# )r
   r   úlist[tuple[str, Any]]r   )r   s   "r   r   r=   ¡   s   € ÷ ñ Ð3ñ r   c                	ó   € V P                   # r   ©rA   rm   s   &r   Ú__getstate__ÚPluralRule.__getstate__¡   s   € Ø�}‰}Ðr   c               ó    € V ^8„  d   QhRRRR/# )r
   rA   rq   r   r<   r   )r   s   "r   r   r=   ¤   s   € ÷ !ñ !Ð%:ð !¸tñ !r   c                	ó   € Wn         R # r   rs   )rI   rA   s   &&r   Ú__setstate__ÚPluralRule.__setstate__¤   s   € Ø Žr   c               ó    € V ^8„  d   QhRRRR/# )r
   r*   r   r   r   r   )r   s   "r   r   r=   §   s   € ÷ ñ Ð1ð °cñ r   c                	óh   € \        V R 4      '       g   \        V 4      V n        V P                  V4      # )Ú_func)ÚhasattrÚ	to_pythonr|   )rI   r*   s   &&r   Ú__call__ÚPluralRule.__call__§   s(   € Ü�t˜W×%Ò%Ü" 4›ˆDŒJØ�z‰z˜!‹}Ðr   )r|   rA   N)rA   r|   )rV   Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Ú	__slots__rM   rY   Úclassmethodr_   Úpropertyr;   rn   rt   rx   r   Ú__static_attributes__r   r   r   r9   r9   P   sj   † ñð( &€Iõ1õ,3ð
 ô	ó ð	ð ôBó ðBð ô6ó ð6õõ!÷ñ r   r9   c               ó    € V ^8„  d   QhRRRR/# ©r
   Úruler\   r   r   r   )r   s   "r   r   r   ­   s   € ÷ ñ ÐRð ÐWZñ r   c                ó  € \        4       P                  pR.p\        P                  V 4      P                   F#  w  r4VP                  V! V4       RV: R24       K%  	  VP                  R\        ,          4       RP                  V4      # )aZ  Convert a list/dict of rules or a `PluralRule` object into a JavaScript
function.  This function depends on no external library:

>>> to_javascript({'one': 'n is 1'})
"(function(n) { return (n == 1) ? 'one' : 'other'; })"

Implementation detail: The function generated will probably evaluate
expressions involved into range operations multiple times.  This has the
advantage that external helper functions are not required and is not a
big performance hit for these simple calculations.

:param rule: the rules as list or dict, or a `PluralRule` object
:raise RuleError: if the expression is malformed
z(function(n) { return ú ? ú : z%r; })r   )Ú_JavaScriptCompilerrd   r9   r_   rA   rH   Ú_fallback_tagr'   )r‹   Úto_jsÚresultrW   rG   s   &    r   Úto_javascriptr“   ­   ss   € ô  Ó!×)Ñ)€EØ&Ð'€FÜ×$Ñ$ TÓ*×3Ô3‰ˆØ�‰™˜s›˜ C¨¡w¨cÐ2Ö3ñ 4à
‡M�M�(œ]Õ*Ô+Ø�7‰7�6‹?Ðr   c               ó    € V ^8„  d   QhRRRR/# )r
   r‹   r\   r   z(Callable[[float | decimal.Decimal], str]r   )r   s   "r   r   r   Ä   s   € ÷ %!ñ %!ÐNð %!ÐS{ñ %!r   c           	     ó–  € R\         R\        R\        R\        /p\	        4       P
                  pRR.p\        P                  V 4      P                   F,  w  rEVP                  RV! V4       R\        V4      : 24       K.  	  VP                  R	\        : 24       \        R
P                  V4      RR4      p\        Wa4       VR,          # )a   Convert a list/dict of rules or a `PluralRule` object into a regular
Python function.  This is useful in situations where you need a real
function and don't are about the actual rule object:

>>> func = to_python({'one': 'n is 1', 'few': 'n in 2..4'})
>>> func(1)
'one'
>>> func(3)
'few'
>>> func = to_python({'one': 'n in 1,11', 'few': 'n in 3..10,13..19'})
>>> func(11)
'one'
>>> func(15)
'few'

:param rule: the rules as list or dict, or a `PluralRule` object
:raise RuleError: if the expression is malformed
ÚINÚWITHINÚMODr7   zdef evaluate(n):z- n, i, v, w, f, t, c, e = extract_operands(n)z if (z
): return z return Ú
z<rule>ÚexecÚevaluate)Úin_range_listÚwithin_range_listÚcldr_modulor7   Ú_PythonCompilerrd   r9   r_   rA   rH   r   r�   r'   Úeval)r‹   Ú	namespaceÚto_python_funcr’   rW   rG   Úcodes   &      r   r~   r~   Ä   sÂ   € ð( 	ŒmØÔ#ØŒ{ØÔ,ð	€Iô %Ó&×.Ñ.€NàØ7ð€Fô ×$Ñ$ TÓ*×3Ô3‰ˆð 	�‰˜™n¨SÓ1Ð2°*¼SÀ»X¹LÐIÖJñ 4ð ‡M�M�Hœ]Ñ-Ð.Ô/Ü�4—9‘9˜VÓ$ h°Ó7€DÜˆÔØ�ZÕ Ð r   c               ó    € V ^8„  d   QhRRRR/# rŠ   r   )r   s   "r   r   r   ì   s   € ÷ ñ ÐOð ÐTWñ r   c                óÌ  € \         P                  V 4      p V P                  \        0,          p\	        4       P
                  p\         Uu. uF  q3V9   g   K  VNK  	  upP                  pR\        V4       R2.pV P                   F(  w  r6VP                  V! V4       RV! V4       R24       K*  	  VP                  V! \        4       R24       RP                  V4      # u upi )ag  The plural rule as gettext expression.  The gettext expression is
technically limited to integers and returns indices rather than tags.

>>> to_gettext({'one': 'n is 1', 'two': 'n is 2'})
'nplurals=3; plural=((n == 1) ? 0 : (n == 2) ? 1 : 2);'

:param rule: the rules as list or dict, or a `PluralRule` object
:raise RuleError: if the expression is malformed
z	nplurals=z
; plural=(r�   rŽ   z);r   )r9   r_   rn   r�   Ú_GettextCompilerrd   rC   Úindexr)   rA   rH   r'   )r‹   Ú	used_tagsre   rW   Ú
_get_indexr’   rG   s   &      r   Ú
to_gettextrª   ì   sÈ   € ô ×Ñ˜DÓ!€Dà—	‘	œ]˜OÕ+€IÜÓ!×)Ñ)€HÝ!-ÓB¡˜#¸	Ñ1A—#�#¡ÑB×HÑH€Jàœ#˜i›.Ð)¨Ð4Ð5€FØ—M”M‰ˆØ�‰™ #›˜ s©:°c«?Ð*;¸3Ð?Ö@ñ "à
‡M�M‘Z¤Ó.Ð/¨rÐ2Ô3Ø�7‰7�6‹?Ðùò Cs   Á
C!ÁC!c               ó$   € V ^8„  d   QhRRRRRR/# ©r
   Únumr   Ú
range_listú+Iterable[Iterable[float | decimal.Decimal]]r   Úboolr   )r   s   "r   r   r     s)   € ÷ Bñ BÐ.ð BÐ<gð BÐlpñ Br   c                óD   € V \        V 4      8H  ;'       d    \        W4      # )aa  Integer range list test.  This is the callback for the "in" operator
of the UTS #35 pluralization rule language:

>>> in_range_list(1, [(1, 3)])
True
>>> in_range_list(3, [(1, 3)])
True
>>> in_range_list(3, [(1, 3), (5, 8)])
True
>>> in_range_list(1.2, [(1, 4)])
False
>>> in_range_list(10, [(1, 4)])
False
>>> in_range_list(10, [(1, 4), (6, 8)])
False
)r   r�   ©r­   r®   s   &&r   rœ   rœ     s    € ð" ”#�c“(‰?×AÐAÔ0°ÓAÐAr   c               ó$   € V ^8„  d   QhRRRRRR/# r¬   r   )r   s   "r   r   r     s)   € ÷ Añ AÐ2ð AÐ@kð AÐptñ Ar   c                óx   a € \         ;QJ d    V 3R lV 4       F  '       g   K   R# 	  R# ! V 3R lV 4       4      # )a~  Float range test.  This is the callback for the "within" operator
of the UTS #35 pluralization rule language:

>>> within_range_list(1, [(1, 3)])
True
>>> within_range_list(1.0, [(1, 3)])
True
>>> within_range_list(1.2, [(1, 4)])
True
>>> within_range_list(8.8, [(1, 4), (7, 15)])
True
>>> within_range_list(10, [(1, 4)])
False
>>> within_range_list(10.5, [(1, 4), (20, 30)])
False
c              3  óT   <"  € T F  w  rVSu;8*  ;'       d    V8*  Mu x € K  	  R # 5ir   r   )r   Úmin_Úmax_r­   s   &  €r   r   Ú$within_range_list.<locals>.<genexpr>(  s#   øé € Ð@±Z¡z tˆt�s×"Ô"˜d×"Ñ"³Zùs   ƒ%(TF)Úanyr²   s   f&r   r�   r�     s.   ø€ ÷" ‹3Ô@±ZÓ@�3Œ3Ð@Š3Ð@ˆ3Ô@±ZÓ@Ó@Ð@r   c               ó$   € V ^8„  d   QhRRRRRR/# )r
   Úar!   Úbr   r   )r   s   "r   r   r   +  s!   € ÷ ñ �5ð ˜Uð  uñ r   c                ó€   € ^ pV ^ 8  d   V R,          p ^pV^ 8  d
   VR,          pW,          pV'       d
   VR,          pV# )zÎJavaish modulo.  This modulo operator returns the value with the sign
of the dividend rather than the divisor like Python does:

>>> cldr_modulo(-3, 5)
-3
>>> cldr_modulo(-3, -5)
-3
>>> cldr_modulo(3, 5)
3
éÿÿÿÿr   )r»   r¼   ÚreverseÚrvs   &&  r   rž   rž   +  sF   € ð €GØˆ1„uØ	ˆR�ˆØˆØˆ1„uØ	ˆR�ˆØ	
�€BßØ
ˆb�ˆØ€Ir   c                  ó   € ] tR tRtRtRtR# )Ú	RuleErroriB  zRaised if a rule is malformed.r   N)rV   r�   r‚   rƒ   r„   rˆ   r   r   r   rÂ   rÂ   B  s   † Ý(r   rÂ   z\s+Úwordz"\b(and|or|is|(?:with)?in|not|mod|[r   z])\bÚvaluez\d+Úsymbolz%|,|!=|=Úellipsisz\.{2,3}|\u2026z(list[tuple[str | None, re.Pattern[str]]]Ú_RULESc               ó    € V ^8„  d   QhRRRR/# )r
   Úsr   r   úlist[tuple[str, str]]r   )r   s   "r   r   r   Z  s   € ÷ ñ �Sð Ð2ñ r   c                ó\  € V P                  R 4      ^ ,          p . p^ p\        V 4      pW#8  du   \         FU  w  rEVP                  W4      pVf   K  VP	                  4       pV'       d!   VP                  WFP                  4       34        Kc  	  \        RW,          : 24      hVRRR1,          # )Ú@Nz3malformed CLDR pluralization rule.  Got unexpected r¾   )Úsplitr)   rÇ   ÚmatchÚendrH   ÚgrouprÂ   )rÉ   r’   ÚposrÏ   Útokr‹   rÎ   s   &      r   Útokenize_rulerÓ   Z  s™   € Ø	�‰�‹�Q�€AØ$&€FØ
€CÜ
ˆa‹&€CØ
Œ)ß‰IˆCØ—J‘J˜qÓ&ˆEØÔ Ø—i‘i“k�ßØ—M‘M 3¯©«Ð"6Ô7Úñ  ô ÐQÐRSÕRXÑQ[Ð\Ó]Ð]Ø‘$�B�$�<Ðr   c               ó(   € V ^8„  d   QhRRRRRRRR/# )	r
   ÚtokensrÊ   Útype_r   rÄ   ú
str | Noner   zlist[tuple[str, str]] | boolr   )r   s   "r   r   r   l  s0   € ÷ 2ñ 2Ø!ð2àð2ð ð2ð "ñ	2r   c                óŠ   € T ;'       d;    V R,          ^ ,          V8H  ;'       d     VRJ ;'       g    V R,          ^,          V8H  # )é   Nr¾   r   ©rÕ   rÖ   rÄ   s   &&&r   Útest_next_tokenrÛ   l  sK   € ð
 ÷ 2ð 2�f˜R•j •m uÑ,÷ 2ð 2Ø	�$ˆ×	0Ð	0˜& �* Q�-¨5Ñ0ð2r   c               ó$   € V ^8„  d   QhRRRRRR/# )r
   rÕ   rÊ   rÖ   r   rÄ   r×   r   )r   s   "r   r   r   u  s"   € ÷ ñ Ð,ð °Sð Àñ r   c                óJ   € \        WV4      '       d   V P                  4       # R # r   )rÛ   ÚpoprÚ   s   &&&r   Ú
skip_tokenrß   u  s    € Ü�v e×,Ò,Ø�z‰z‹|Ðñ -r   c               ó    € V ^8„  d   QhRRRR/# )r
   rÄ   r   r   z#tuple[Literal['value'], tuple[int]]r   )r   s   "r   r   r   z  s   € ÷ ñ �cð ÐAñ r   c                ó   € R V 33# ©rÄ   r   râ   s   &r   Ú
value_noderã   z  s   € Ø�U�IÐÐr   c               ó    € V ^8„  d   QhRRRR/# )r
   Únamer   r   ztuple[str, tuple[()]]r   )r   s   "r   r   r   ~  s   € ÷ ñ �Sð Ð2ñ r   c                ó
   € V R3# )Nr   r   )rå   s   &r   Ú
ident_noderç   ~  s   € Ø�ˆ8€Or   c               ó    € V ^8„  d   QhRRRR/# )r
   r®   r¯   r   zItuple[Literal['range_list'], Iterable[Iterable[float | decimal.Decimal]]]r   )r   s   "r   r   r   ‚  s   € ÷ $ñ $Ø;ð$àNñ$r   c                ó
   € R V 3# ©r®   r   rê   s   &r   Úrange_list_noderë   ‚  s   € ð ˜Ð#Ð#r   c               ó    € V ^8„  d   QhRRRR/# )r
   rÀ   ztuple[Any, ...]r   z-tuple[Literal['not'], tuple[tuple[Any, ...]]]r   )r   s   "r   r   r   ˆ  s   € ÷ ñ ˆð Ð#Pñ r   c                ó   € R V 33# )Únotr   )rÀ   s   &r   Únegaterï   ˆ  s   € Ø�2�%ˆ<Ðr   c                  óZ   € ] tR tRtRtR tRR ltR tR tR t	R	 t
R
 tR tR tR tRtR# )rF   iŒ  u‚  Internal parser.  This class can translate a single rule into an abstract
tree of tuples. It implements the following grammar::

    condition     = and_condition ('or' and_condition)*
                    ('@integer' samples)?
                    ('@decimal' samples)?
    and_condition = relation ('and' relation)*
    relation      = is_relation | in_relation | within_relation
    is_relation   = expr 'is' ('not')? value
    in_relation   = expr (('not')? 'in' | '=' | '!=') range_list
    within_relation = expr ('not')? 'within' range_list
    expr          = operand (('mod' | '%') value)?
    operand       = 'n' | 'i' | 'f' | 't' | 'v' | 'w'
    range_list    = (range | value) (',' range_list)*
    value         = digit+
    digit         = 0|1|2|3|4|5|6|7|8|9
    range         = value'..'value
    samples       = sampleRange (',' sampleRange)* (',' ('â€¦'|'...'))?
    sampleRange   = decimalValue '~' decimalValue
    decimalValue  = value ('.' value)?

- Whitespace can occur between or around any of the above tokens.
- Rules should be mutually exclusive; for a given numeric value, only one
  rule should apply (i.e. the condition should only be true for one of
  the plural rule elements).
- The in and within relations can take comma-separated lists, such as:
  'n in 3,5,7..15'.
- Samples are ignored.

The translator parses the expression on instantiation into an attribute
called `ast`.
c                	óø   € \        V4      V n        V P                  '       g
   R V n        R # V P                  4       V n        V P                  '       d(   \	        RV P                  R,          ^,          : 24      hR # )NzExpected end of rule, got r¾   )rÓ   rÕ   rG   Ú	conditionrÂ   )rI   Ústrings   &&r   rM   Ú_Parser.__init__®  s`   € Ü# FÓ+ˆŒØ�{�{ˆ{ð ˆDŒHÙØ—>‘>Ó#ˆŒØ�;�;ˆ;ÜÐ8¸¿¹ÀR½ÈÕ9KÑ8NÐOÓPÐPñ r   Nc                	ó  € \        V P                  W4      pVe   V# Vf"   \        VR J ;'       d    T;'       g    T4      pV P                  '       g   \        RV R24      h\        RV RV P                  R,          ^,          : 24      h)Nz	expected z but end of rule reachedz	 but got r¾   )rß   rÕ   ÚreprrÂ   )rI   rÖ   rÄ   ÚtermÚtokens   &&&& r   ÚexpectÚ_Parser.expect¹  s„   € Ü˜4Ÿ;™;¨Ó5ˆØÒØˆLØŠ<Ü˜ ˜×/Ð/¨%×8Ð8°5Ó9ˆDØ�{�{ˆ{Ü˜i¨ vÐ-EÐFÓGÐGÜ˜) D 6¨°4·;±;¸rµ?À1Õ3EÑ2HÐIÓJÐJr   c                	óŠ   € V P                  4       p\        V P                  R R4      '       d   RWP                  4       33pK2  V# )rÃ   Úor)Úand_conditionrß   rÕ   ©rI   Úops   & r   rò   Ú_Parser.conditionÃ  s>   € Ø×ÑÓ!ˆÜ˜Ÿ™ f¨d×3Ò3Ø˜×.Ñ.Ó0Ð1Ð1ŠBØˆ	r   c                	óŠ   € V P                  4       p\        V P                  R R4      '       d   RWP                  4       33pK2  V# )rÃ   Úand)Úrelationrß   rÕ   rþ   s   & r   rý   Ú_Parser.and_conditionÉ  s8   € Ø�]‰]‹_ˆÜ˜Ÿ™ f¨e×4Ò4Ø˜Ÿ]™]›_Ð-Ð-ŠBØˆ	r   c                	ó  € V P                  4       p\        V P                  R R4      '       d=   \        V P                  R R4      ;'       d    R;'       g    RWP                  4       33# \        V P                  R R4      pRp\        V P                  R R4      '       d   RpMA\        V P                  R R4      '       g%   V'       d   \	        R4      hV P                  V4      # RW1V P                  4       33pV'       d   \        V4      # T# )rÃ   Úisrî   ÚisnotÚinÚwithinz#Cannot negate operator based rules.r  )rL   rß   rÕ   rÄ   rÂ   Únewfangled_relationr®   rï   )rI   ÚleftÚnegatedÚmethodrÀ   s   &    r   r  Ú_Parser.relationÏ  sß   € Ø�y‰y‹{ˆÜ�d—k‘k 6¨4×0Ò0Ü˜dŸk™k¨6°5Ó9×EÐE¸g×MÐMÈØ—z‘z“|Ð$ð%ð %ä˜TŸ[™[¨&°%Ó8ˆØˆÜ�d—k‘k 6¨8×4Ò4Ø‰Fä˜dŸk™k¨6°4×8Ò8ßÜ#Ð$IÓJÐJØ×/Ñ/°Ó5Ð5Ø˜&¨¯©Ó(9Ð:Ð:ˆß$Œv�b‹zÐ,¨"Ð,r   c                	óê   € \        V P                  R R4      '       d   RpM+\        V P                  R R4      '       d   RpM\        R4      hRRWP                  4       33pV'       d   \	        V4      # T# )rÅ   Ú=Fz!=Tz'Expected "=" or "!=" or legacy relationr  r  )rß   rÕ   rÂ   r®   rï   )rI   r  r  rÀ   s   &&  r   r
  Ú_Parser.newfangled_relationà  se   € Ü�d—k‘k 8¨S×1Ò1Ø‰GÜ˜Ÿ™ X¨t×4Ò4Ø‰GäÐEÓFÐFØ˜$ §o¡oÓ&7Ð8Ð8ˆß$Œv�b‹zÐ,¨"Ð,r   c                	ó‚   € V P                  4       p\        V P                  R 4      '       d   WP                  4       3# W3# )rÆ   )rÄ   rß   rÕ   )rI   r  s   & r   Úrange_or_valueÚ_Parser.range_or_valueê  s5   € Ø�z‰z‹|ˆÜ�d—k‘k :×.Ò.ØŸ™›Ð%Ð%à�:Ðr   c                	ó¶   € V P                  4       .p\        V P                  R R4      '       d"   VP                  V P                  4       4       K>  \	        V4      # )rÅ   Ú,)r  rß   rÕ   rH   rë   )rI   r®   s   & r   r®   Ú_Parser.range_listñ  sH   € Ø×)Ñ)Ó+Ð,ˆ
Ü˜Ÿ™ h°×4Ò4Ø×Ñ˜d×1Ñ1Ó3Ö4Ü˜zÓ*Ð*r   c                	ód  € \        V P                  R 4      pVe   V^,          \        9  d   \        R4      hV^,          p\        V P                  R R4      '       d   RVR3V P	                  4       33# \        V P                  RR4      '       d   RVR3V P	                  4       33# \        V4      # )rÃ   zExpected identifier variableÚmodrÅ   Ú%r   )rß   rÕ   Ú_VARSrÂ   rÄ   rç   )rI   rÃ   rå   s   &  r   rL   Ú_Parser.expr÷  sœ   € Ü˜$Ÿ+™+ vÓ.ˆØŠ<˜4 �7¬%Ô/ÜÐ:Ó;Ð;Ø�A�wˆÜ�d—k‘k 6¨5×1Ò1Ø˜D "˜: t§z¡z£|Ð4Ð4Ð4Ü˜Ÿ™ X¨s×3Ò3Ø˜D "˜: t§z¡z£|Ð4Ð4Ð4Ü˜$ÓÐr   c                	óV   € \        \        V P                  R 4      ^,          4      4      # râ   )rã   r   rù   rm   s   &r   rÄ   Ú_Parser.value  s    € Üœ#˜dŸk™k¨'Ó2°1Õ5Ó6Ó7Ð7r   )rG   rÕ   )NN)rV   r�   r‚   rƒ   r„   rM   rù   rò   rý   r  r
  r  r®   rL   rÄ   rˆ   r   r   r   rF   rF   Œ  s<   † ñòB	QôKòòò-ò"-òò+ò	 ö8r   rF   c                ó   a € V 3R l# )ú%Compiler factory for the `_Compiler`.c                óV   <€ SV P                  V4      V P                  V4      3,          # r   ©rd   )rI   r  ÚrightÚtmpls   &&&€r   Ú<lambda>Ú"_binary_compiler.<locals>.<lambda>  s!   ø€  T¨T¯\©\¸$Ó-?ÀÇÁÈeÓATÐ,UÖ%Ur   r   ©r$  s   fr   Ú_binary_compilerr(    s	   ø€ äUÐUr   c                ó   a € V 3R l# )r   c                ó4   <€ SV P                  V4      ,          # r   r"  )rI   Úxr$  s   &&€r   r%  Ú!_unary_compiler.<locals>.<lambda>  s   ø€ ˜4 $§,¡,¨q£/Ö1r   r   r'  s   fr   Ú_unary_compilerr-    s	   ø€ ä1Ð1r   c                ó   € R # )r   r   ©r+  s   &r   r%  r%    s   € ™r   c                  ó¼   € ] tR tRtRtR tR tR tR tR t	R t
R	 tR
 tR tR t]! R4      t]! R4      t]! R4      t]! R4      t]! R4      t]! R4      tR tRtR# )Ú	_Compileri  zRThe compilers are able to transform the expressions into multiple
output formats.
c                	ó0   € Vw  r#\        V R V 24      ! V!  # )Úcompile_)Úgetattr)rI   Úargrÿ   rX   s   &&  r   rd   Ú_Compiler.compile  s!   € Ø‰ˆÜ�t˜x¨ t˜_Ô-¨tÑ4Ð4r   c                	ó   € R # )r*   r   r/  s   &r   r%  Ú_Compiler.<lambda>  ó   € ™#r   c                	ó   € R # )r+   r   r/  s   &r   r%  r8    r9  r   c                	ó   € R # )r1   r   r/  s   &r   r%  r8    r9  r   c                	ó   € R # )r2   r   r/  s   &r   r%  r8    r9  r   c                	ó   € R # )r3   r   r/  s   &r   r%  r8     r9  r   c                	ó   € R # )r4   r   r/  s   &r   r%  r8  !  r9  r   c                	ó   € R # )r5   r   r/  s   &r   r%  r8  "  r9  r   c                	ó   € R # )r6   r   r/  s   &r   r%  r8  #  r9  r   c                	ó   € \        V4      # r   r   )r+  r1   s   &&r   r%  r8  $  s   € ¤ Q¤r   z
(%s && %s)z
(%s || %s)z(!%s)z
(%s %% %s)z
(%s == %s)z
(%s != %s)c                	ó   € \        4       hr   )ÚNotImplementedError)rI   r  rL   r®   s   &&&&r   Úcompile_relationÚ_Compiler.compile_relation,  s   € Ü!Ó#Ð#r   r   N)rV   r�   r‚   rƒ   r„   rd   Ú	compile_nÚ	compile_iÚ	compile_vÚ	compile_wÚ	compile_fÚ	compile_tÚ	compile_cÚ	compile_eÚcompile_valuer(  Úcompile_andÚ
compile_orr-  Úcompile_notÚcompile_modÚ
compile_isÚcompile_isnotrD  rˆ   r   r   r   r1  r1    s|   † ñò5ñ €IÙ€IÙ€IÙ€IÙ€IÙ€IÙ€IÙ€IÙ'€MÙ" <Ó0€KÙ! ,Ó/€JÙ! 'Ó*€KÙ" <Ó0€KÙ! ,Ó/€JÙ$ \Ó2€Mö$r   r1  c                  ó`   € ] tR tRtRt]! R4      t]! R4      t]! R4      t	]! R4      t
R tRtR	# )
rŸ   i0  z!Compiles an expression to Python.z(%s and %s)z
(%s or %s)z(not %s)zMOD(%s, %s)c                	ó   € R P                  V^,           UUu. uF,  w  rERV P                  V4       RV P                  V4       R2NK.  	  upp4      pVP                  4        RV P                  V4       RV R2# u uppi )r  Ú(rQ   Ú)z, [z]))r'   rd   Úupper)rI   r  rL   r®   r»   r¼   Úrangess   &&&&   r   rD  Ú _PythonCompiler.compile_relation8  s{   € Ø—‘ÐS]Ð^_ÖS`ÔaÑS`ÉÈ!˜Q˜tŸ|™|¨A›Ð/¨r°$·,±,¸q³/Ð1BÀ!ÓDÑS`ÒaÓbˆØ—,‘,“.Ð!  4§<¡<°Ó#5Ð"6°c¸&¸ÀÐDÐDùó bs   ˜2A:
r   N)rV   r�   r‚   rƒ   r„   r(  rO  rP  r-  rQ  rR  rD  rˆ   r   r   r   rŸ   rŸ   0  s3   † Ù+á" =Ó1€KÙ! ,Ó/€JÙ! *Ó-€KÙ" =Ó1€KöEr   rŸ   c                  óH   € ] tR tRtRt]P                  t]t	]t
]t]tR tRtR# )r¦   i=  z)Compile into a gettext plural expression.c                	óh  € . pV P                  V4      pV^,           F~  pV^ ,          V^,          8X  d1   VP                  RV RV P                  V^ ,          4       R24       KH  \        V P                   V4      w  rgVP                  RV RV RV RV R2	4       K€  	  RRP                  V4       R2# )rÙ   rW  z == rX  z >= ú && z <= z || )rd   rH   Úmapr'   )rI   r  rL   r®   rÀ   ÚitemÚminÚmaxs   &&&&    r   rD  Ú!_GettextCompiler.compile_relationF  s±   € ØˆØ�|‰|˜DÓ!ˆØ˜q—M�MˆDØ�A�w˜$˜q�'Ô!Ø—	‘	˜A˜d˜V 4¨¯©°T¸!µWÓ(=Ð'>¸aÐ@ÖAä˜tŸ|™|¨TÓ2‘�Ø—	‘	˜A˜d˜V 4¨ u¨D°°°d¸3¸%¸qÐAÖBñ "ð �6—;‘;˜r“?Ð# 1Ð%Ð%r   r   N)rV   r�   r‚   rƒ   r„   r1  rF  rG  Úcompile_zerorH  rI  rJ  rK  rD  rˆ   r   r   r   r¦   r¦   =  s)   † Ù3à×#Ñ#€IØ€IØ€IØ€IØ€Iö	&r   r¦   c                  ó6   € ] tR tRtRtR t]t]t]t	]t
R tRtR# )r�   iR  z/Compiles the expression to plain of JavaScript.c                	ó   € R # )zparseInt(n, 10)r   r/  s   &r   r%  Ú_JavaScriptCompiler.<lambda>W  s   € Ñ+r   c                	óz   € \         P                  WW#4      pVR 8X  d   V P                  V4      pRV RV RV R2pV# )r  z
(parseInt(z	, 10) == r^  rX  )r¦   rD  rd   )rI   r  rL   r®   r£   s   &&&& r   rD  Ú$_JavaScriptCompiler.compile_relation]  sK   € Ü×0Ñ0Ø˜$ó,ˆà�TŒ>Ø—<‘< Ó%ˆDØ ˜v Y¨t¨f°D¸¸¸aÐ@ˆDØˆr   r   N)rV   r�   r‚   rƒ   r„   rG  rd  rH  rI  rJ  rK  rD  rˆ   r   r   r   r�   r�   R  s%   † Ù9ñ ,€IØ€IØ€IØ€IØ€Iör   r�   c                  óz   € ] tR tRtRt]! R4      t]! R4      t]! R4      t]! R4      t	]! R4      t
R tRR	 ltR
tR# )rc   if  z+Returns a unicode pluralization rule again.z%s is %sz%s is not %sz	%s and %sz%s or %sz	%s mod %sc                	ó4   € V P                   ! V^,          RR/ # )rÙ   r  T)rD  )rI   r  s   &&r   rQ  Ú_UnicodeCompiler.compile_nots  s   € Ø×$Ò$ h¨q¥kÐ@¸4Ñ@Ð@r   c           	     	óŽ  € . pV^,           Fƒ  pV^ ,          V^,          8X  d*   VP                  V P                  V^ ,          4      4       KA  VP                  V P                  V^ ,          4       RV P                  V^,          4       24       K…  	  V P                  V4       V'       d   RMR RV RRP                  V4       2# )rÙ   z..z notr   rS   r  )rH   rd   r'   )rI   r  rL   r®   r  rZ  r`  s   &&&&&  r   rD  Ú!_UnicodeCompiler.compile_relationv  sª   € ØˆØ˜q—M�MˆDØ�A�w˜$˜q�'Ô!Ø—‘˜dŸl™l¨4°­7Ó3Ö4à—‘ §¡¨d°1­gÓ!6Ð 7°r¸$¿,¹,ÀtÈAÅwÓ:OÐ9PÐQÖRñ	 "ð
 —,‘,˜tÓ$Ð%·¡f¸RÐ%@ÀÀ&ÀÈÈ3Ï8É8ÐTZÓK[ÐJ\Ð]Ð]r   r   N)F)rV   r�   r‚   rƒ   r„   r(  rS  rT  rO  rP  rR  rQ  rD  rˆ   r   r   r   rc   rc   f  sK   † Ù5ñ " *Ó-€JÙ$ ^Ó4€MÙ" ;Ó/€KÙ! *Ó-€JÙ" ;Ó/€KòA÷^ð ^r   rc   )ÚzeroÚoneÚtwoÚfewÚmanyr   >   r5   r6   r3   r+   r*   r4   r1   r2   r   )/Ú__conditional_annotations__r„   Ú
__future__r   r"   ÚreÚcollections.abcr   r   Útypingr   r   r   rC   r�   r7   r9   r“   r~   rª   rœ   r�   rž   Ú	ExceptionrÂ   r  rd   ÚUNICODEr'   rÇ   Ú__annotations__rÓ   rÛ   rß   rã   rç   rë   rï   rF   r(  r-  rd  r1  rŸ   r¦   r�   rc   )rt  s   @r   Ú<module>r|     sw  øðôõ #ã Û 	ß -ß )Ñ )à=€Ø€õ8"÷vZñ Zõzõ.%!õPõ.Bõ(Aõ(ô.)�	ô )ò		€ð 
ˆ2�:Š:�f˜bŸj™jÓ)Ð*ØˆR�ZŠZÐ=¸b¿g¹gÀe»nÐ=MÈTÐRÓSÐTØˆb�jŠj˜Ó Ð!Øˆr�zŠz˜+Ó&Ð'Ø�—’Ð-¨r¯z©zÓ:Ð;ð4€Ð0ó õ÷$2÷õ
õõ$õ÷w8ñ w8òtVò
2ñ
 €÷$ñ $ô:
E�iô 
Eô&�yô &ô*Ð*ô ô(^�yö ^r   