�
ƪ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� ZdS )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 �h � d� }t j d� � � || 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 �` � | � d� � }|dk rdS |dk rdS |dk rdS |S )N� �n�
�t� �r�
)�group)�match�ms �7/usr/lib/python3/dist-packages/babel/messages/pofile.py�replace_escapesz!unescape.<locals>.replace_escapes s@ � ��K�K��N�N����8�8��4�
�#�X�X��4�
�#�X�X��4��� z\\([\\trn"])r ���)�re�compile�sub)�stringr s r �unescaper s; � � � � � �:�o�&�&�*�*�?�F�1�R�4�L�I�I�Ir c �� � d| v r]| � � � }| � d� � r
|dd� }t t |� � }d� |� � 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% * so � �* �v�~�~��)�)�+�+�
����T�"�"� .�)�!�"�"�-�M��H�m�,�,���w�w�u�~�~������r c �" |