HOME


Mini Shell 1.0
Redirecting to https://devs.lapieza.net/iniciar-sesion Redirecting to https://devs.lapieza.net/iniciar-sesion.
DIR: /lib/python3/dist-packages/babel/messages/__pycache__/
Upload File :
Current File : //lib/python3/dist-packages/babel/messages/__pycache__/checkers.cpython-311.pyc
�

ƪbu��\�dZddlmZmZhd�ddhhd�gZd�Zd�Zd	�Zd
�Ze��Z	dS)z�
    babel.messages.checkers
    ~~~~~~~~~~~~~~~~~~~~~~~

    Various routines that help with validation of translations.

    :since: version 0.9

    :copyright: (c) 2013-2022 by the Babel Team.
    :license: BSD, see LICENSE for more details.
�)�TranslationError�
PYTHON_FORMAT>�d�i�u�x�X>�F�G�f�gc��|js+t|jt��st	d���dS|�dS|j}t|t
tf��s|f}t|��|jkrt	d|jz���dS)z0Verify the number of plurals in the translation.z/Found plural forms for non-pluralizable messageNz*Wrong number of plural forms (expected %d))	�pluralizable�
isinstance�string�strr�list�tuple�len�num_plurals)�catalog�message�msgstrss   �9/usr/lib/python3/dist-packages/babel/messages/checkers.pyrrs�������'�.�#�.�.�	.�"�$-�.�.�
.���
�����n�G��g��e�}�-�-���*��
�7�|�|�w�*�*�*��K�&�2� 3�4�4�	4�+�*�c��d|jvrdS|j}t|ttf��s|f}|j}t|ttf��s|f}t
||��D]\}}|rt||���dS)z9Verify the format string placeholders in the translation.z
python-formatN)�flags�idrrrr�zip�_validate_format)rr�msgidsr�msgid�msgstrs      r�
python_formatr$,s����g�m�+�+���
�Z�F��f�t�U�m�,�,������n�G��g��e�}�-�-���*���V�W�-�-�,�,�
��v��	,��U�F�+�+�+��,�,rc
��d�}d�}d�}t|||f��\}}t|||f��\}}|r|s|std���||krtd���|r�t|��t|��krtd���tt	||����D]2\}	\\}
}\}
}|||��std|	dz||fz����3dSt|��}
|D]L\}}||
vrtd	|z���|||
|��std
|�d|�d|
|�d
�����MdS)a�Test format string `alternative` against `format`.  `format` can be the
    msgid of a message and `alternative` one of the `msgstr`\s.  The two
    arguments are not interchangeable as `alternative` may contain less
    placeholders if `format` uses named placeholders.

    The behavior of this function is undefined if the string does not use
    string formattings.

    If the string formatting of `alternative` is compatible to `format` the
    function returns `None`, otherwise a `TranslationError` is raised.

    Examples for compatible format strings:

    >>> _validate_format('Hello %s!', 'Hallo %s!')
    >>> _validate_format('Hello %i!', 'Hallo %d!')

    Example for an incompatible format strings:

    >>> _validate_format('Hello %(name)s!', 'Hallo %s!')
    Traceback (most recent call last):
      ...
    TranslationError: the format strings are of different kinds

    This function is used by the `python_format` checker.

    :param format: The original format string
    :param alternative: The alternative format string that should be checked
                        against format
    :raises TranslationError: on formatting errors
    c���g}tj|��D]G}|���\}}}|dkr|��#|�|t	|��f���H|S)N�%)r�finditer�groups�appendr)r�result�match�name�format�typechars      r�_parsez _validate_format.<locals>._parse\sj����"�+�F�3�3�	1�	1�E�%*�\�\�^�^�"�D�&�(��3���4�<���M�M�4��X���/�0�0�0�0��
rc�@�||krdStD]
}||vr||vrdS�dS)NTF)�_string_format_compatibilities)�a�b�sets   r�_compatiblez%_validate_format.<locals>._compatiblees=����6�6��4�1�	�	�C��C�x�x�A��H�H��t�t���urc�p�d}|D]#\}}|�|du}�|du|krtd����$t|��S)Nz5format string mixes positional and named placeholders)r�bool)�results�
positionalr-�chars    r�_check_positionalz+_validate_format.<locals>._check_positionalmsl���
�!�	E�	E�J�D�$��!�!�T�\�
�
��D�L�Z�/�/�*�,D�E�E�E�0��J���rzplaceholders are incompatiblez)the format strings are of different kindsz-positional format placeholders are unbalancedzDincompatible format for placeholder %d: %r and %r are not compatible�zunknown named placeholder %rz$incompatible format for placeholder z: z and z are not compatibleN)�maprr�	enumerater�dict)r.�alternativer0r6r<r3r4�a_positional�b_positional�idx�_�first�second�type_mapr-r/s                rr r <s��@������	 �	 �	 ��v���,�-�-�D�A�q�"%�%6��A��!?�!?��L�,��L�L�L��L��>�?�?�?�	��	%�	%��J�K�K�K��I��q�6�6�S��V�V���"�$0�1�1�
1�.7��A�q�	�	�.B�.B�	A�	A�*�C�*�*�1�e�k�q�&��;�u�f�-�-�
A�&�(J�(+�a����'?�(@�A�A�A�
A�	A�	A���7�7���	I�	I�N�D�(��8�#�#�&�'E��'L�M�M�M� �[��8�D�>�:�:�
I�&�&�)-���h�h�h������(H�I�I�I�
I�	I�	Irc��g}	ddlm}|�d��D])}|�|������*n#t
$rYnwxYwt
|��dkrttgS|S)Nr)�working_setzbabel.checkers)	�
pkg_resourcesrJ�iter_entry_pointsr*�load�ImportErrorrrr$)�checkersrJ�entry_points   r�_find_checkersrQ�s����H�0�-�-�-�-�-�-�'�8�8�9I�J�J�	0�	0�K��O�O�K�,�,�.�.�/�/�/�/�	0���
�
�
���
����
�8�}�}�����]�+�+��Os�A
�

A�AN)
�__doc__�babel.messages.catalogrrr2rr$r rQrO�rr�<module>rUs���
�
�C�B�B�B�B�B�B�B�
�O�O��#�J����"��4�4�4�(
,�
,�
,� \I�\I�\I�~
�
�
� �>�����r