AlkantarClanX12

Your IP : 18.188.59.124


Current Path : /opt/imunify360/venv/lib64/python3.11/site-packages/babel/__pycache__/
Upload File :
Current File : //opt/imunify360/venv/lib64/python3.11/site-packages/babel/__pycache__/plural.cpython-311.pyc

�

j��f�Z�	���UdZddlmZddlZddlZddlmZmZddlm	Z	m
Z
mZe	rddlm
Z
dZdZdUd
�ZGd�d��ZdVd�ZdWd�ZdVd�ZdXd�ZdXd�ZdYd �ZGd!�d"e��Zhd#�Zdejd$ej��fd%ejd&d'�e���d(���fd)ejd*��fd+ejd,��fd-ejd.ej��fgZd/ed0<dZd3�Z 	d[d\d8�Z!d[d]d9�Z"d^d<�Z#d_d?�Z$d`dA�Z%dadE�Z&GdF�dG��Z'dH�Z(dI�Z)dJ�Z*GdK�dL��Z+GdM�dNe+��Z,GdO�dPe+��Z-GdQ�dRe-��Z.GdS�dTe+��Z/dS)bz�
    babel.numbers
    ~~~~~~~~~~~~~

    CLDR Plural support.  See UTS #35.

    :copyright: (c) 2013-2023 by the Babel Team.
    :license: BSD, see LICENSE for more details.
�)�annotationsN)�Iterable�Mapping)�
TYPE_CHECKING�Any�Callable)�Literal)�zero�one�two�few�many�otherr�source�float | decimal.Decimal�return�Mtuple[decimal.Decimal | int, int, int, int, int, int, Literal[0], Literal[0]]c�j�t|��}t|��}t|t��r*||kr|}n!t	jt
|����}t|tj��r�|���}|j}|dkr|j	|d�nd}d�
d�|D����}|�d��}t|��}t|��}	t|pd��}
t|pd��}ndx}x}	x}
}dx}}
||||	|
|||
fS)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]
    rN��c3�4K�|]}t|��V��dS�N��str)�.0�ds  �l/builddir/build/BUILD/imunify360-venv-2.3.5/opt/imunify360/venv/lib/python3.11/site-packages/babel/plural.py�	<genexpr>z#extract_operands.<locals>.<genexpr>Gs(����;�;�a�3�q�6�6�;�;�;�;�;�;��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_operandsr: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��!�!rc��eZdZdZdZdd�Zdd	�Zedd���Ze	dd
���Z
e	dd���Zdd�Zdd�Z
dd�ZdS) �
PluralRuleafRepresents 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vrtd|�����||vrtd|�d����|�|��t|��j
}|r|j�||f���dS)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 ztag z defined twiceN)r#r�items�setr=�sorted�_plural_tags�
ValueError�add�_Parser�ast�append)�selfr?�found�key�exprrJs      r�__init__zPluralRule.__init__js����e�W�%�%�	"��K�K�M�M�E�����/1��
�����	1�	1�I�C���,�&�&� �!7��!7�!7�8�8�8����� �!=��!=�!=�!=�>�>�>��I�I�c�N�N�N��$�-�-�#�C��
1��
�$�$�c�3�Z�0�0�0��	1�	1rrc���|j�d��fd�tD����}dt|��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�Y�S�C�SX�L�L�S�0�0�E�#�J�0�0�L�L�Lr�<� �>)r?r*rF�type�__name__)rL�argsr?s  @r�__repr__zPluralRule.__repr__�sR����
���y�y�Y�Y�Y�Y�L�Y�Y�Y�Z�Z��2�4��:�:�&�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�parsezPluralRule.parse�s)���e�Z�(�(�	��L��s�5�z�z�r�Mapping[str, str]c�P��t��j��fd�|jD��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|]\}}|�|����Srr)rrTrJ�_compiles   �r�
<dictcomp>z$PluralRule.rules.<locals>.<dictcomp>�s'���A�A�A�x�s�C��X�X�c�]�]�A�A�Ar)�_UnicodeCompiler�compiler=)rLrds @rr?zPluralRule.rules�s/���$�%�%�-��A�A�A�A�4�=�A�A�A�Ar�frozenset[str]c�>�td�|jD����S)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.
        c3�&K�|]}|dV��
