
    MhHZ              	         U d Z ddlmZ ddlZddlZddlmZmZ ddlm	Z	m
Z
mZ dZdZdTdZ G d d          ZdUdZdVdZdUdZdWdZdWdZdXdZ G d  d!e          Zh d"Zd ej        d#ej                  fd$ ej        d%d&                    e           d'          fd( ej        d)          fd* ej        d+          fd, ej        d-ej                  fgZd.ed/<   dYd2Z	 dZd[d7ZdZd\d8Z d]d;Z!d^d>Z"d_d@Z#d`dDZ$ G dE dF          Z%dG Z&dH Z'dI Z( G dJ dK          Z) G dL dMe)          Z* G dN dOe)          Z+ G dP dQe+          Z, G dR dSe)          Z-dS )az
    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)zeroonetwofewmanyotherr   sourcefloat | decimal.DecimalreturnMtuple[decimal.Decimal | int, int, int, int, int, int, Literal[0], Literal[0]]c                j   t          |           }t          |          }t          |t                    r*||k    r|}n!t	          j        t          |                    }t          |t          j                  r|                                }|j        }|dk     r|j	        |d         nd}d
                    d |D                       }|                    d          }t          |          }t          |          }	t          |pd          }
t          |pd          }ndx}x}	x}
}dx}}||||	|
|||fS )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]
    r   N  c              3  4   K   | ]}t          |          V  d S Nstr).0ds     L/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/babel/plural.py	<genexpr>z#extract_operands.<locals>.<genexpr>D   s(      ;;a3q66;;;;;;    0)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_operandsr9      s<   2 	FAAA!U (66AA A''A!W_%% JJLL	 47!GG)*3440077;;?;;;;;ooc**MMA q!!AAIAaAq!Q!!r   c                      e Zd ZdZdZddZdd	Zedd            Ze	dd            Z
e	dd            ZddZddZddZdS ) 
PluralRuleaf  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
    )abstract_funcrules-Mapping[str, str] | Iterable[tuple[str, str]]r   Nonec                   t          |t                    r|                                }t                      }g | _        t          |          D ]~\  }}|t          vrt          d|          ||v rt          d|d          |                    |           t          |          j
        }|r| j                            ||f           dS )a$  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setr<   sorted_plural_tags
ValueErroradd_Parserastappend)selfr>   foundkeyexprrI   s         r   __init__zPluralRule.__init__g   s     eW%% 	"KKMME/1 	1 	1IC,&& !7!7!7888 !=!=!=!=>>>IIcNNN$--#C 1$$c3Z000	1 	1r   r   c                    | j         d                    fdt          D                       }dt          |           j         d|dS )N, c                2    g | ]}|v | d |          S )z: r   )r   tagr>   s     r   
<listcomp>z'PluralRule.__repr__.<locals>.<listcomp>   s1    YYYSCSXLLS00E#J00LLLr   < >)r>   r)   rE   type__name__)rK   argsr>   s     @r   __repr__zPluralRule.__repr__}   sR    
yyYYYYLYYYZZ24::&222222r   :Mapping[str, str] | Iterable[tuple[str, str]] | PluralRulec                F    t          |t                    r|S  | |          S )a
  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"   r;   )clsr>   s     r   parsezPluralRule.parse   s)     eZ(( 	Ls5zzr   Mapping[str, str]c                P    t                      j        fd| j        D             S )zThe `PluralRule` as a dict of unicode plural rules.

        >>> rule = PluralRule({'one': 'n is 1'})
        >>> rule.rules
        {'one': 'n is 1'}
        c                .    i | ]\  }}| |          S r   r   )r   rS   rI   _compiles      r   
