�
ƪb�U � �� � d Z ddlZddlZddlmZmZ ddlmZmZ d� Z d� Z
G d� de� Z G d � d
� Z
G d� d� Zdd
�Z ej d� Zd� Zdd�Z dd�Zd� Zy)z�
babel.messages.pofile
~~~~~~~~~~~~~~~~~~~~~
Reading and writing of files in the ``gettext`` PO (portable object)
format.
:copyright: (c) 2013-2022 by the Babel Team.
:license: BSD, see LICENSE for more details.
� N)�Catalog�Message)�wraptext�_cmpc �X � d� }t j d� j || dd � S )z�Reverse `escape` the given string.
>>> print(unescape('"Say:\\n \\"hello, world!\\"\\n"'))
Say:
"hello, world!"
<BLANKLINE>
:param string: the string to unescape
c �L � | j d� }|dk( ry|dk( ry|dk( ry|S )N� �n�
�t� �r�
)�group)�match�ms �7/usr/lib/python3/dist-packages/babel/messages/pofile.py�replace_escapesz!unescape.<locals>.replace_escapes s2 � ��K�K��N����8��
�#�X��
�#�X���� z\\([\\trn"])r ���)�re�compile�sub)�stringr s r �unescaper s+ � � � �:�:�o�&�*�*�?�F�1�R�L�I�Ir c � � d| v rG| j � }| j d� r|dd }t t |� }dj |� S t | � S )a� Reverse the normalization done by the `normalize` function.
>>> print(denormalize(r'''""
... "Say:\n"
... " \"hello, world!\"\n"'''))
Say:
"hello, world!"
<BLANKLINE>
>>> print(denormalize(r'''""
... "Say:\n"
... " \"Lorem ipsum dolor sit "
... "amet, consectetur adipisicing"
... " elit, \"\n"'''))
Say:
"Lorem ipsum dolor sit amet, consectetur adipisicing elit, "
<BLANKLINE>
:param string: the string to denormalize
r �""r N� )�
splitlines�
startswith�mapr �join)r �
escaped_lines�liness r �denormalizer% * sX � �* �v�~��)�)�+�
����T�"�)�!�"�-�M��H�m�,���w�w�u�~�����r c �" |