§
    ÆªbQV  ã            	       ób  — d Z ddlZddlZdZdZd„ Z G d„ d¦  «        Zd„ Zd	„ Zd
„ Z	d„ Z
d„ Zd„ 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„ Zd2d„Zd2d„Zd„ Zd „ Zd!„ Zd"„ Z G d#„ d$¦  «        Zd%„ Zd&„ Zd'„ Z G d(„ d)¦  «        Z G d*„ d+e¦  «        Z  G d,„ d-e¦  «        Z! G d.„ d/e!¦  «        Z" G d0„ d1e¦  «        Z#dS )3z°
    babel.numbers
    ~~~~~~~~~~~~~

    CLDR Plural support.  See UTS #35.

    :copyright: (c) 2013-2022 by the Babel Team.
    :license: BSD, see LICENSE for more details.
é    N)ÚzeroÚoneÚtwoÚfewÚmanyÚotherr   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 a 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     ú./usr/lib/python3/dist-packages/babel/plural.pyú	<genexpr>z#extract_operands.<locals>.<genexpr>A   s(   è è € Ð;Ð; a�3˜q™6œ6Ð;Ð;Ð;Ð;Ð;Ð;ó    Ú0)ÚabsÚintÚ
isinstanceÚfloatÚdecimalÚDecimalr   Úas_tupleÚexponentÚdigitsÚjoinÚrstripÚlen)ÚsourceÚnÚiÚ	dec_tupleÚexpÚfraction_digitsÚtrailingÚno_trailingÚvÚwÚfÚtÚcÚes                 r   Úextract_operandsr0      s<  € õ2 	ˆF‰Œ€AÝˆA‰Œ€AÝ�!•UÑÔð (Ø�Š6ˆ6ØˆAˆAõ ”¥ A¡¤Ñ'Ô'ˆAå�!•W”_Ñ%Ô%ð Ø—J’J‘L”Lˆ	ØÔ ˆØ47¸!²G°G˜)Ô*¨3¨4¨4Ô0Ð0ÀˆØ—7’7Ð;Ð;¨?Ð;Ñ;Ô;Ñ;Ô;ˆØ—o’o cÑ*Ô*ˆÝ�‰MŒMˆÝ�ÑÔˆÝ��˜AÑÔˆÝ�Ð ˜qÑ!Ô!ˆˆàÐˆÐˆAÐ��AØ€I€AˆØˆa��A�q˜!˜Q Ð!Ð!r   c                   ó|   — e Zd ZdZdZd„ Zd„ Zed„ ¦   «         Ze	d„ ¦   «         Z
 e	d„ d¬	¦  «        Zd
„ Zd„ Z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Ú_funcc                 ó¶  — t          |t          ¦  «        r|                     ¦   «         }t          ¦   «         }g | _        t          t          |¦  «        ¦  «        D ]}\  }}|t          vrt          d|z  ¦  «        ‚||v rt          d|z  ¦  «        ‚| 	                    |¦  «         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 %rztag %r defined twiceN)r   ÚdictÚitemsÚsetr3   ÚsortedÚlistÚ_plural_tagsÚ
ValueErrorÚaddÚ_ParserÚastÚappend)ÚselfÚrulesÚfoundÚkeyÚexprr?   s         r   Ú__init__zPluralRule.__init__d   sÚ   € õ �e�TÑ"Ô"ð 	"Ø—K’K‘M”MˆEÝ‘”ˆØˆŒÝ¥ U¡¤Ñ,Ô,ð 	1ð 	1‰IˆC�Ø�,Ð&Ð&Ý Ð!1°CÑ!7Ñ8Ô8Ð8Ø˜��Ý Ð!7¸#Ñ!=Ñ>Ô>Ð>Ø�IŠI�c‰NŒNˆNÝ˜$‘-”-Ô#ˆCØð 1Ø”×$Ò$ c¨3 ZÑ0Ô0Ð0øð	1ð 	1r   c                 ó�   ‡— | j         Šdt          | ¦  «        j        ›dd                     ˆfd„t          D ¦   «         ¦  «        ›d�S )Nú<ú ú, c                 ó2   •— g | ]}|‰v ¯|›d ‰|         ›�‘ŒS )z: r
   )r   ÚtagrB   s     €r   ú