<dictcomp>z$PluralRule.rules.<locals>.<dictcomp>   s'    AAAxsCXXc]]AAAr   )_UnicodeCompilercompiler<   )rK   rc   s    @r   r>   zPluralRule.rules   s/     $%%-AAAA4=AAAAr   frozenset[str]c                >    t          d | j        D                       S )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  &   K   | ]}|d          V  dS )r   Nr   )r   r-   s     r   r   z"PluralRule.tags.<locals>.<genexpr>   s&      55!1555555r   )	frozensetr<   rK   s    r   tagszPluralRule.tags   s#     55t}555555r   list[tuple[str, Any]]c                    | j         S r   r<   rk   s    r   __getstate__zPluralRule.__getstate__   s
    }r   r<   c                    || _         d S r   ro   )rK   r<   s     r   __setstate__zPluralRule.__setstate__   s     r   r,   r   c                t    t          | d          st          |           | _        |                     |          S )Nr=   )hasattr	to_pythonr=   )rK   r,   s     r   __call__zPluralRule.__call__   s1    tW%% 	)"4DJzz!}}r   N)r>   r?   r   r@   )r   r   )r>   r\   r   r;   )r   r`   )r   rg   )r   rm   )r<   rm   r   r@   )r,   r   r   r   )rY   
__module____qualname____doc__	__slots__rO   r[   classmethodr_   propertyr>   rl   rp   rr   rv   r   r   r   r;   r;   P   s         ( &I1 1 1 1,3 3 3 3
 	 	 	 [	 B B B XB 6 6 6 X6   ! ! ! !     r   r;   ruler\   r   c                $   t                      j        }dg}t                              |           j        D ])\  }}|                     ||           d|d           *|                    dt          z             d                    |          S )a  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   )_JavaScriptCompilerrf   r;   r_   r<   rJ   _fallback_tagr)   )r}   to_jsresultrS   rI   s        r   to_javascriptr      s      !!)E&'F$$T**3 4 4Ss222223333
MM(]*+++776??r   (Callable[[float | decimal.Decimal], str]c           	        t           t          t          t          d}t	                      j        }ddg}t                              |           j        D ]6\  }}|	                    d ||           dt          |                     7|	                    dt                     t          d                    |          dd	          }t          ||           |d
         S )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MODr9   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_modulor9   _PythonCompilerrf   r;   r_   r<   rJ   r   r   r)   eval)r}   	namespaceto_python_funcr   rS   rI   codes          r   ru   ru      s    ( #,	 I %&&.N7F $$T**3 K KS 	InnS11IISXXIIJJJJ
MM.]..///499V$$h77DyZ  r   c                   t                               |           } | j        t          hz  t	                      j        }fdt          D             j        }dt                     dg}| j	        D ]2\  }}|
                     ||           d ||           d           3|
                     |t                     d           d                    |          S )a  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
    c                    g | ]}|v |	S r   r   )r   rS   	used_tagss     r   rT   zto_gettext.<locals>.<listcomp>   s#    BBB#	1A1A#1A1A1Ar   z	nplurals=z
; plural=(r   r   z);r   )r;   r_   rl   r   _GettextCompilerrf   rE   indexr+   r<   rJ   r)   )r}   rc   
_get_indexr   rS   rI   r   s         @r   
to_gettextr      s     D!!D	]O+I!!)HBBBBBBBHJ4#i..4445FM A AS#??::c?????@@@@
MMZZ..222333776??r   num
range_list+Iterable[Iterable[float | decimal.Decimal]]boolc                H    | t          |           k    ot          | |          S )a  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0jAAAr   c                :     t           fd|D                       S )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  >   K   | ]\  }}|cxk    o|k    nc V  d S r   r   )r   min_max_r   s      r   r   z$within_range_list.<locals>.<genexpr>(  sC      @@ztTts""""d""""@@@@@@r   )anyr   s   ` r   r   r     s(    " @@@@Z@@@@@@r   ar#   bc                R    d}| dk     r| dz  } d}|dk     r|dz  }| |z  }|r|dz  }|S )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   r   reverservs       r   r   r   +  sQ     G1uu	R1uu	R	
QB 
bIr   c                      e Zd ZdZdS )	RuleErrorzRaised if a rule is malformed.N)rY   rw   rx   ry   r   r   r   r   r   B  s        ((((r   r   >   r7   r8   r5   r-   r,   r6   r3   r4   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]]]_RULESslist[tuple[str, str]]c                   |                      d          d         } g }d}t          |           }||k     rt          D ]^\  }}|                    | |          }|A|                                }|r)|                    ||                                f            n_t          d| |                   ||k     |d d d         S )N@r   z3malformed CLDR pluralization rule.  Got unexpected r   )splitr+   r   matchendrJ   groupr   )r   r   posr   tokr}   r   s          r   tokenize_ruler   Z  s    	QA$&F
C
a&&C
)) 	^ 	^ICJJq#&&E iikk 8MM3"6777	 ! \RSTWRX\\]]] )) $$B$<r   tokenstype_
str | Nonelist[tuple[str, str]] | boolc                V    | o'| d         d         |k    o|d u p| d         d         |k    S )Nr   r   r   r   r   r   r   s      r   test_next_tokenr   l  s>    
  2fRjmu, 2	$	0&*Q-502r   c                P    t          | ||          r|                                 S d S r   )r   popr   s      r   
