+
    *: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^ ;rWWWW3# )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     ;?a3q66?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__%%JJL	  47!G)**34077;?;;ooc*MA  q!AIAqQ!!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 1PT 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# )zInitialize 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     eW%%KKME/1IC,& <w!788 4wn!=>>IIcN$-##Cs$$cZ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    

yyLYLSSXL0SEEJ<0L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      # )zCreate 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      eZ((L5z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=xsXc]"=AAAs   ;c                   V ^8  d   QhRR/# )r
   r   zfrozenset[str]r   )r   s   "r   r   r=      s     6 6n 6r   c                :    \        R V P                   4       4      # )zA 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     5t}}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(    tW%%"4DJzz!}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wc23 4
MM(]*+776?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 	nS12*SXLIJ 4 MMH]-./499V$h7D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HJ#i.)45FMM#s:c?*;3?@ "
MMZ./r23776? 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#     @Zztts""d""Zs   %(TF)anyr   s   f&r   r   r     s.    " 3@Z@33@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# )zJavaish 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1u	R1u	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
)ICJJq&E iikMM3"67   QRSRXQ[\]]$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 2fRjmu, 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     ve,,zz| -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    UI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    8Or   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+{{{ DH>>#;;;8R9K8N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859D{{{iv-EFGG)D64;;r?13E2H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>    !fd33..011B	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    ]]_fe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    yy{dkk6400dkk659EEgMMzz|$% %T[[&%8dkk6844Fdkk6488#$IJJ//55&(9::$vbz,",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    dkk8S11GXt44GEFF$oo&788$vbz,",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    zz|dkk:..%%: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%/:;;Awdkk6511D":tzz|444Xs33D":tzz|444$r   c                	V    \        \        V P                  R 4      ^,          4      4      # r   )r   r   r   rm   s   &r   r   _Parser.value  s     #dkk'21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!    TT\\$-?eAT,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!    tx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"<0K!,/J!'*K"<0K!,/J$\2M$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`aS`!Qt||A/r$,,q/1B!DS`ab,,.!4<<#5"6c&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    +"=1K!,/J!*-K"=1K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!qMMDAw$q'!		AdV4T!W(='>a@At||T2		AdV4uDd3%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vYtfD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    $$hqk@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    qMMDAw$q'!dll4734d1g!6 7r$,,tAw:O9PQR	 "
 ,,t$%fR%@&388TZK[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$^4M";/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::fbjj)*RZZ=bggen=MTRSTbjj !rzz+&'-rzz:;40 $2
$w8 w8tV
2
 $ $:
Ei 
E&y &** (^y ^r   