<listcomp>z'PluralRule.__repr__.<locals>.<listcomp>~   s8   ø€ ð (ð (ð (¸Ø ˜,˜,ð $' 3 3¨¨c¬
¨
Ð3Ø&˜,˜,r   ú>)rB   ÚtypeÚ__name__r   r;   )rA   rB   s    @r   Ú__repr__zPluralRule.__repr__z   sh   ø€ Ø”
ˆˆå�‰JŒJÔÐÐØ�IŠIð (ð (ð (ð (½|ð (ñ (ô (ñ )ô )ð )ð )ð
ð 	
r   c                 ó<   — 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   )ÚclsrB   s     r   ÚparsezPluralRule.parse‚   s)   € õ �e˜SÑ!Ô!ð 	ØˆLØˆs�5‰zŒzÐr   c                 óP   ‡— t          ¦   «         j        Šˆfd„| j        D ¦   «         S )zŸThe `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   rL   r?   Ú_compiles      €r   ú
<dictcomp>z$PluralRule.rules.<locals>.<dictcomp>—   s'   ø€ ÐAÐAÐA¡x s¨C��X�X˜c‘]”]ÐAÐAÐAr   )Ú_UnicodeCompilerÚcompiler3   )rA   rW   s    @r   rB   zPluralRule.rulesŽ   s/   ø€ õ $Ñ%Ô%Ô-ˆØAÐAÐAÐA°4´=ÐAÑAÔAÐAr   c                 ó>   — t          d„ | j        D ¦   «         ¦  «        S )Nc              3   ó&   K  — | ]}|d          V — ŒdS )r   Nr
   )r   r$   s     r   r   z&PluralRule.<lambda>.<locals>.<genexpr>™   s&   è è € Ð'AÐ'A°¨¨!¬Ð'AÐ'AÐ'AÐ'AÐ'AÐ'Ar   )Ú	frozensetr3   ©Úxs    r   ú<lambda>zPluralRule.<lambda>™   s   € �iÐ'AÐ'A°a´jÐ'AÑ'AÔ'AÑAÔA€ r   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.)Údocc                 ó   — | j         S r   ©r3   ©rA   s    r   Ú__getstate__zPluralRule.__getstate__ž   s
   € ØŒ}Ðr   c                 ó   — || _         d S r   rc   )rA   r3   s     r   Ú__setstate__zPluralRule.__setstate__¡   s   € Ø ˆŒˆˆr   c                 ót   — t          | d¦  «        st          | ¦  «        | _        |                      |¦  «        S )Nr4   )ÚhasattrÚ	to_pythonr4   )rA   r#   s     r   Ú__call__zPluralRule.__call__¤   s1   € Ý�t˜WÑ%Ô%ð 	)Ý" 4™œˆDŒJØ�zŠz˜!‰}Œ}Ðr   N)rP   Ú
__module__Ú__qualname__Ú__doc__Ú	__slots__rF   rQ   ÚclassmethodrT   ÚpropertyrB   Útagsre   rg   rk   r
   r   r   r2   r2   M   sÍ   € € € € € ðð ð( &€Ið1ð 1ð 1ð,
ð 
ð 
ð ð	ð 	ñ „[ð	ð ðBð Bñ „XðBð ˆ8ÐAÐAð Hð ñ ô €Dð
ð ð ð!ð !ð !ðð ð ð ð r   r2   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 ? z : z%r; })r   )Ú_JavaScriptCompilerrZ   r2   rT   r3   r@   Ú_fallback_tagr   )ÚruleÚto_jsÚresultrL   r?   s        r   Úto_javascriptry   ª   s�   € õ  Ñ!Ô!Ô)€EØ&Ð'€FÝ×$Ò$ TÑ*Ô*Ô3ð 8ð 8‰ˆˆSØ�Š e e¨C¡j¤j j j°#°#°#Ð6Ñ7Ô7Ð7Ð7Ø
‡M‚M�(�]Ñ*Ñ+Ô+Ð+Ø�7Š7�6‰?Œ?Ðr   c           	      óÄ  — t           t          t          t          dœ}t	          ¦   «         j        }ddg}t                               | ¦  «        j        D ]6\  }}| 	                    d ||¦  «        ›dt          |¦  «        ›�¦  «         Œ7| 	                    dt          z  ¦  «         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ÚMODr0   zdef evaluate(n):z- n, i, v, w, f, t, c, e = extract_operands(n)z if (z
): return z
 return %rú
z<rule>ÚexecÚevaluate)Úin_range_listÚwithin_range_listÚcldr_modulor0   Ú_PythonCompilerrZ   r2   rT   r3   r@   r   ru   r   Úeval)rv   Ú	namespaceÚto_python_funcrx   rL   r?   Úcodes          r   rj   rj   Á   sæ   € õ( Ý#ÝÝ,ð	ð €Iõ %Ñ&Ô&Ô.€NàØ7ð€Fõ ×$Ò$ TÑ*Ô*Ô3ð Oð O‰ˆˆSð 	�Šˆ¨~¨~¸cÑ/BÔ/BÐ/BÐ/BÅCÈÁHÄHÀHÐMÑNÔNÐNÐNØ
‡M‚M�,¥Ñ.Ñ/Ô/Ð/Ý�4—9’9˜VÑ$Ô$ h°Ñ7Ô7€DÝˆˆyÑÔÐØ�ZÔ Ð r   c                 ó¼  ‡— t                                | ¦  «        } | j        t          hz  Št	          ¦   «         j        }ˆfd„t          D ¦   «         j        }dt          ‰¦  «        z  g}| j	        D ]1\  }}| 
                    d ||¦  «         ||¦  «        fz  ¦  «         Œ2| 
                    d |t          ¦  «        z  ¦  «         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   rL   Ú	used_tagss     €r   rM   zto_gettext.<locals>.<listcomp>÷   s#   ø€ ÐBÐBÐB˜#°¸	Ð1AÐ1A�#Ð1AÐ1AÐ1Ar   znplurals=%d; plural=(z
%s ? %d : z%d);r   )r2   rT   rr   ru   Ú_GettextCompilerrZ   r;   Úindexr!   r3   r@   r   )rv   rW   Ú
_get_indexrx   rL   r?   r‹   s         @r   Ú
to_gettextr�   é   sÚ   ø€ õ ×Ò˜DÑ!Ô!€Dà”	�]˜OÑ+€IÝÑ!Ô!Ô)€HØBÐBÐBÐB¥ÐBÑBÔBÔH€Jà%­¨I©¬Ñ6Ð7€FØ”Mð Gð G‰ˆˆSØ�Š�l h h¨s¡m¤m°Z°ZÀ±_´_Ð%EÑEÑFÔFÐFÐFØ
‡M‚M�&˜:˜:¥mÑ4Ô4Ñ4Ñ5Ô5Ð5Ø�7Š7�6‰?Œ?Ðr   c                 ó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‚   ©ÚnumÚ
range_lists     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   ó6   •K  — | ]\  }}‰|k    o‰|k    V — Œd S r   r
   )r   Úmin_Úmax_r’   s      €r   r   z$within_range_list.<locals>.<genexpr>%  s4   øè è € ÐHÐH©z¨t°Tˆs�dŠ{Ð*˜s dš{ÐHÐHÐHÐHÐHÐHr   )Úanyr‘   s   ` r   r‚   r‚     s(   ø€ õ" ÐHÐHÐHÐH¸ZÐHÑHÔHÑHÔHÐHr   c                 óR   — d}| dk     r| dz  } d}|dk     r|dz  }| |z  }|r|dz  }|S )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
   )ÚaÚbÚreverseÚrvs       r   rƒ   rƒ   (  sQ   € ð €GØˆ1‚u€uØ	ˆR‰ˆØˆØˆ1‚u€uØ	ˆR‰ˆØ	
ˆQ‰€BØð Ø
ˆb‰ˆØ€Ir   c                   ó   — e Zd ZdZdS )Ú	RuleErrorzRaised if a rule is malformed.N)rP   rl   rm   rn   r
   r   r   r¡   r¡   ?  s   € € € € € Ø(Ð(Ð(Ð(r   r¡   >   r.   r/   r,   r$   r#   r-   r*   r+   z\s+Úwordz"\b(and|or|is|(?:with)?in|not|mod|[r   z])\bÚvaluez\d+Úsymbolz%|,|!=|=Úellipsisz\.{2,3}|\u2026c                 óˆ  — |                       d¦  «        d         } g }d}t          | ¦  «        }||k     r„t          D ]^\  }}|                     | |¦  «        }|�A|                     ¦   «         }|r)|                     ||                     ¦   «         f¦  «          nŒ_t          d| |         z  ¦  «        ‚||k     °„|d d d…         S )Nú@r   z5malformed CLDR pluralization rule.  Got unexpected %rrš   )Úsplitr!   Ú_RULESÚmatchÚendr@   Úgroupr¡   )Úsrx   Úposr«   Útokrv   rª   s          r   Útokenize_ruler°   V  sß   € Ø	�Š�‰Œ�QŒ€AØ€FØ
€CÝ
ˆa‰&Œ&€CØ
�Š)ˆ)Ýð 		:ð 		:‰IˆC�Ø—J’J˜q #Ñ&Ô&ˆEØÐ Ø—i’i‘k”k�Øð 8Ø—M’M 3¨¯ª©¬Ð"6Ñ7Ô7Ð7Ø�ð	 !õ ð 0Ø23°C´&ñ9ñ :ô :ð :ð �Š)ˆ)ð �$�$�B�$Œ<Ðr   c                 óV   — | o'| d         d         |k    o|d u p| d         d         |k    S )Nrš   r   r›   r
   ©ÚtokensÚtype_r£   s      r   Útest_next_tokenrµ   i  s<   € Øð 2�f˜R”j ”m uÒ,ð 2Ø	�$ˆÐ	0˜& œ* Qœ-¨5Ò0ð2r   c                 óP   — t          | ||¦  «        r|                      ¦   «         S d S r   )rµ   Úpopr²   s      r   Ú
skip_tokenr¸   n  s.   € Ý�v˜u eÑ,Ô,ð Ø�zŠz‰|Œ|Ððð r   c                 ó   — d| ffS )Nr£   r
   )r£   s    r   Ú
