AnonSec Shell
Server IP : 85.193.89.191  /  Your IP : 3.149.234.209
Web Server : Apache
System : Linux 956367-cx40159.tmweb.ru 3.10.0-1160.105.1.el7.x86_64 #1 SMP Thu Dec 7 15:39:45 UTC 2023 x86_64
User : bitrix ( 600)
PHP Version : 8.1.27
Disable Function : NONE
MySQL : OFF  |  cURL : OFF  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /lib/python2.7/site-packages/babel/messages/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /lib/python2.7/site-packages/babel/messages/pofile.pyc
�
��Mc@s�dZddlmZmZddlZddlZddlmZddlm	Z	m
Z
ddlmZm
Z
mZddgZd	Zd
�Zd�Zdded�Zejd
�Zd�Zddd�Zdeeeeeed�ZdS(s�Reading and writing of files in the ``gettext`` PO (portable object)
format.

:see: `The Format of PO Files
       <http://www.gnu.org/software/gettext/manual/gettext.html#PO-Files>`_
i����(tdatetdatetimeN(t__version__(tCatalogtMessage(tsettwraptexttLOCALTZtread_potwrite_posrestructuredtext encCsG|dd!jdd�jdd�jdd�jd	d
�jdd�S(
s�Reverse `escape` the given string.

    >>> print unescape('"Say:\\n  \\"hello, world!\\"\\n"')
    Say:
      "hello, world!"
    <BLANKLINE>

    :param string: the string to unescape
    :return: the unescaped string
    :rtype: `str` or `unicode`
    ii����s\\s\s\ts	s\rs
s\ns
s\"s"(treplace(tstring((s9/usr/lib/python2.7/site-packages/babel/messages/pofile.pytunescape s
cCs^|jd�rPg}x+|j�dD]}|jt|��q&Wdj|�St|�SdS(s.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
    :return: the denormalized string
    :rtype: `unicode` or `str`
    s""itN(t
startswitht
splitlinestappendRtjoin(Rtlinestline((s9/usr/lib/python2.7/site-packages/babel/messages/pofile.pytdenormalize2s
cstd|d|��dg�dg�g�	g�g�g�g�
g�tg�
tg�tg��������	�
���
fd������	��fd�}x	t|j��D]�\}}|j�}t|t�s|j�j�}n|j	d�r�t�d<�d<�	r7�r7��n|dj	d�r�x\|d	j
�j�D]j}|jd�}|dkrayt
||d�}Wntk
r�qanX�j|| |f�qaqaWq�|dj	d
�rx�|d	j
�jd
�D]}	�j|	j��q�Wq�|dj	d�rVt�
d<|||d	j
��q�|dj	d�r�|d	j�}
|
r��j|
�q�q��
j|dj��q�|||�q�W�	r���nG�dr�s��
s��r�	jd
��jdd
g���n�S(s�Read messages from a ``gettext`` PO (portable object) file from the given
    file-like object and return a `Catalog`.

    >>> from StringIO import StringIO
    >>> buf = StringIO('''
    ... #: main.py:1
    ... #, fuzzy, python-format
    ... msgid "foo %(name)s"
    ... msgstr ""
    ...
    ... # A user comment
    ... #. An auto comment
    ... #: main.py:3
    ... msgid "bar"
    ... msgid_plural "baz"
    ... msgstr[0] ""
    ... msgstr[1] ""
    ... ''')
    >>> catalog = read_po(buf)
    >>> catalog.revision_date = datetime(2007, 04, 01)

    >>> for message in catalog:
    ...     if message.id:
    ...         print (message.id, message.string)
    ...         print ' ', (message.locations, message.flags)
    ...         print ' ', (message.user_comments, message.auto_comments)
    (u'foo %(name)s', '')
      ([(u'main.py', 1)], set([u'fuzzy', u'python-format']))
      ([], [])
    ((u'bar', u'baz'), ('', ''))
      ([(u'main.py', 3)], set([]))
      ([u'A user comment'], [u'An auto comment'])

    :param fileobj: the file-like object to read the PO file from
    :param locale: the locale identifier or `Locale` object, or `None`
                   if the catalog is not bound to a locale (which basically
                   means it's a template)
    :param domain: the message domain
    :param ignore_obsolete: whether to ignore obsolete messages in the input
    :return: an iterator over ``(message, translation, location)`` tuples
    :rtype: ``iterator``
    tlocaletdomainic
s��	j�t��dkrDtg�D]}t|�^q&�}nt�d�}t|ttf�r�g}xSt�j�D]B}y|j�	|�Wqt	k
r�|j|df�qXqWtg|D]}t|d�^q��}nt�	dd�}t
||t��t����
d�dd�}�dr]�sg|�j|<qgn
|�|<�2�	2�2�2�2�
2t
�d<�dcd7<dS(NiiR
tlineno(tsorttlenttupleRt
isinstancetlisttrangetnum_pluralsRt
IndexErrorRRtobsoletetFalse(tmtmsgidRtidxtttmessage(t
auto_commentstcatalogtcountertflagstignore_obsoletet	locationstmessagesR toffsetttranslationst
user_comments(s9/usr/lib/python2.7/site-packages/babel/messages/pofile.pyt_add_message�s6
(
,


cs�|jd�r9t�d<|dj�}�j|�nM|jd�r�t�d<|�d<|dj�}�r|��n�j|�n�|jd�r"t�d<t�d<|dj�}|jd�r|d	jd
d	�\}}�jt|�|j�g�q��jd|g�nd|jd�r��drX�dcd
|j�7<q��dr��dd	cd
|j�7<q�ndS(Ntmsgid_pluraliiR#itmsgstrit[it]t"i����u
(RtTruetlstripRR!tsplittinttrstrip(RRtmsgttxtR$(R1tin_msgidt	in_msgstrR-R.R/(s9/usr/lib/python2.7/site-packages/babel/messages/pofile.pyt_process_message_line�s0





"

t#it:it,t~t.u(RR!t	enumeratet	readlineststripRtunicodetdecodetcharsetRR8R9trfindR:t
ValueErrorRR7(tfileobjRRR+R@RRtlocationtpostflagtcomment((R1R'R(R)R*R+R>R?R,R-R R.R/R0s9/usr/lib/python2.7/site-packages/babel/messages/pofile.pyRQsd+					-

! 



sL(\s+|[^\s\w]*\w+[a-zA-Z]-(?=\w+[a-zA-Z])|(?<=[\w\!\"\'\&\.\,\?])-{2,}(?=\w))cCsDd|jdd�jdd�jdd�jdd	�jd
d�S(s4Escape the given string so that it can be included in double-quoted
    strings in ``PO`` files.

    >>> escape('''Say:
    ...   "hello, world!"
    ... ''')
    '"Say:\\n  \\"hello, world!\\"\\n"'

    :param string: the string to escape
    :return: the escaped string
    :rtype: `str` or `unicode`
    s"%s"s\s\\s	s\ts
s\rs
s\ns"s\"(R
(R((s9/usr/lib/python2.7/site-packages/babel/messages/pofile.pytescape�s

R
iLc	Cs�|r9|dkr9t|�}g}x!t|jt��D]�\}}tt|��||kr%tj|�}|j�x�|r!g}d}	xu|rtt|d��d|}
|	|
|kr�|j|j	��|	|
7}	q�|s|j|j	��nPq�W|jdj
|��q~Wq:|j|�q:Wn|jt�}t|�dkrdt|�S|r�|dr�|d=|dcd7<nddj
g|D]}
|t|
�^q��S(	s�Convert a string into a format that is appropriate for .po files.

    >>> print normalize('''Say:
    ...   "hello, world!"
    ... ''', width=None)
    ""
    "Say:\n"
    "  \"hello, world!\"\n"

    >>> print normalize('''Say:
    ...   "Lorem ipsum dolor sit amet, consectetur adipisicing elit, "
    ... ''', width=32)
    ""
    "Say:\n"
    "  \"Lorem ipsum dolor sit "
    "amet, consectetur adipisicing"
    " elit, \"\n"

    :param string: the string to normalize
    :param prefix: a string that should be prepended to every line
    :param width: the maximum line width; use `None`, 0, or a negative number
                  to completely disable line wrapping
    :return: the normalized string
    :rtype: `unicode`
    iii����uis
u""
u
(RRFRR7RStWORD_SEPR9treverseRtpopR(Rtprefixtwidtht	prefixlenRR$Rtchunkstbuftsizetl((s9/usr/lib/python2.7/site-packages/babel/messages/pofile.pyt	normalizes6"
		

c	
s�d��fd����fd��d��fd�}	d���fd�}
t��}|rs|j�n|r�|jd��nx�|D]�}|js%|r�q�n�j}
�r�dkrg}x0|
j�D]"}|t|d�d	d
�7}q�Wdj|�d}
n�|
�nx|jD]}|	|�q/Wx!|jD]}|	|dd
�qMW|s�djg|j	D]+\}}d|j
tjd�|f^q}�}|	|dd�n|j
r��ddjdgt|j
���n|jrc|rc|	d�|jd�dd�t|j�dkrc|	d�|jd�dd�qcn|
|��d�q�W|s�xR�jj�D]>}x|jD]}|	|�q�W|
|dd��d�q�WndS(s\Write a ``gettext`` PO (portable object) template file for a given
    message catalog to the provided file-like object.

    >>> catalog = Catalog()
    >>> catalog.add(u'foo %(name)s', locations=[('main.py', 1)],
    ...             flags=('fuzzy',))
    >>> catalog.add((u'bar', u'baz'), locations=[('main.py', 3)])
    >>> from StringIO import StringIO
    >>> buf = StringIO()
    >>> write_po(buf, catalog, omit_header=True)
    >>> print buf.getvalue()
    #: main.py:1
    #, fuzzy, python-format
    msgid "foo %(name)s"
    msgstr ""
    <BLANKLINE>
    #: main.py:3
    msgid "bar"
    msgid_plural "baz"
    msgstr[0] ""
    msgstr[1] ""
    <BLANKLINE>
    <BLANKLINE>

    :param fileobj: the file-like object to write to
    :param catalog: the `Catalog` instance
    :param width: the maximum line width for the generated output; use `None`,
                  0, or a negative number to completely disable line wrapping
    :param no_location: do not emit a location comment for every message
    :param omit_header: do not include the ``msgid ""`` entry at the top of the
                        output
    :param sort_output: whether to sort the messages in the output by msgid
    :param sort_by_file: whether to sort the messages in the output by their
                         locations
    :param ignore_obsolete: whether to ignore obsolete messages and not include
                            them in the output; by default they are included as
                            comments
    :param include_previous: include the old msgid as a comment when
                             updating the catalog
    R
cs%t|d|d��j�jd�S(NRWRXtbackslashreplace(R^tencodeRK(tkeyRW(R(RX(s9/usr/lib/python2.7/site-packages/babel/messages/pofile.pyt
_normalizeqscs5t|t�r$|j�j�}n�j|�dS(N(RRIR`RKtwrite(ttext(R(RN(s9/usr/lib/python2.7/site-packages/babel/messages/pofile.pyt_writeuscsY�r�dkr�}nd}x1t||�D] }�d||j�f�q1WdS(NiiLs#%s %s
(RRH(RRRWt_widthR(ReRX(s9/usr/lib/python2.7/site-packages/babel/messages/pofile.pyt_write_commentzs
	cst|jttf�r��d|�|jd|�f��d|�|jd|�f�x�t�j�D]Q}y|j|}Wntk
r�d}nX�d||�||�f�qpWnF�d|�|j|�f��d|�|jpd|�f�dS(Ns%smsgid %s
is%smsgid_plural %s
iR
s%smsgstr[%d] %s
s%smsgstr %s
(RtidRRRRRR(R&RWR$R(RbReR((s9/usr/lib/python2.7/site-packages/babel/messages/pofile.pyt_write_message�s$

! cSst|j|j�S(N(tcmpR,(txty((s9/usr/lib/python2.7/site-packages/babel/messages/pofile.pyt<lambda>�siRXtsubsequent_indents# u
RWREu u%s:%dt/RBs#%s
s, smsgid %st|ismsgid_plural %ss
s#~ N(RRRhtheader_commentRRRR0R'R,R
tostsepR*tprevious_idRR tvalues(RNR(RXtno_locationtomit_headertsort_outputtsort_by_fileR+tinclude_previousRgRiR-R&tcomment_headerRRRRtfilenameRtlocs((RbReR(RNRXs9/usr/lib/python2.7/site-packages/babel/messages/pofile.pyR	Fs\+


		
	;	*	

(t__doc__RRRrtretbabelRtVERSIONtbabel.messages.catalogRRt
babel.utilRRRt__all__t
__docformat__RRtNoneR!RtcompileRTRSR^R	(((s9/usr/lib/python2.7/site-packages/babel/messages/pofile.pyt<module>s"		�	>		

Anon7 - 2022
AnonSec Team