dS)rNr)rr.s  rrz"PluralRule.tags.<locals>.<genexpr>�s&����5�5�!��1��5�5�5�5�5�5r)�	frozensetr=�rLs r�tagszPluralRule.tags�s#���5�5�t�}�5�5�5�5�5�5r�list[tuple[str, Any]]c��|jSr�r=rls r�__getstate__zPluralRule.__getstate__�s
���}�rr=c��||_dSrrp)rLr=s  r�__setstate__zPluralRule.__setstate__�s
�� ��
�
�
rr-rc�t�t|d��st|��|_|�|��S)Nr>)�hasattr�	to_pythonr>)rLr-s  r�__call__zPluralRule.__call__�s1���t�W�%�%�	)�"�4���D�J��z�z�!�}�}�rN)r?r@rrA)rr)r?r]rr<)rra)rrh)rrn)r=rnrrA)r-rrr)rZ�
__module__�__qualname__�__doc__�	__slots__rPr\�classmethodr`�propertyr?rmrqrsrwrrrr<r<Ss���������(&�I�1�1�1�1�,3�3�3�3�
�	�	�	��[�	��B�B�B��X�B��6�6�6��X�6�����!�!�!�!������rr<�ruler]rc�$�t��j}dg}t�|��jD])\}}|�||���d|�d����*|�dt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)�_JavaScriptCompilerrgr<r`r=rK�
_fallback_tagr*)r~�to_js�resultrTrJs     r�
to_javascriptr��s���
 �!�!�)�E�&�
'�F��$�$�T�*�*�3�4�4���S��
�
���s���2�2��2�2�2�3�3�3�3�
�M�M�(�]�*�+�+�+�
�7�7�6�?�?�r�(Callable[[float | decimal.Decimal], str]c	���ttttd�}t	��j}ddg}t�|��jD]6\}}|�	d||���dt|�������7|�	dt����td�|��dd	��}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�MODr:zdef 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_modulor:�_PythonCompilerrgr<r`r=rKrr�r*�eval)r~�	namespace�to_python_funcr�rTrJ�codes       rrvrv�s���(�#��,�	��I�%�&�&�.�N��7��F��$�$�T�*�*�3�K�K���S�	�
�
�I�n�n�S�1�1�I�I�S��X�X�I�I�J�J�J�J�
�M�M�.�]�.�.�/�/�/��4�9�9�V�$�$�h��7�7�D���y�����Z� � rc���t�|��}|jthz�t	��j}�fd�tD��j}dt����d�g}|j	D]2\}}|�
||���d||���d����3|�
|t���d���d�|��S)aThe 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�|��	Srr)rrT�	used_tagss  �rrUzto_gettext.<locals>.<listcomp>�s#���B�B�B�#��	�1A�1A�#�1A�1A�1Arz	nplurals=z
; plural=(r�r�z);r)r<r`rmr��_GettextCompilerrgrF�indexr,r=rKr*)r~rd�
_get_indexr�rTrJr�s      @r�
to_gettextr��s�������D�!�!�D��	�]�O�+�I��!�!�)�H�B�B�B�B��B�B�B�H�J�4�#�i�.�.�4�4�4�
5�F��M�A�A���S��
�
���#���?�?�:�:�c�?�?�?�?�?�@�@�@�@�
�M�M�Z�Z�
�.�.�2�2�2�3�3�3�
�7�7�6�?�?�r�num�
range_list�+Iterable[Iterable[float | decimal.Decimal]]�boolc�H�|t|��kot||��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  rr�r�s$��"�#�c�(�(�?�A�0��j�A�A�Arc�:��t�fd�|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
    c3�6�K�|]\}}�|ko�|kV��dSrr)r�min_�max_r�s   �rrz$within_range_list.<locals>.<genexpr>+s4�����H�H�z�t�T�s�d�{�*�s�d�{�H�H�H�H�H�Hr)�anyr�s` rr�r�s(���"�H�H�H�H�Z�H�H�H�H�H�Hr�ar$�bc�R�d}|dkr|dz}d}|dkr|dz}||z}|r|dz}|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)r�r��reverse�rvs    rr�r�.sQ���G��1�u�u�	�R������1�u�u�	�R���	
�Q��B���
�b���
�Irc��eZdZdZdS)�	RuleErrorzRaised if a rule is malformed.N)rZrxryrzrrrr�r�Es������(�(�(�(rr�>r8r9r6r.r-r7r4r5z\s+�wordz"\b(and|or|is|(?:with)?in|not|mod|[rz])\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|��}||kr�tD]^\}}|�||��}|�A|���}|r)|�||���f��n�_td||z���||k��|ddd�S)N�@rz5malformed CLDR pluralization rule.  Got unexpected %rr�)�splitr,r��match�endrK�groupr�)r�r��posr��tokr~r�s       r�
tokenize_ruler�]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�tokens�type_�
str | None�list[tuple[str, str]] | boolc�V�|o'|dd|ko|dup|dd|kS)Nr�rr�r�r�r�r�s   r�test_next_tokenr�ps>��
�2�f�R�j��m�u�,�2�	�$��	0�&��*�Q�-�5�0�2rc�P�t|||��r|���SdSr)r��popr�s   r�
skip_tokenr�ys.���v�u�e�,�,���z�z�|�|���rr"�#tuple[Literal['value'], tuple[int]]c��d|ffS)Nr�r)r�s r�
value_noder�~s���U�I��r�name�tuple[str, tuple[()]]c�
�|dfS)Nrr)r�s r�
ident_noder��s����8�Or�Ituple[Literal['range_list'], Iterable[Iterable[float | decimal.Decimal]]]c�
�d|fS)Nr�r)r�s r�range_list_noder��s����#�#rr��tuple[Any, ...]�-tuple[Literal['not'], tuple[tuple[Any, ...]]]c��d|ffS)N�notr)r�s r�negater��s���2�%�<�rc�P�eZdZdZd�Zd
d�Zd�Zd�Zd�Zd�Z	d	�Z
d
�Zd�Zd�Z
dS)rIu�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|��|_|js	d|_dS|���|_|jr#t	d|jdd�����dS)NzExpected end of rule, got r�r�)r�r�rJ�	conditionr�)rL�strings  rrPz_Parser.__init__�ss��#�F�+�+����{�	��D�H��F��>�>�#�#����;�	Q��O���R���9K�O�O�P�P�P�	Q�	QrNc���t|j||��}|�|S|�t|dur|p|��}|jstd|�d����td|�d|jdd�����)Nz	expected z but end of rule reachedz	 but got r�r�)r�r��reprr�)rLr�r��term�tokens     r�expectz_Parser.expect�s����4�;��u�5�5�����L��<����
�/�%�8�5�9�9�D��{�	H��F��F�F�F�G�G�G��I�D�I�I�4�;�r�?�1�3E�I�I�J�J�Jrc��|���}t|jdd��r.d||���ff}t|jdd���.|S)Nr��or)�
and_conditionr�r��rL�ops  rr�z_Parser.condition�sa��
�
�
�
!�
!�����f�d�3�3�	2���D�.�.�0�0�1�1�B����f�d�3�3�	2��	rc��|���}t|jdd��r.d||���ff}t|jdd���.|S)Nr��and)�relationr�r�r�s  rr�z_Parser.and_condition�sY��
�]�]�_�_�����f�e�4�4�	.���T�]�]�_�_�-�-�B����f�e�4�4�	.��	rc���|���}t|jdd��r0t|jdd��rdpd||���ffSt|jdd��}d}t|jdd��rd}n<t|jdd��s&|rt	d���|�|��Sd|||���ff}|rt|��n|S)	Nr��isr��isnot�in�withinz#Cannot negate operator based rules.r�)rOr�r�r�r��newfangled_relationr�r�)rL�left�negated�methodr�s     rr�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�"�,rc���t|jdd��rd}n(t|jdd��rd}ntd���dd||���ff}|rt	|��n|S)	Nr��=Fz!=Tz'Expected "=" or "!=" or legacy relationr�r�)r�r�r�r�r�)rLr�r�r�s    rr�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�"�,rc��|���}t|jd��r||���fS||fS)Nr�)r�r�r�)rLr�s  r�range_or_valuez_Parser.range_or_value�s@���z�z�|�|���d�k�:�.�.�	�������%�%���:�rc���|���g}t|jdd��r=|�|�����t|jdd���=t	|��S)Nr��,)r�r�r�rKr�)rLr�s  rr�z_Parser.range_list�sr���)�)�+�+�,�
����h��4�4�	5����d�1�1�3�3�4�4�4����h��4�4�	5��z�*�*�*rc�Z�t|jd��}|�|dtvrtd���|d}t|jdd��rd|df|���ffSt|jdd��rd|df|���ffSt|��S)Nr�r�zExpected identifier variable�modrr��%)r�r��_VARSr�r�r�)rLr�r�s   rrOz_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��$���rc�l�tt|�d��d����S)Nr�r�)r�r"r�rls rr�z
_Parser.values)���#�d�k�k�'�2�2�1�5�6�6�7�7�7r)NN)rZrxryrzrPr�r�r�r�r�r�r�rOr�rrrrIrI�s���������B	Q�	Q�	Q�K�K�K�K�������-�-�-�"-�-�-����+�+�+�	 �	 �	 �8�8�8�8�8rrIc����fd�S)�%Compiler factory for the `_Compiler`.c�^���|�|��|�|��fzSr�rg)rLr��right�tmpls   �r�<lambda>z"_binary_compiler.<locals>.<lambda>s)���T�T�\�\�$�-?�-?����e�AT�AT�,U�%U�rr�rs`r�_binary_compilerr
s���U�U�U�U�Urc����fd�S)rc�4���|�|��zSrr)rL�xrs  �rrz!_unary_compiler.<locals>.<lambda>s���4�$�,�,�q�/�/�1�rrrs`r�_unary_compilerrs���1�1�1�1�1rc��dS)Nr r�rs rrrs���rc���eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
ed��Zed
��Zed��Zed��Zed��Zed��Zd�ZdS)�	_CompilerzZThe compilers are able to transform the expressions into multiple
    output formats.
    c�8�|\}}t|d|����|�S)N�compile_)�getattr)rL�argr�r[s    rrgz_Compiler.compiles(�����D�-�w�t�_��_�_�-�-�t�4�4rc��dS)Nr-rrs rrz_Compiler.<lambda> ���#�rc��dS)Nr.rrs rrz_Compiler.<lambda>!rrc��dS)Nr4rrs rrz_Compiler.<lambda>"rrc��dS)Nr5rrs rrz_Compiler.<lambda>#rrc��dS)Nr6rrs rrz_Compiler.<lambda>$rrc��dS)Nr7rrs rrz_Compiler.<lambda>%rrc��dS)Nr8rrs rrz_Compiler.<lambda>&rrc��dS)Nr9rrs rrz_Compiler.<lambda>'rrc� �t|��Srr)rr4s  rrz_Compiler.<lambda>(s���Q���rz
(%s && %s)z
(%s || %s)z(!%s)z
(%s %% %s)z
(%s == %s)z
(%s != %s)c��t���r)�NotImplementedError)rLr�rOr�s    r�compile_relationz_Compiler.compile_relation0s��!�#�#�#rN)rZrxryrzrg�	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!rrrrrs���������5�5�5��
�I��
�I��
�I��
�I��
�I��
�I��
�I��
�I�'�'�M�"�"�<�0�0�K�!�!�,�/�/�J�!�/�'�*�*�K�"�"�<�0�0�K�!�!�,�/�/�J�$�$�\�2�2�M�$�$�$�$�$rrc�p�eZdZdZed��Zed��Zed��Zed��Z	d�Z
dS)r�z!Compiles an expression to Python.z(%s and %s)z
(%s or %s)z(not %s)zMOD(%s, %s)c���d��fd�|dD����}|����d��|���d|�d�S)Nr�c�t��g|]4\}}d��|���d��|���d���5S)�(rR�)r)rr�r�rLs   �rrUz4_PythonCompiler.compile_relation.<locals>.<listcomp>=sE���a�a�a��!�Q�D�t�|�|�A���D�D�$�,�,�q�/�/�D�D�D�a�a�arr�r4z, [z]))r*�upperrg)rLr�rOr��rangess`    rr!z _PythonCompiler.compile_relation<sc������a�a�a�a�S]�^_�S`�a�a�a�b�b���,�,�.�.�D�D�4�<�<��#5�#5�D�D�&�D�D�D�DrN)rZrxryrzrr+r,rr-r.r!rrrr�r�4sm������+�+�"�"�=�1�1�K�!�!�,�/�/�J�!�/�*�-�-�K�"�"�=�1�1�K�E�E�E�E�Err�c�6�eZdZdZejZeZeZ	eZ
eZd�ZdS)r�z)Compile into a gettext plural expression.c�|�g}|�|��}|dD]�}|d|dkr6|�d|�d|�|d���d����Jt|j|��\}}|�d|�d|�d|�d|�d�	����dd	�|���d�S)
Nr�rr4z == r5z >= � && z <= z || )rgrK�mapr*)rLr�rOr�r��item�min�maxs        rr!z!_GettextCompiler.compile_relationJs���
���|�|�D�!�!���q�M�	C�	C�D��A�w�$�q�'�!�!��	�	�@�d�@�@����T�!�W�(=�(=�@�@�@�A�A�A�A��t�|�T�2�2���S��	�	�A�d�A�A��A�A��A�A�3�A�A�A�B�B�B�B�%�6�;�;�r�?�?�%�%�%�%rN)
rZrxryrzrr"r#�compile_zeror$r%r&r'r!rrrr�r�AsE������3�3��#�I��I��I��I��I�	&�	&�	&�	&�	&rr�c�.�eZdZdZd�ZeZeZeZeZ	d�Z
dS)r�z/Compiles the expression to plain of JavaScript.c��dS)NzparseInt(n, 10)rrs rrz_JavaScriptCompiler.<lambda>[s��+�rc��t�||||��}|dkr!|�|��}d|�d|�d|�d�}|S)Nr�z
(parseInt(z	, 10) == r:r5)r�r!rg)rLr�rOr�r�s     rr!z$_JavaScriptCompiler.compile_relationas_���0�0��&�$�
�,�,���T�>�>��<�<��%�%�D�@��@�@�t�@�@��@�@�@�D��rN)rZrxryrzr#r?r$r%r&r'r!rrrr�r�VsG������9�9�,�+�I��I��I��I��I�����rr�c��eZdZdZed��Zed��Zed��Zed��Zed��Z	d�Z
dd	�Zd
S)rfz+Returns a unicode pluralization rule again.z%s is %sz%s is not %sz	%s and %sz%s or %sz	%s mod %sc�(�|j|dddi�S)Nr�r�T)r!)rLr�s  rr-z_UnicodeCompiler.compile_notws��$�t�$�h�q�k�@�4�@�@�@rFc	��g}|dD]�}|d|dkr/|�|�|d�����C|�|�|d���d|�|d��������|�|���|rdnd�d|�dd�|����S)Nr�rz..z notrrWr�)rKrgr*)rLr�rOr�r�r7r<s       rr!z!_UnicodeCompiler.compile_relationzs������q�M�	S�	S�D��A�w�$�q�'�!�!��
�
�d�l�l�4��7�3�3�4�4�4�4��
�
����d�1�g�!6�!6�Q�Q�$�,�,�t�A�w�:O�:O�Q�Q�R�R�R�R��,�,�t�$�$�]��&?�f�f�R�]�]�&�]�]�3�8�8�TZ�K[�K[�]�]�]rN)F)rZrxryrzrr/r0r+r,r.r-r!rrrrfrfjs�������5�5�"�!�*�-�-�J�$�$�^�4�4�M�"�"�;�/�/�K�!�!�*�-�-�J�"�"�;�/�/�K�A�A�A�^�^�^�^�^�^rrf)rrrr)r~r]rr)r~r]rr�)r�rr�r�rr�)r�r$r�r$rr$)r�rrr�r)r�r�r�rr�r�rr�)r�r�r�rr�r�)r�r"rr�)r�rrr�)r�r�rr�)r�r�rr�)0rz�
__future__rr%�re�collections.abcrr�typingrrr�typing_extensionsr	rFr�r:r<r�rvr�r�r�r��	Exceptionr�r�rg�UNICODEr*r��__annotations__r�r�r�r�r�r�r�rIrrr?rr�r�r�rfrrr�<module>rNs�����#�"�"�"�"�"�����	�	�	�	�-�-�-�-�-�-�-�-�/�/�/�/�/�/�/�/�/�/��*�)�)�)�)�)�)�=���
�8"�8"�8"�8"�vZ�Z�Z�Z�Z�Z�Z�Z�z����.%!�%!�%!�%!�P����.B�B�B�B�(I�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�:�:�;�4����������,�2�2�2�2�2������
��������$�$�$�$�����w8�w8�w8�w8�w8�w8�w8�w8�tV�V�V�
2�2�2�
�}��$�$�$�$�$�$�$�$�:
E�
E�
E�
E�
E�i�
E�
E�
E�&�&�&�&�&�y�&�&�&�*�����*����(^�^�^�^�^�y�^�^�^�^�^r