%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /proc/self/root/opt/alt/python27/lib/python2.7/site-packages/babel/messages/
Upload File :
Create Path :
Current File : //proc/self/root/opt/alt/python27/lib/python2.7/site-packages/babel/messages/pofile.pyc

�
��Qc@s�dZddlZddlZddlmZmZddlmZddlm	Z	d�Z
d�Zdde
dd�Zejd	�Zd
�Zddd
�Zde
e
e
e
e
e
d�ZdS(s�
    babel.messages.pofile
    ~~~~~~~~~~~~~~~~~~~~~

    Reading and writing of files in the ``gettext`` PO (portable object)
    format.

    :copyright: (c) 2013 by the Babel Team.
    :license: BSD, see LICENSE for more details.
i����N(tCatalogtMessage(twraptext(t	text_typecCs)d�}tjd�j||dd!�S(s�Reverse `escape` the given string.

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

    :param string: the string to unescape
    cSsC|jd�}|dkrdS|dkr/dS|dkr?dS|S(Nitns
tts	trs
(tgroup(tmatchtm((sF/opt/alt/python27/lib/python2.7/site-packages/babel/messages/pofile.pytreplace_escapesss\\([\\trn"])ii����(tretcompiletsub(tstringR
((sF/opt/alt/python27/lib/python2.7/site-packages/babel/messages/pofile.pytunescapes
	
cCs^d|krP|j�}|jd�r4|d}ntt|�}dj|�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
    s
s""itN(t
splitlinest
startswithtmapRtjoin(Rt
escaped_linestlines((sF/opt/alt/python27/lib/python2.7/site-packages/babel/messages/pofile.pytdenormalize,s

cs6td|d|d|��dg�dg�
g�g�g�
g�g�g�tg�g�tg�tg�	tg��������
���
��fd�������	��
�fd�}x	t|j��D]�\}}|j�}t|t�s|j�j�}n|j	d�r�t�d<�	d<�rU�rU��n|dj	d	�r�x\|d
j
�j�D]j}|jd	�}	|	dkryt
||	d�}Wntk
r�qnX�
j||	 |f�qqWq�|dj	d�r=x�|d
j
�jd�D]}
�j|
j��qWq�|dj	d�rtt�d<|||d
j
��q�|dj	d
�r�|d
j�}|r��j|�q�q��j|dj��q�|||�q�W�r���nG�dr2�s�s�r2�jd��jddg���n�S(sJRead messages from a ``gettext`` PO (portable object) file from the given
    file-like object and return a `Catalog`.

    >>> from datetime import datetime
    >>> from StringIO import StringIO
    >>> buf = StringIO('''
    ... #: main.py:1
    ... #, fuzzy, python-format
    ... msgid "foo %(name)s"
    ... msgstr "quux %(name)s"
    ...
    ... # A user comment
    ... #. An auto comment
    ... #: main.py:3
    ... msgid "bar"
    ... msgid_plural "baz"
    ... msgstr[0] "bar"
    ... msgstr[1] "baaz"
    ... ''')
    >>> 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'quux %(name)s')
      ([(u'main.py', 1)], set([u'fuzzy', u'python-format']))
      ([], [])
    ((u'bar', u'baz'), (u'bar', u'baaz'))
      ([(u'main.py', 3)], set([]))
      ([u'A user comment'], [u'An auto comment'])

    .. versionadded:: 1.0
       Added support for explicit charset argument.

    :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
    :param charset: the character set of the catalog.
    tlocaletdomaintcharsetics��
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�}�r#tdj
���}nd}t||t��t
����d�	ddd|�}�dr��s�|�j|<q�n
|�|<�2�
2�2�2�2�2�2t�d<�dcd7<dS(NiiRs
tlinenotcontext(tsorttlenttupleRt
isinstancetlisttrangetnum_pluralstappendt
IndexErrorRtNoneRtsettobsoletetFalse(R	tmsgidRtidxRtmsgctxttmessage(t
auto_commentstcatalogRtcountertflagstignore_obsoletet	locationstmessagesR(toffsetttranslationst
user_comments(sF/opt/alt/python27/lib/python2.7/site-packages/babel/messages/pofile.pyt_add_message�s@
(
,	


cs�|jd�r9t�d<|dj�}�j|�n�|jd�r�t�d<|�d<|dj�}�r|��n�j|�ne|jd�r"t�d<t�d<|dj�}|jd�r|d	jd
d	�\}}�jt|�|j�g�q��jd|g�n�|jd�rm�rA��nt�d<�d<�j|dj��n�|jd
�r��dr��dcd|j�7<q��dr��dd	cd|j�7<q��dr��j|j��q�ndS(Ntmsgid_pluraliiR*itmsgstrit[it]R,it"i����u
(RtTruetlstripR$R)tsplittinttrstrip(RtlinetmsgttxtR+(R8Rt
in_msgctxttin_msgidt	in_msgstrR4R5R6(sF/opt/alt/python27/lib/python2.7/site-packages/babel/messages/pofile.pyt_process_message_line�s>





"


!
t#it:it,t~t.u(RR)t	enumeratet	readlineststripR RtdecodeRRR?R@trfindRAt
ValueErrorR$R>(tfileobjRRR2RRIRRCtlocationtpostflagtcomment((R8R.R/RR0R1R2RFRGRHR3R4R(R5R6R7sF/opt/alt/python27/lib/python2.7/site-packages/babel/messages/pofile.pytread_poKsh.						0!$"

! 



sL(\s+|[^\s\w]*\w+[a-zA-Z]-(?=\w+[a-zA-Z])|(?<=[\w\!\"\'\&\.\,\?])-{2,}(?=\w))cCsDd|jdd�jdd�jdd�jdd	�jd
d�S(s�Escape 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
    s"%s"s\s\\s	s\ts
s\rs
s\ns"s\"(treplace(R((sF/opt/alt/python27/lib/python2.7/site-packages/babel/messages/pofile.pytescapes
RiLc
	Cs�|r-|dkr-t|�}g}x|jt�D]�}tt|��||krtj|�}|j�x�|rg}d}xu|r�tt|d��d|}	||	|kr�|j|j��||	7}q�|s�|j|j��nPq�W|jdj	|��qrWq4|j|�q4Wn|jt�}t|�dkrXt|�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
    iii����uis
u""
u
(
RRR>R\tWORD_SEPR@treverseR$tpopR(
Rtprefixtwidtht	prefixlenRRCtchunkstbuftsizetl((sF/opt/alt/python27/lib/python2.7/site-packages/babel/messages/pofile.pyt	normalizes6
		

c	
s�d�fd����fd��d��fd�}	d���fd�}
t��}|rp|j�n|r�|jd��nx�|D]�}|js"|r�q�n�j}
�r�dkrg}x0|
j�D]"}|t|d�d	d
�7}q�Wdj|�}
n�|
d�nx|jD]}|	|�q,Wx!|jD]}|	|dd
�qJW|s�djg|j	D]+\}}d|j
tjd�|f^qz�}|	|dd�n|j
r��ddjdgt|j
���n|jr`|r`|	d�|jd�dd�t|j�dkr`|	d�|jd�dd�q`n|
|��d�q�W|s�xR�jj�D]>}x|jD]}|	|�q�W|
|dd��d�q�WndS(svWrite 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',))
    <Message...>
    >>> catalog.add((u'bar', u'baz'), locations=[('main.py', 3)])
    <Message...>
    >>> from io import BytesIO
    >>> buf = BytesIO()
    >>> 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
    Rcst|d|d��S(NR`Ra(Rg(tkeyR`(Ra(sF/opt/alt/python27/lib/python2.7/site-packages/babel/messages/pofile.pyt
_normalize~scs8t|t�r'|j�jd�}n�j|�dS(Ntbackslashreplace(R RtencodeRtwrite(ttext(R/RU(sF/opt/alt/python27/lib/python2.7/site-packages/babel/messages/pofile.pyt_write�scsY�r�dkr�}nd}x1t||�D] }�d||j�f�q1WdS(NiiLs#%s %s
(RRQ(RYR`t_widthRC(RnRa(sF/opt/alt/python27/lib/python2.7/site-packages/babel/messages/pofile.pyt_write_comment�s
	csjt|jttf�r�|jrD�d|�|j|�f�n�d|�|jd|�f��d|�|jd|�f�x�t�j�D]Q}y|j|}Wntk
r�d}nX�d||�||�f�q�Wnr|jr �d|�|j|�f�n�d|�|j|�f��d|�|jpXd|�f�dS(	Ns
%smsgctxt %s
s%smsgid %s
is%smsgid_plural %s
iRs%smsgstr[%d] %s
s%smsgstr %s
(	R tidR!RRR"R#RR%(R-R`R+R(RiRnR/(sF/opt/alt/python27/lib/python2.7/site-packages/babel/messages/pofile.pyt_write_message�s(		$

!		 cSst|j|j�S(N(tcmpR3(txty((sF/opt/alt/python27/lib/python2.7/site-packages/babel/messages/pofile.pyt<lambda>�siRatsubsequent_indents# u
R`RNu u%s:%dt/RKs#%s
s, smsgid %st|ismsgid_plural %ss
s#~ N(R!RRqtheader_commentRRRR7R.R3R[tostsepR1tsortedtprevious_idRR(tvalues(RUR/Ratno_locationtomit_headertsort_outputtsort_by_fileR2tinclude_previousRpRrR4R-tcomment_headerRRCRYtfilenameRtlocs((RiRnR/RURasF/opt/alt/python27/lib/python2.7/site-packages/babel/messages/pofile.pytwrite_poQs\-


			;	*	

(t__doc__R{Rtbabel.messages.catalogRRt
babel.utilRt
babel._compatRRRR&R)RZRR]R\RgR�(((sF/opt/alt/python27/lib/python2.7/site-packages/babel/messages/pofile.pyt<module>s		�	=		

Zerion Mini Shell 1.0