Edit File: mofile.cpython-311.pyc
� ������Fh����������������������������U�d�Z�ddlmZ�ddlZddlZddlmZ�ddlmZm Z �erddl mZmZ�dZ ded <���d Zded<���dd�Zddd�ZdS�)z� babel.messages.mofile ~~~~~~~~~~~~~~~~~~~~~ Writing of files in the ``gettext`` MO (machine object) format. :copyright: (c) 2013-2023 by the Babel Team. :license: BSD, see LICENSE for more details. �����)�annotationsN)� TYPE_CHECKING)�Catalog�Message)�SupportsRead� SupportsWritel����*��int�LE_MAGICl����$<��BE_MAGIC�fileobj�SupportsRead[bytes]�returnr���c����������������������t�������������������������i�}t����������|�dd������������}|������������������������������������}t����������|������������}t����������j��������}�|d|dd����������������������d���������}|t����������k����r�|d|dd����������������������\��}}} } d }n8|t����������k����r�|d |dd����������������������\��}}} } d}nt����������dd|�������������t����������|������������D��]�}�|||| | d z�������������������������\��} }|| z���}�|||| | d z�������������������������\��}}||z���}||k�����r||k�����r|||����������}|||����������}nt����������dd|�������������| dk����r�dx}}|� ����������������������������������D�]�}|�����������������������������������}|s�d|v�rY|���������������������dd������������\��}}|������������������������������������ ����������������������������������x}}|�����������������������������������||<����v|r||xx���������d|z���z ��cc<�����d|v�r|���������������������d������������\��}}nd}d|v�rN|���������������������d������������}|���������������������d������������}�j��������r�fd�|D���������������}�fd�|D���������������}n;�j��������r4|����������������������j��������������������}|����������������������j��������������������}t!����������|||��������������|<���| d z ��} | d z ��} ���|������������������������������������_���������S�)aa��Read 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����r���z<4I����z<IIz>4Iz>IIzBad magic number����zFile is corrupt����:�������� ���������c�����������������D������g�|�]}|�����������������������j����������������������S�����decode�charset��.0�x�catalogs��� ��u/builddir/build/BUILD/imunify360-venv-2.5.3/opt/imunify360/venv/lib/python3.11/site-packages/babel/messages/mofile.py� <listcomp>zread_mo.<locals>.<listcomp>]���s'�������>�>�>�Q�q�x�x���0�0�>�>�>�����c�����������������D������g�|�]}|�����������������������j����������������������S�r���r���r���s��� �r#���r$���zread_mo.<locals>.<listcomp>^���s'�������@�@�@�a������1�1�@�@�@r%���)�context)r����getattr�read�len�struct�unpackr ���r����OSError�range� splitlines�strip�split�lowerr���r���r����items�mime_headers)r����headers�filename�buf�buflenr,����magic�version�msgcount�origidx�transidx�ii�_i�mlen�moff�mend�tlen�toff�tend�msg�tmsg�lastkey�key�item�value�ctxtr"���s��� @r#����read_morM������sN��������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���H�o�o��-��-���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���Nr%���F�SupportsWrite[bytes]r"���� use_fuzzy�bool�Nonec����������� ������|������t�����������������������}�fd�|dd����������D���������������|dd�<���|������������������������������������dx}}g�}|D��]�}|j��������r�d����������������������fd�|j��������D���������������������������}g�} t����������|j��������������������D�]X\��} }|s<| ���������������������|j��������t����������t����������| ������������d�����������������������������������C| ���������������������|��������������Yd����������������������fd�| D���������������������������}n>|j��������� ���������������������j��������������������}|j��������� ���������������������j��������������������}|j��������r4d���������������������|j��������� ���������������������j��������������������|g������������}|���������������������t����������|������������t����������|������������t����������|������������t����������|������������f�������������||dz���z ��}||dz���z ��}���d d t����������|������������z��z���} | t����������|������������z���}g�}g�}|D�]\��}}}}|||| z���gz ��}||||z���gz ��}�||z���}|����������������������t����������j��������dt"����������dt����������|������������d d t����������|������������d z��z���dd������������t$����������j�����������������������������t%����������j��������d|������������������������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���������|��S�r���)�string�fuzzy)r ����mrO���s��� �r#���r$���zwrite_mo.<locals>.<listcomp>����sJ��������@��@��@�!��x�@�%.�@�67�g�@�A��@��@��@r%���r���Nr%���r���c�����������������D������g�|�]}|�����������������������j����������������������S�r�����encoder���)r ����msgidr"���s��� �r#���r$���zwrite_mo.<locals>.<listcomp>����s4��������"��"��"�27����W�_�-�-�"��"��"r%���c�����������������D������g�|�]}|�����������������������j����������������������S�r���rX���)r ����msgstrr"���s��� �r#���r$���zwrite_mo.<locals>.<listcomp>����s4��������#��#��#�39�� � �g�o�.�.�#��#��#r%���r������������Iiiiiiir���r����i)�list�sort�pluralizable�join�id� enumeraterT����append�minr ���rY���r���r'���r*����writer+����packr ����array�tobytes)r���r"���rO����messages�ids�strs�offsets�messagerZ����msgstrs�idxrT���r\����keystart� valuestart�koffsets�voffsets�o1�l1�o2�l2s��� `` r#����write_mor|���m���sB�������`��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%���)r���r ���r���r���)F)r���rN���r"���r���rO���rP���r���rQ���)�__doc__� __future__r���rk���r+����typingr����babel.messages.catalogr���r���� _typeshedr���r���r ����__annotations__r���rM���r|���r���r%���r#����<module>r�������s������������#��"��"��"��"��"������� � � � �� �� �� �� �� �� ��3��3��3��3��3��3��3��3���6�5�5�5�5�5�5�5�5���������������������Q��Q��Q��Q�hg_��g_��g_��g_��g_��g_��g_r%���