value_noderº   s  s   € Ø�U�IÐÐr   c                 ó
   — | dfS )Nr
   r
   )Únames    r   Ú
ident_noder½   w  s   € Ø�ˆ8€Or   c                 ó
   — d| fS )Nr“   r
   )r“   s    r   Úrange_list_noder¿   {  s   € Ø˜Ð#Ð#r   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 )r>   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 instanciation into an attribute
    called `ast`.
    c                 óÔ   — t          |¦  «        | _        | j        s	d | _        d S |                      ¦   «         | _        | j        r#t	          d| j        d         d         z  ¦  «        ‚d S )NzExpected end of rule, got %rrš   r›   )r°   r³   r?   Ú	conditionr¡   )rA   Ústrings     r   rF   z_Parser.__init__¥  sv   € Ý# FÑ+Ô+ˆŒØŒ{ð 	ð ˆDŒHØˆFØ—>’>Ñ#Ô#ˆŒØŒ;ð 	0ÝÐ:Ø œK¨œO¨AÔ.ñ/ñ 0ô 0ð 0ð	0ð 	0r   Nc                 óâ   — t          | j        ||¦  «        }|�|S |€t          |d u r|p|¦  «        }| j        st          d|z  ¦  «        ‚t          d|›d| j        d         d         ›�¦  «        ‚)Nz#expected %s but end of rule reachedz	expected z	 but got rš   r›   )r¸   r³   Úreprr¡   )rA   r´   r£   ÚtermÚtokens        r   Úexpectz_Parser.expect±  s†   € Ý˜4œ;¨¨uÑ5Ô5ˆØÐØˆLØˆ<Ý˜ ˜Ð/¨%Ð8°5Ñ9Ô9ˆDØŒ{ð 	JÝÐAÀDÑHÑIÔIÐIÝˆi°D°D°D¸$¼+Àb¼/È!Ô:LÐ:LÐMÑNÔNÐNr   c                 ó¶   — |                       ¦   «         }t          | j        dd¦  «        r.d||                       ¦   «         ff}t          | j        dd¦  «        °.|S )Nr¢   Úor)Úand_conditionr¸   r³   ©rA   Úops     r   rÅ   z_Parser.condition»  sa   € Ø×ÒÑ!Ô!ˆÝ˜œ f¨dÑ3Ô3ð 	2Ø˜˜D×.Ò.Ñ0Ô0Ð1Ð1ˆBõ ˜œ f¨dÑ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   € Ø�]Š]‰_Œ_ˆÝ˜œ f¨eÑ4Ô4ð 	.Ø˜˜TŸ]š]™_œ_Ð-Ð-ˆBõ ˜œ f¨eÑ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Ó   )rE   r¸   r³   r£   r¡   Únewfangled_relationr“   rÂ   )rA   ÚleftÚnegatedÚmethodrŸ   s        r   rÓ   z_Parser.relationÇ  s  € Ø�yŠy‰{Œ{ˆÝ�d”k 6¨4Ñ0Ô0ð 	%Ý˜dœk¨6°5Ñ9Ô9ÐE¸gÐMÈØ�t—z’z‘|”|Ð$ð%ð %å˜Tœ[¨&°%Ñ8Ô8ˆØˆÝ�d”k 6¨8Ñ4Ô4ð 	6ØˆFˆFå˜dœk¨6°4Ñ8Ô8ð 6Øð KÝ#Ð$IÑJÔJÐJØ×/Ò/°Ñ5Ô5Ð5Ø˜& $¨¯ªÑ(9Ô(9Ð:Ð:ˆØ$Ð,�v�b‰zŒzˆz¨"Ð,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Â   )rA   rÚ   rÛ   rŸ   s       r   rÙ   z_Parser.newfangled_relationØ  s}   € Ý�d”k 8¨SÑ1Ô1ð 	GØˆGˆGÝ˜œ X¨tÑ4Ô4ð 	GØˆGˆGåÐEÑFÔFÐFØ˜$  d§o¢oÑ&7Ô&7Ð8Ð8ˆØ$Ð,�v�b‰zŒzˆz¨"Ð,r   c                 óˆ   — |                       ¦   «         }t          | j        d¦  «        r||                       ¦   «         fS ||fS )Nr¥   )r£   r¸   r³   )rA   rÚ   s     r   Úrange_or_valuez_Parser.range_or_valueâ  s@   € Ø�zŠz‰|Œ|ˆÝ�d”k :Ñ.Ô.ð 	Ø˜Ÿš™œÐ%Ð%à˜�:Ðr   c                 óð   — |                       ¦   «         g}t          | j        dd¦  «        r=|                     |                       ¦   «         ¦  «         t          | j        dd¦  «        °=t	          |¦  «        S )Nr¤   ú,)rà   r¸   r³   r@   r¿   )rA   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½   )rA   r¢   r¼   s      r   rE   z_Parser.exprï  s°   € Ý˜$œ+ vÑ.Ô.ˆØˆ<˜4 œ7­%Ð/Ð/ÝÐ:Ñ;Ô;Ð;Ø�AŒwˆÝ�d”k 6¨5Ñ1Ô1ð 	5Ø˜D "˜: t§z¢z¡|¤|Ð4Ð4Ð4Ý˜œ X¨sÑ3Ô3ð 	5Ø˜D "˜: t§z¢z¡|¤|Ð4Ð4Ð4Ý˜$ÑÔÐr   c                 ól   — t          t          |                      d¦  «        d         ¦  «        ¦  «        S )Nr£   r›   )rº   r   rË   rd   s    r   r£   z_Parser.valueú  s)   € Ý�#˜dŸkšk¨'Ñ2Ô2°1Ô5Ñ6Ô6Ñ7Ô7Ð7r   )NN)rP   rl   rm   rn   rF   rË   rÅ   rÎ   rÓ   rÙ   rà   r“   rE   r£   r
   r   r   r>   r>   ƒ  s¾   € € € € € ðð ðB
0ð 
0ð 
0ðOð Oð Oð Oðð ð ðð ð ð-ð -ð -ð"-ð -ð -ðð ð ð+ð +ð +ð	 ð 	 ð 	 ð8ð 8ð 8ð 8ð 8r   r>   c                 ó   ‡ — ˆ fd„S )ú%Compiler factory for the `_Compiler`.c                 ó^   •— ‰|                       |¦  «        |                       |¦  «        fz  S r   ©rZ   )rA   ÚlÚrÚtmpls      €r   r`   z"_binary_compiler.<locals>.<lambda>   s%   ø€ ˜d d§l¢l°1¡o¤o°t·|²|ÀA±´Ð%GÑG€ r   r
   ©rî   s   `r   Ú_binary_compilerrð   þ  s   ø€ àGÐGÐGÐGÐGr   c                 ó   ‡ — ˆ fd„S )ré   c                 ó4   •— ‰|                       |¦  «        z  S r   rë   )rA   r_   rî   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|z   ¦  «        |Ž S )NÚcompile_)Úgetattr)rA   ÚargrÐ   Úargss       r   rZ   z_Compiler.compile  s&   € Ø‰ˆˆDØ-�w�t˜Z¨"™_Ñ-Ô-¨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 )Nr*   r
   r^   s    r   r`   z_Compiler.<lambda>  rý   r   c                 ó   — dS )Nr+   r
   r^   s    r   r`   z_Compiler.<lambda>  rý   r   c                 ó   — dS )Nr,   r
   r^   s    r   r`   z_Compiler.<lambda>  rý   r   c                 ó   — dS )Nr-   r
   r^   s    r   r`   z_Compiler.<lambda>  rý   r   c                 ó   — dS )Nr.   r
   r^   s    r   r`   z_Compiler.<lambda>  rý   r   c                 ó   — dS )Nr/   r
   r^   s    r   r`   z_Compiler.<lambda>  rý   r   c                 ó    — t          |¦  «        S r   r   )r_   r*   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)rA   rÜ   rE   r“   s       r   Úcompile_relationz_Compiler.compile_relation$  s   € Ý!Ñ#Ô#Ð#r   N)rP   rl   rm   rn   rZ   Ú	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Ô0€KØ!Ð! ,Ñ/Ô/€JØ!�/ 'Ñ*Ô*€KØ"Ð" <Ñ0Ô0€KØ!Ð! ,Ñ/Ô/€JØ$Ð$ \Ñ2Ô2€Mð$ð $ð $ð $ð $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d                      ˆ fd„|d         D ¦   «         ¦  «        z  }|                     ¦   «         ›d‰                      |¦  «        ›d|›d�S )Nz[%s]râ   c           	      óZ   •— g | ]'}d t          t          ‰j        |¦  «        ¦  «        z  ‘Œ(S )z(%s, %s))ÚtupleÚmaprZ   )r   Úrange_rA   s     €r   rM   z4_PythonCompiler.compile_relation.<locals>.<listcomp>2  sB   ø€ ð *ð *ð *Øð �%¥ D¤L°&Ñ 9Ô 9Ñ:Ô:Ñ:ð *ð *ð *r   r›   ú(rJ   ú))r   ÚupperrZ   )rA   rÜ   rE   r“   Úcompile_range_lists   `    r   r  z _PythonCompiler.compile_relation0  s€   ø€ Ø# c§h¢hð*ð *ð *ð *Ø% aœ=ð*ñ *ô *ñ'+ô '+ñ +Ðð  &Ÿ|š|™~œ~˜~˜~¨t¯|ª|¸DÑ/AÔ/AÐ/AÐ/AØ1Ð1Ð1ð3ð 	3r   N)rP   rl   rm   rn   rð   r  r  ró   r  r  r  r
   r   r   r„   r„   (  sh   € € € € € Ø+Ð+à"Ð" =Ñ1Ô1€KØ!Ð! ,Ñ/Ô/€JØ!�/ *Ñ-Ô-€KØ"Ð" =Ñ1Ô1€Kð3ð 3ð 3ð 3ð 3r   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                 óz  — g }|                       |¦  «        }|d         D ]„}|d         |d         k    r6|                     d|›d|                       |d         ¦  «        ›d�¦  «         ŒJt          | j         |¦  «        \  }}|                     d|›d|›d|›d|›d�	¦  «         Œ…d	d
                     |¦  «        z  S )Nr›   r   r  z == r  z >= ú && z <= z(%s)z || )rZ   r@   r  r   )rA   rÜ   rE   r“   rŸ   ÚitemÚminÚmaxs           r   r  z!_GettextCompiler.compile_relationA  sì   € ØˆØ�|Š|˜DÑ!Ô!ˆØ˜q”Mð 	ð 	ˆDØ�AŒw˜$˜qœ'Ò!Ð!Ø—	’	�	Ø�D�DØ—L’L  a¤Ñ)Ô)Ð)Ð)ðñ ô ð ð õ
 ˜tœ|¨TÑ2Ô2‘��SØ—	’	�	Ø�D�DØ�C�CØ�D�DØ�C�Cð	ñ ô ð ð ð ˜Ÿš B™œÑ'Ð'r   N)rP   rl   rm   rn   rö   r	  r
  Úcompile_zeror  r  r  r  r  r
   r   r   rŒ   rŒ   8  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 )rt   z/Compiles the expression to plain of JavaScript.c                 ó   — dS )NzparseInt(n, 10)r
   r^   s    r   r`   z_JavaScriptCompiler.<lambda>Z  s   € Ð+€ r   c                 óŽ   — t                                | |||¦  «        }|dk    r!|                      |¦  «        }d|›d|›d|›d�}|S )Nr×   z
(parseInt(z	, 10) == r$  r  )rŒ   r  rZ   )rA   rÜ   rE   r“   rˆ   s        r   r  z$_JavaScriptCompiler.compile_relation`  sY   € Ý×0Ò0Ø�&˜$ 
ñ,ô ,ˆà�TŠ>ˆ>Ø—<’< Ñ%Ô%ˆDˆDØ7;°t°t¸T¸T¸TÀ4À4À4ÐHˆDØˆr   N)rP   rl   rm   rn   r
  r(  r  r  r  r  r  r
   r   r   rt   rt   U  sG   € € € € € Ø9Ð9ð ,Ð+€IØ€IØ€IØ€IØ€Iðð ð ð ð r   rt   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 )rY   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  )rA   rÓ   s     r   r  z_UnicodeCompiler.compile_notv  s   € Ø$ˆtÔ$°H¸Q´KÐ@¨TÐ@Ð@Ð@r   Fc           
      óz  — g }|d         D ]{}|d         |d         k    r/|                      |                      |d         ¦  «        ¦  «         ŒC|                      dt          t          | j        |¦  «        ¦  «        z  ¦  «         Œ||                      |¦  «        ›|rdpd›d|›dd                     |¦  «        ›�S )Nr›   r   z%s..%sz notr   rI   râ   )r@   rZ   r  r  r   )rA   rÜ   rE   r“   rÛ   Úrangesr%  s          r   r  z!_UnicodeCompiler.compile_relationy  sÈ   € ØˆØ˜q”Mð 	Ið 	IˆDØ�AŒw˜$˜qœ'Ò!Ð!Ø—’˜dŸlšl¨4°¬7Ñ3Ô3Ñ4Ô4Ð4Ð4à—’˜h­­s°4´<ÀÑ/FÔ/FÑ)GÔ)GÑGÑHÔHÐHÐHà�LŠL˜ÑÔÐ Ð 2¨FÐ 8°bÐ 8Ð 8ØˆFˆF�C—H’H˜VÑ$Ô$Ð$ð
