/usr/lib/python3/dist-packages/babel/messages/__pycache__
Edit: /usr/lib/python3/dist-packages/babel/messages/__pycache__/pofile.cpython-310.pyc (18830B)
o
^hU @ s d Z ddlmZ ddlZddlZddlmZmZ ddlm Z ddl
mZmZ dd Z
d d
ZG dd deZG d
d deZG dd deZd ddZedZdd Zd!ddZ d"ddZdd ZdS )#z
babel.messages.pofile
~~~~~~~~~~~~~~~~~~~~~
Reading and writing of files in the ``gettext`` PO (portable object)
format.
:copyright: (c) 2013-2019 by the Babel Team.
:license: BSD, see LICENSE for more details.
)print_functionN)CatalogMessage)wraptext) text_typecmpc C s" dd }t d|| dd S )zReverse `escape` the given string.
>>> print(unescape('"Say:\\n \\"hello, world!\\"\\n"'))
Say:
"hello, world!"
:param string: the string to unescape
c S s2 | d}|dkrdS |dkrdS |dkrdS |S )N n
t r
)group)matchm r 7/usr/lib/python3/dist-packages/babel/messages/pofile.pyreplace_escapes s
z!unescape..replace_escapesz\\([\\trn"])r )recompilesub)stringr r r r unescape s
r c C sB d| v r| }| dr|dd }tt|}d|S t| S )a Reverse the normalization done by the `normalize` function.
>>> print(denormalize(r'''""
... "Say:\n"
... " \"hello, world!\"\n"'''))
Say:
"hello, world!"
>>> print(denormalize(r'''""
... "Say:\n"
... " \"Lorem ipsum dolor sit "
... "amet, consectetur adipisicing"
... " elit, \"\n"'''))
Say:
"Lorem ipsum dolor sit amet, consectetur adipisicing elit, "
:param string: the string to denormalize
r
""r N )
splitlines
startswithmapr join)r
escaped_lineslinesr r r denormalize- s
r# c s e Zd ZdZ fddZ ZS )PoFileErrorzDException thrown by PoParser when an invalid po file is encountered.c s0 t t| dj||d || _|| _|| _d S )Nz{message} on {lineno})messagelineno)superr$ __init__formatcatalogliner&