skip_tokenr   u  s.    vue,, zz|| r   r!   #tuple[Literal['value'], tuple[int]]c                    d| ffS )Nr   r   )r   s    r   
value_noder   z  s    UIr   nametuple[str, tuple[()]]c                
    | dfS )Nr   r   )r   s    r   
ident_noder   ~  s    8Or   Ituple[Literal['range_list'], Iterable[Iterable[float | decimal.Decimal]]]c                
    d| fS )Nr   r   )r   s    r   range_list_noder     s     ##r   r   tuple[Any, ...]-tuple[Literal['not'], tuple[tuple[Any, ...]]]c                    d| ffS )Nnotr   )r   s    r   negater     s    2%<r   c                  P    e Zd ZdZd ZddZd Zd Zd Zd Z	d	 Z
d
 Zd Zd ZdS )rH   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                    t          |          | _        | j        s	d | _        d S |                                 | _        | j        r#t	          d| j        d         d                   d S )NzExpected end of rule, got r   r   )r   r   rI   	conditionr   )rK   strings     r   rO   z_Parser.__init__  ss    #F++{ 	 DHF>>##; 	QOR9KOOPPP	Q 	Qr   Nc                    t          | j        ||          }||S |t          |d u r|p|          }| j        st          d| d          t          d| d| j        d         d                   )Nz	expected z but end of rule reachedz	 but got r   r   )r   r   reprr   )rK   r   r   termtokens        r   expectz_Parser.expect  s    4;u55L</%8599D{ 	HFFFFGGGIDII4;r?13EIIJJJr   c                    |                                  }t          | j        dd          r.d||                                  ff}t          | j        dd          .|S )Nr   or)and_conditionr   r   rK   ops     r   r   z_Parser.condition  sa    !!fd33 	2D..0011B fd33 	2	r   c                    |                                  }t          | j        dd          r.d||                                  ff}t          | j        dd          .|S )Nr   and)relationr   r   r   s     r   r   z_Parser.and_condition  sY    ]]__fe44 	.T]]__--B fe44 	.	r   c                   |                                  }t          | j        dd          r0t          | j        dd          rdpd||                                 ffS t          | j        dd          }d}t          | j        dd          rd}n<t          | j        dd          s&|rt	          d          |                     |          S d|||                                 ff}|rt          |          n|S )	Nr   isr   isnotinwithinz#Cannot negate operator based rules.r   )rN   r   r   r   r   newfangled_relationr   r   )rK   leftnegatedmethodr   s        r   r   z_Parser.relation  s   yy{{dk6400 	%dk6599EgMtzz||$% %T[&%88dk6844 	6FFdk6488 6 K#$IJJJ//555&$(9(9::$,vbzzz",r   c                    t          | j        dd          rd}n(t          | j        dd          rd}nt          d          dd||                                 ff}|rt	          |          n|S )	Nr   =Fz!=Tz'Expected "=" or "!=" or legacy relationr   r   )r   r   r   r   r   )rK   r   r   r   s       r   r   z_Parser.newfangled_relation  s}    dk8S11 	GGGXt44 	GGGEFFF$doo&7&788$,vbzzz",r   c                    |                                  }t          | j        d          r||                                  fS ||fS )Nr   )r   r   r   )rK   r   s     r   range_or_valuez_Parser.range_or_value  s@    zz||dk:.. 	%%:r   c                    |                                  g}t          | j        dd          r=|                    |                                             t          | j        dd          =t	          |          S )Nr   ,)r   r   r   rJ   r   )rK   r   s     r   r   z_Parser.range_list  sr    ))++,