ð 	
r   N)F)rP   rl   rm   rn   rð   r  r  r  r  r  r  r  r
   r   r   rY   rY   i  s’   € € € € € Ø5Ð5ð "Ð! *Ñ-Ô-€JØ$Ð$ ^Ñ4Ô4€MØ"Ð" ;Ñ/Ô/€KØ!Ð! *Ñ-Ô-€JØ"Ð" ;Ñ/Ô/€KðAð Að Að

ð 

ð 

ð 

ð 

ð 

r   rY   r   )$rn   r   Úrer;   ru   r0   r2   ry   rj   r�   r�   r‚   rƒ   Ú	Exceptionr¡   ræ   rZ   ÚUNICODEr   r©   r°   rµ   r¸   rº   r½   r¿   rÂ   r>   rð   ró   r(  rö   r„   rŒ   rt   rY   r
   r   r   ú<module>r3     sA  ððð ð €€€Ø 	€	€	€	ð >€Ø€ð8"ð 8"ð 8"ðvZð Zð Zð Zð Zñ Zô Zð Zðzð ð ð.%!ð %!ð %!ðPð ð ð.Bð Bð Bð(Ið Ið Ið(ð ð ð.)ð )ð )ð )ð )�	ñ )ô )ð )ð		ð 		ð 		€ð 
ˆ:ˆ2Œ:�f˜bœjÑ)Ô)Ð*ØˆZˆRŒZÐR¸b¿gºgÀe¹n¼nÐRÐRÐRÑSÔSÐTØˆjˆbŒj˜Ñ Ô Ð!ØˆzˆrŒz˜+Ñ&Ô&Ð'Ø��”Ð-¨r¬zÑ:Ô:Ð;ð
€ðð ð ð&2ð 2ð 2ð 2ð
ð ð ð ð
ð ð ðð ð ð$ð $ð $ðð ð ðx8ð x8ð x8ð x8ð x8ñ x8ô x8ð x8ðvHð Hð Hð
2ð 2ð 2ð
 ˆ}€ð$ð $ð $ð $ð $ñ $ô $ð $ð:3ð 3ð 3ð 3ð 3�iñ 3ô 3ð 3ð (ð (ð (ð (ð (�yñ (ô (ð (ð:ð ð ð ð Ð*ñ ô ð ð(
ð 
ð 
ð 
ð 
�yñ 
ô 
ð 
ð 
ð 
r   