ok

Mini Shell

Direktori : /proc/thread-self/root/usr/lib64/python2.7/
Upload File :
Current File : //proc/thread-self/root/usr/lib64/python2.7/gettext.pyc

�
\цdc@s�dZddlZddlZddlZddlZddlZddlZddlmZdddddd	d
ddd
ddgZ	ej
jejdd�Z
d�Zd�Zd�Zdd'd��YZdefd��YZdddd�ZiZdddedd�Zdeddd�Ziaiadadd�Zdd�Zdd�Zd�Zd �Z d!�Z!d"�Z"d#�Z#d$�Z$d%�Z%d&�Z&eZ'dS((s�Internationalization and localization support.

This module provides internationalization (I18N) and localization (L10N)
support for your Python programs by providing an interface to the GNU gettext
message catalog library.

I18N refers to the operation by which a program is made aware of multiple
languages.  L10N refers to the adaptation of your program, once
internationalized, to the local language and cultural habits.

i����N(tENOENTtNullTranslationstGNUTranslationstCatalogtfindttranslationtinstallt
textdomaintbindtextdomaintdgettextt	dngettexttgettexttngettexttsharetlocalecCs|r
|S|SdS(sy
    Implements the C expression:

      condition ? true : false

    Required to correctly interpret plural forms.
    N((t	conditionttruetfalse((s/usr/lib64/python2.7/gettext.pyttest=sc
syddlm}Wn!tk
r7ddlm}nXddl}ddl}|j||�j�}y@g|D]/}|d|jkrr|ddkrr|^qr}Wn|jk
r�t	d�nX|r�t	d�n|j
d	d
�}|j
dd�}tjd
���j
d|�}tjd����fd��dg}x�|D]�}|dkrr|jd�qP|dkr�t|�dkr�t	d�n�j
�|j��}	|dcd|	7<qP|dc|7<qPW�j
�|j��}td|�S(s�Gets a C expression as used in PO files for plural forms and returns a
    Python lambda function that implements an equivalent expression.
    i����(tStringIONiitns;plural forms expression error, maybe unbalanced parenthesiss*plural forms expression could be dangerouss&&s and s||s or s\!([^=])s not \1s(.*?)\?(.*?):(.*)cs8d|jd�|jd��j�|jd��fS(Nstest(%s, %s, %s)iii(tgrouptsub(tx(texprtrepl(s/usr/lib64/python2.7/gettext.pyRistt(t)s%unbalanced parenthesis in plural forms(%s)slambda n: int(%s)(t	cStringIORtImportErrorttokenttokenizetgenerate_tokenstreadlinetNAMEt
TokenErrort
ValueErrortreplacetretcompileRtappendtlentpopteval(
tpluralRRR ttokensRtdangertstacktcts((RRs/usr/lib64/python2.7/gettext.pytc2pyKs>
@
	
cCs�ddlm}||�}d
}d}d}d}|jd�}|dkrp||}|| }||O}nd}|jd�}|dkr�||}|| }||O}nd}|jd	�}|dkr�||}	|| }||O}nd}	|}
g}x~t|d�D]l}||@s|
}
||@rE|
|	7}
n||@r\|
|7}
n||@rs|
|7}
n|j|
�qqW|j�|S(
Ni����(t	normalizeiiit@Rt.t_iii(RR4RtrangeR)treverse(RR4tCOMPONENT_CODESETtCOMPONENT_TERRITORYtCOMPONENT_MODIFIERtmasktpostmodifiertcodesett	territorytlanguagetrettitval((s/usr/lib64/python2.7/gettext.pyt_expand_lang�sL















cBs�eZdd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d�Zd	�Zd
�Z
d�Zd�Zedd
�ZRS(cCsDi|_d|_d|_d|_|dk	r@|j|�ndS(N(t_infotNonet_charsett_output_charsett	_fallbackt_parse(tselftfp((s/usr/lib64/python2.7/gettext.pyt__init__�s				cCsdS(N((RMRN((s/usr/lib64/python2.7/gettext.pyRL�scCs)|jr|jj|�n	||_dS(N(RKtadd_fallback(RMtfallback((s/usr/lib64/python2.7/gettext.pyRP�s	cCs|jr|jj|�S|S(N(RKR(RMtmessage((s/usr/lib64/python2.7/gettext.pyR�s	cCs|jr|jj|�S|S(N(RKtlgettext(RMRR((s/usr/lib64/python2.7/gettext.pyRS�s	cCs7|jr|jj|||�S|dkr/|S|SdS(Ni(RKR(RMtmsgid1tmsgid2R((s/usr/lib64/python2.7/gettext.pyR�s
	cCs7|jr|jj|||�S|dkr/|S|SdS(Ni(RKt	lngettext(RMRTRUR((s/usr/lib64/python2.7/gettext.pyRV�s
	cCs#|jr|jj|�St|�S(N(RKtugettexttunicode(RMRR((s/usr/lib64/python2.7/gettext.pyRW�s	cCsC|jr|jj|||�S|dkr5t|�St|�SdS(Ni(RKt	ungettextRX(RMRTRUR((s/usr/lib64/python2.7/gettext.pyRY�s
	
cCs|jS(N(RG(RM((s/usr/lib64/python2.7/gettext.pytinfo�scCs|jS(N(RI(RM((s/usr/lib64/python2.7/gettext.pytcharset�scCs|jS(N(RJ(RM((s/usr/lib64/python2.7/gettext.pytoutput_charset�scCs
||_dS(N(RJ(RMR[((s/usr/lib64/python2.7/gettext.pytset_output_charset�scCs�ddl}|r|jp!|j|jd<t|d�r�d|kr]|jd|jd<nd|kr�|rx|jp~|j|jd<nd|kr�|j|jd<nd|kr�|j|jd<q�ndS(Ni����R7t__contains__RRRSRV(	t__builtin__RWRt__dict__thasattrRYRRSRV(RMRXtnamesR_((s/usr/lib64/python2.7/gettext.pyR�sN(t__name__t
__module__RHRORLRPRRSRRVRWRYRZR[R\R]tFalseR(((s/usr/lib64/python2.7/gettext.pyR�s												cBsSeZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
RS(	l�*l�$<cCs�tj}t|dd�}i|_}d�|_|j�}t|�}|d|d �d}||jkr�|d|dd!�\}}	}
}d	}nL||jkr�|d
|dd!�\}}	}
}d}nt	dd|��x�t
d|	�D]�}
||||
|
d
!�\}}||}|||||d
!�\}}||}||kr�||kr�|||!}|||!}nt	dd|��|dkr�d}}x%|j�D]}|j
�}|s�q�n|jd�r�q�nd|krH|jdd�\}}|j
�j�}|j
�}||j|<|}n |rh|j|cd|7<n|dkr�|jd�d|_q�|dkr�|jd�}|djd�d}t|�|_q�q�Wnd|kr|jd�\}}|jd�}|jrKt||j�}g|D]}t||j�^q*}nxktt|��D]}
||
|||
f<q^Wn:|jr�t||j�}t||j�}n|||<|
d
7}
|d
7}q�WdS(s8Override this method to support alternative .mo formats.tnameRcSst|dk�S(Ni(tint(R((s/usr/lib64/python2.7/gettext.pyt<lambda>
ss<Iiis<4Iis<IIs>4Is>IIsBad magic numberisFile is corruptt#t:is
scontent-typescharset=splural-formst;splural=tN(tstructtunpacktgetattrt_catalogR-treadR*tLE_MAGICtBE_MAGICtIOErrortxrangeRHt
splitlineststript
startswithtsplittlowerRGRIR3RXR8(RMRNRntfilenametcatalogtbuftbuflentmagictversiontmsgcountt	masteridxttransidxtiiRDtmlentmofftmendttlenttoffttendtmsgttmsgtlastktktitemtvR-RTRUR((s/usr/lib64/python2.7/gettext.pyRLsv	
"	"	 
 



	
	(	

cCs}t�}|jj||�}||krG|jrC|jj|�S|S|jr`|j|j�S|jry|j|j�S|S(N(tobjectRptgetRKRRJtencodeRI(RMRRtmissingR�((s/usr/lib64/python2.7/gettext.pyRYs				cCsst�}|jj||�}||krG|jrC|jj|�S|S|jr`|j|j�S|jtj��S(N(	R�RpR�RKRSRJR�Rtgetpreferredencoding(RMRRR�R�((s/usr/lib64/python2.7/gettext.pyRSgs			cCs�yV|j||j|�f}|jr8|j|j�S|jrQ|j|j�S|SWnDtk
r�|jr�|jj|||�S|dkr�|S|SnXdS(Ni(RpR-RJR�RItKeyErrorRKR(RMRTRURR�((s/usr/lib64/python2.7/gettext.pyRrs		
	cCs�yL|j||j|�f}|jr8|j|j�S|jtj��SWnDtk
r�|jr{|jj|||�S|dkr�|S|SnXdS(Ni(	RpR-RJR�RR�R�RKRV(RMRTRURR�((s/usr/lib64/python2.7/gettext.pyRV�s	
	cCsQt�}|jj||�}||krM|jrC|jj|�St|�S|S(N(R�RpR�RKRWRX(RMRRR�R�((s/usr/lib64/python2.7/gettext.pyRW�s		
cCs~y |j||j|�f}WnWtk
ry|jrO|jj|||�S|dkrjt|�}qzt|�}nX|S(Ni(RpR-R�RKRYRX(RMRTRURR�((s/usr/lib64/python2.7/gettext.pyRY�s 
	(RcRdRrRsRLRRSRRVRWRY(((s/usr/lib64/python2.7/gettext.pyRs	S						icCsT|dkrt}n|dkr�g}x9dD]1}tjj|�}|r.|jd�}Pq.q.Wd|kr�|jd�q�ng}xA|D]9}x0t|�D]"}||kr�|j|�q�q�Wq�W|r�g}	nd}	xl|D]d}|dkr�Pntjj	||dd|�}
tjj
|
�r�|rE|	j|
�qL|
Sq�q�W|	S(	NtLANGUAGEtLC_ALLtLC_MESSAGEStLANGRjtCs%s.mo(R�R�R�R�(RHt_default_localedirtostenvironR�RyR)RFtpathtjointexists(tdomaint	localedirt	languagestalltenvarREtnelangstlangtnelangtresulttmofile((s/usr/lib64/python2.7/gettext.pyR�s8	

	
c	Cs|dkrt}nt|||dd�}|sU|r@t�Sttd|��nd}x�|D]�}|tjj|�f}	t	j
|	�}
|
dkr�t|d��}t	j|	||��}
WdQXnt
j
|
�}
|r�|
j|�n|dkr|
}qb|j|
�qbW|S(NR�is$No translation file found for domaintrb(RHRRRRtRR�R�tabspatht
_translationsR�topent
setdefaulttcopyR]RP(R�R�R�tclass_RQR@tmofilesR�R�tkeyttRN((s/usr/lib64/python2.7/gettext.pyR�s*	
!	cCs/t||dtd|�}|j||�dS(NRQR@(RtTrueR(R�R�RXR@RbR�((s/usr/lib64/python2.7/gettext.pyR�stmessagescCs|dk	r|antS(N(RHt_current_domain(R�((s/usr/lib64/python2.7/gettext.pyR�s	cCs)|dk	r|t|<ntj|t�S(N(RHt_localedirsR�R�(R�R�((s/usr/lib64/python2.7/gettext.pyRs
cCs&|dk	r|t|<ntj|�S(N(RHt_localecodesetsR�(R�R@((s/usr/lib64/python2.7/gettext.pytbind_textdomain_codeset
s
cCsPy.t|tj|d�dtj|��}Wntk
rB|SX|j|�S(NR@(RR�R�RHR�RtR(R�RRR�((s/usr/lib64/python2.7/gettext.pyR	s
cCsPy.t|tj|d�dtj|��}Wntk
rB|SX|j|�S(NR@(RR�R�RHR�RtRS(R�RRR�((s/usr/lib64/python2.7/gettext.pyt	ldgettexts
cCsiy.t|tj|d�dtj|��}Wn%tk
rU|dkrN|S|SnX|j|||�S(NR@i(RR�R�RHR�RtR(R�RTRURR�((s/usr/lib64/python2.7/gettext.pyR
!s
cCsiy.t|tj|d�dtj|��}Wn%tk
rU|dkrN|S|SnX|j|||�S(NR@i(RR�R�RHR�RtRV(R�RTRURR�((s/usr/lib64/python2.7/gettext.pyt
ldngettext,s
cCs
tt|�S(N(R	R�(RR((s/usr/lib64/python2.7/gettext.pyR7scCs
tt|�S(N(R�R�(RR((s/usr/lib64/python2.7/gettext.pyRS:scCstt|||�S(N(R
R�(RTRUR((s/usr/lib64/python2.7/gettext.pyR=scCstt|||�S(N(R�R�(RTRUR((s/usr/lib64/python2.7/gettext.pyRV@s(((t__doc__RR�R�R'RmtsysterrnoRt__all__R�R�tprefixR�RR3RFRRRHRR�ReRRR�R�R�RRR�R	R�R
R�RRSRRVR(((s/usr/lib64/python2.7/gettext.pyt<module>s>&H			7	+T�&								

Zerion Mini Shell 1.0