h44 	5d1133444 h44 	5z***r   c                Z   t          | j        d          }||d         t          vrt          d          |d         }t          | j        dd          rd|df|                                 ffS t          | j        dd          rd|df|                                 ffS t          |          S )Nr   r   zExpected identifier variablemodr   r   %)r   r   _VARSr   r   r   )rK   r   r   s      r   rN   z_Parser.expr  s    $+v..<47%//:;;;Awdk6511 	5D":tzz||444Xs33 	5D":tzz||444$r   c                l    t          t          |                     d          d                             S )Nr   r   )r   r!   r   rk   s    r   r   z_Parser.value  s)    #dkk'221566777r   )NN)rY   rw   rx   ry   rO   r   r   r   r   r   r   r   rN   r   r   r   r   rH   rH     s         B	Q 	Q 	QK K K K    - - -"- - -  + + +	  	  	 8 8 8 8 8r   rH   c                      fdS )%Compiler factory for the `_Compiler`.c                ^    |                      |          |                      |          fz  S r   rf   )rK   r   righttmpls      r   <lambda>z"_binary_compiler.<locals>.<lambda>  s)    TT\\$-?-?eATAT,U%U r   r   r  s   `r   _binary_compilerr    s    UUUUUr   c                      fdS )r   c                4    |                      |          z  S r   r  )rK   xr  s     r   r  z!_unary_compiler.<locals>.<lambda>  s    4$,,q//1 r   r   r  s   `r   _unary_compilerr    s    11111r   c                    dS )Nr   r   r
  s    r   r  r    s     r   c                      e Zd ZdZd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
 Zd Z ed          Z ed          Z ed          Z ed          Z ed          Z ed          Zd ZdS )	_CompilerzZThe compilers are able to transform the expressions into multiple
    output formats.
    c                8    |\  }} t          | d|           | S )Ncompile_)getattr)rK   argr   rZ   s       r   rf   z_Compiler.compile  s(    D-wt___--t44r   c                    dS )Nr,   r   r  s    r   r  z_Compiler.<lambda>      # r   c                    dS )Nr-   r   r  s    r   r  z_Compiler.<lambda>  r  r   c                    dS )Nr3   r   r  s    r   r  z_Compiler.<lambda>  r  r   c                    dS )Nr4   r   r  s    r   r  z_Compiler.<lambda>  r  r   c                    dS )Nr5   r   r  s    r   r  z_Compiler.<lambda>   r  r   c                    dS )Nr6   r   r  s    r   r  z_Compiler.<lambda>!  r  r   c                    dS )Nr7   r   r  s    r   r  z_Compiler.<lambda>"  r  r   c                    dS )Nr8   r   r  s    r   r  z_Compiler.<lambda>#  r  r   c                     t          |          S r   r   )r
  r3   s     r   r  z_Compiler.<lambda>$  s    Q r   z
(%s && %s)z
(%s || %s)z(!%s)z
(%s %% %s)z
(%s == %s)z
(%s != %s)c                    t                      r   )NotImplementedError)rK   r   rN   r   s       r   compile_relationz_Compiler.compile_relation,  s    !###r   N)rY   rw   rx   ry   rf   	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_isnotr   r   r   r   r  r    s         5 5 5 IIIIIIII''M""<00K!!,//J!/'**K""<00K!!,//J$$\22M$ $ $ $ $r   r  c                  p    e Zd ZdZ ed          Z ed          Z ed          Z ed          Z	d Z
dS )r   z!Compiles an expression to Python.z(%s and %s)z
(%s or %s)z(not %s)zMOD(%s, %s)c                     d                      fd|d         D                       }|                                 d                     |           d| dS )Nr   c                t    g | ]4\  }}d                      |           d                     |           d5S )(rQ   )r  )r   r   r   rK   s      r   rT   z4_PythonCompiler.compile_relation.<locals>.<listcomp>9  sE    aaa!QDt||ADD$,,q//DDDaaar   r   r3  z, [z]))r)   upperrf   )rK   r   rN   r   rangess   `    r   r   z _PythonCompiler.compile_relation8  sc    aaaaS]^_S`aaabb,,..DD4<<#5#5DD&DDDDr   N)rY   rw   rx   ry   r  r*  r+  r  r,  r-  r   r   r   r   r   r   0  sm        ++""=11K!!,//J!/*--K""=11KE E E E Er   r   c                  6    e Zd ZdZej        ZeZeZ	eZ
eZd ZdS )r   z)Compile into a gettext plural expression.c                |   g }|                      |          }|d         D ]}|d         |d         k    r6|                    d| d|                      |d                    d           Jt          | j         |          \  }}|                    d| d| d| d| d	           dd	                    |           dS )
Nr   r   r3  z == r4  z >=  && z <= z || )rf   rJ   mapr)   )rK   r   rN   r   r   itemminmaxs           r   r   z!_GettextCompiler.compile_relationF  s    ||D!!qM 	C 	CDAw$q'!!		@d@@T!W(=(=@@@AAAAt|T22S		AdAAAAAA3AAABBBB%6;;r??%%%%r   N)rY   rw   rx   ry   r  r!  r"  compile_zeror#  r$  r%  r&  r   r   r   r   r   r   =  sE        33#IIIII	& 	& 	& 	& 	&r   r   c                  .    e Zd ZdZd ZeZeZeZeZ	d Z
dS )r   z/Compiles the expression to plain of JavaScript.c                    dS )NzparseInt(n, 10)r   r  s    r   r  z_JavaScriptCompiler.<lambda>W  s    + r   c                    t                               | |||          }|dk    r!|                     |          }d| d| d| d}|S )Nr   z
(parseInt(z	, 10) == r9  r4  )r   r   rf   )rK   r   rN   r   r   s        r   r   z$_JavaScriptCompiler.compile_relation]  s_    00&$
, ,T>><<%%D@@@t@@@@@Dr   N)rY   rw   rx   ry   r"  r>  r#  r$  r%  r&  r   r   r   r   r   r   R  sG        99 ,+IIIII    r   r   c                      e Zd ZdZ ed          Z ed          Z ed          Z ed          Z ed          Z	d Z
dd	Zd
S )re   z+Returns a unicode pluralization rule again.z%s is %sz%s is not %sz	%s and %sz%s or %sz	%s mod %sc                (     | j         |d         ddiS )Nr   r   T)r   )rK   r   s     r   r,  z_UnicodeCompiler.compile_nots  s    $t$hqk@4@@@r   Fc           	        g }|d         D ]}|d         |d         k    r/|                     |                     |d                              C|                     |                     |d                    d|                     |d                               |                     |           |rdnd d| dd                    |           S )Nr   r   z..z notr   rV   r   )rJ   rf   r)   )rK   r   rN   r   r   r6  r;  s          r   r   z!_UnicodeCompiler.compile_relationv  s    qM 	S 	SDAw$q'!!dll47334444d1g!6!6QQ$,,tAw:O:OQQRRRR,,t$$]&?ffR]]&]]388TZK[K[]]]r   N)F)rY   rw   rx   ry   r  r.  r/  r*  r+  r-  r,  r   r   r   r   re   re   f  s        55 "!*--J$$^44M"";//K!!*--J"";//KA A A^ ^ ^ ^ ^ ^r   re   )r   r   r   r   )r}   r\   r   r   )r}   r\   r   r   )r   r   r   r   r   r   )r   r#   r   r#   r   r#   )r   r   r   r   r   )r   r   r   r   r   r   r   r   )r   r   r   r   r   r   )r   r!   r   r   )r   r   r   r   )r   r   r   r   )r   r   r   r   ).ry   
__future__r   r$   recollections.abcr   r   typingr   r   r   rE   r   r9   r;   r   ru   r   r   r   r   	Exceptionr   r   rf   UNICODEr)   r   __annotations__r   r   r   r   r   r   r   rH   r  r  r>  r  r   r   r   re   r   r   r   <module>rL     s     # " " " " "  				 - - - - - - - - ) ) ) ) ) ) ) ) ) )=8" 8" 8" 8"vZ Z Z Z Z Z Z Zz   .%! %! %! %!P   .B B B B(A A A A(   .) ) ) ) )	 ) ) )		 		 		 
:2:fbj))*ZRZRbggennRRRSSTjbj  !zrz+&&'-rz::;4       * 2 2 2 2 2    
      $ $ $ $   w8 w8 w8 w8 w8 w8 w8 w8tV V V
2 2 2
 }$ $ $ $ $ $ $ $:
E 
E 
E 
E 
Ei 
E 
E 
E& & & & &y & & &*    *   (^ ^ ^ ^ ^y ^ ^ ^ ^ ^r   