ok

Mini Shell

Direktori : /opt/alt/python36/lib64/python3.6/__pycache__/
Upload File :
Current File : //opt/alt/python36/lib64/python3.6/__pycache__/gettext.cpython-36.pyc

3

)j�aT�@s�dZddlZddlZddlZddlZddlZddlZddlZddlm	Z	dddddd	d
ddd
dddddddgZ
ejjej
dd�ZejdejejB�Zdd�Zdd�ZdPZd)d*�eed+�D�Zd,d-d.d/�ZdRd0d1�Zd2d3�Zd4d5�Zd6d7�ZGd8d�d�ZGd9d�de�ZdSd;d�ZiZdTd<d�Z dUd=d	�Z!ia"ia#d>a$dVd?d
�Z%dWd@d�Z&dXdAd�Z'dBd
�Z(dCd�Z)dDd�Z*dEd�Z+dFd�Z,dGd�Z-dHd�Z.dId�Z/e Z0dS)Ya�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.

�N)�ENOENT�NullTranslations�GNUTranslations�Catalog�find�translation�install�
textdomain�bindtextdomain�bind_textdomain_codeset�dgettext�	dngettext�gettext�lgettext�	ldgettext�
ldngettext�	lngettext�ngettextZshare�localea�
        (?P<WHITESPACES>[ \t]+)                    | # spaces and horizontal tabs
        (?P<NUMBER>[0-9]+\b)                       | # decimal integer
        (?P<NAME>n\b)                              | # only n is allowed
        (?P<PARENTHESIS>[()])                      |
        (?P<OPERATOR>[-*/%+?:]|[><!]=?|==|&&|\|\|) | # !, *, /, %, +, -, <, >,
                                                     # <=, >=, ==, !=, &&, ||,
                                                     # ? :
                                                     # unary and bitwise ops
                                                     # not allowed
        (?P<INVALID>\w+|.)                           # invalid token
    ccsTxHtjt|�D]8}|j}|dkr"q|j|�}|dkr@td|��|VqWdVdS)NZWHITESPACESZINVALIDz invalid token in plural form: %s�)�re�finditer�_token_pattern�	lastgroup�group�
ValueError)�pluralZmoZkind�value�r�,/opt/alt/python36/lib64/python3.6/gettext.py�	_tokenizeTs

r cCs|rtd|�Std�SdS)Nz#unexpected token in plural form: %szunexpected end of plural form)r)rrrr�_error_sr!�||�&&�==�!=�<�>�<=�>=�+�-�*�/�%cCs i|]\}}|D]
}||�qqSrr)�.0�iZops�oprrr�
<dictcomp>msr2��or�andz//)z||z&&r-cCs�d}t|�}x|dkr(|d7}t|�}qW|dkr\t|�\}}d||f}|dkr�td��nP|dkrrd	||f}n:yt|d
�}Wntk
r�t|�d�YnXd||f}t|�}d}xh|tk�r t|}||kr�P|dkr�|dkr�d|}tj||�}t||d�\}	}d|||	f}|}q�W||k�o6dkn�rFd|}|dk�r�|dk�r�t|d�\}
}|dk�rzt|��t|�\}}d|
||f}|dk�r�d|}||fS)Nr�!znot �(z%s(%s)�)z%unbalanced parenthesis in plural form�nz%s%s�
z%s%d�d��z(%s)r3z%s %s %s�?r�:z%s if %s else %s)r<r=)r<r=)�next�_parser�intr!�_binary_ops�	_c2py_ops�get)�tokensZpriority�result�nexttok�subr�jr0r1�rightZif_trueZif_falserrrrApsP



rAcCs:yt|�}Wn(tk
r4td|jjf�d�YnX|S)Nz'Plural value must be an integer, got %s)�round�	TypeError�	__class__�__name__)r9r0rrr�_as_int�srPcCs�t|�dkrtd��y~tt|��\}}|r2t|��d}x>|D]6}|dkrb|d7}|dkrrtd��q<|dkr<|d8}q<Wd	ti}td
||�|dStk
r�td��YnXdS)
z�Gets a C expression as used in PO files for plural forms and returns a
    Python function that implements an equivalent expression.
    i�z"plural form expression is too longrr7r3�z%plural form expression is too complexr8rPz�if True:
            def func(n):
                if not isinstance(n, int):
                    n = _as_int(n)
                return int(%s)
            �funcN)�lenrrAr r!rP�exec�RecursionError)rrGrHZdepth�c�nsrrr�c2py�s(

rXc
Cs:tj|�}d}d	}d
}d}|jd�}|dkrN||d�}|d|�}||O}nd}|jd�}|dkr�||d�}|d|�}||O}nd}|jd�}|dkr�||d�}|d|�}||O}nd}|}	g}
xbt|d�D]R}||@s�|	}||@�r�||7}||@�r||7}||@�r ||7}|
j|�q�W|
j�|
S)Nr3r��@r�.�_r3rYr=)rZ	normalizer�range�append�reverse)
�locZCOMPONENT_CODESETZCOMPONENT_TERRITORYZCOMPONENT_MODIFIER�mask�posZmodifier�codesetZ	territoryZlanguageZretr0�valrrr�_expand_lang�sJ










rec@speZdZddd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
ddd�ZdS)rNcCs.i|_d|_d|_d|_|dk	r*|j|�dS)N)�_info�_charset�_output_charset�	_fallbackrA)�self�fprrr�__init__�szNullTranslations.__init__cCsdS)Nr)rjrkrrrrAszNullTranslations._parsecCs|jr|jj|�n||_dS)N)ri�add_fallback)rj�fallbackrrrrmszNullTranslations.add_fallbackcCs|jr|jj|�S|S)N)rir)rj�messagerrrr	szNullTranslations.gettextcCs2|jr|jj|�S|jr$|j|j�S|jtj��S)N)rirrh�encoder�getpreferredencoding)rjrorrrrs
zNullTranslations.lgettextcCs*|jr|jj|||�S|dkr"|S|SdS)Nr3)rir)rj�msgid1�msgid2r9rrrrs
zNullTranslations.ngettextcCsH|jr|jj|||�S|dkr$|}n|}|jr:|j|j�S|jtj��S)Nr3)rirrhrprrq)rjrrrsr9�tmsgrrrrszNullTranslations.lngettextcCs|jS)N)rf)rjrrr�info(szNullTranslations.infocCs|jS)N)rg)rjrrr�charset+szNullTranslations.charsetcCs|jS)N)rh)rjrrr�output_charset.szNullTranslations.output_charsetcCs
||_dS)N)rh)rjrvrrr�set_output_charset1sz#NullTranslations.set_output_charsetcCsvddl}|j|jd<t|d�rrd|kr6|jd|jd<d|krJ|j|jd<d|kr^|j|jd<d|krr|j|jd<dS)Nrr\�__contains__rrrr)�builtinsr�__dict__�hasattrrrr)rj�namesrzrrrr4s
zNullTranslations.install)N)N)rO�
__module__�__qualname__rlrArmrrrrrurvrwrxrrrrrr�s
c@sHeZdZdZdZdZdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
dd�ZdS)rl�*l�$<rr3cCs|d?|d@fS)z/Returns a tuple of major version, minor version�i��r)rj�versionrrr�
_get_versionsJszGNUTranslations._get_versionsc"Cs�tj}t|dd�}i|_}dd�|_|j�}t|�}|d|dd��d}||jkrv|d	|dd
��\}}	}
}d}n6||jkr�|d|dd
��\}}	}
}d
}nt	dd|��|j
|�\}
}|
|jkr�t	ddt|
�|���xt
d|	�D�]�}||||
|
d��\}}||}|||||d��\}}||}||k�r^||k�r^|||�}|||�}nt	dd|��|dk�rRd}x�|jd�D]�}|j�j�}|�s��q�d}}d|k�r�|jdd�\}}|j�j�}|j�}||j|<|}n|�r|j|d|7<|dk�r|jd�d|_n0|dk�r�|jd�}|djd�d}t|�|_�q�W|j�p\d}d|k�r�|jd�\}} |jd�}t||�}x>t|�D]\}}!t|!|�|||f<�q�Wnt||�|t||�<|
d7}
|d7}q�WdS)z8Override this method to support alternative .mo formats.�namercSst|dk�S)Nr3)rB)r9rrr�<lambda>Usz(GNUTranslations._parse.<locals>.<lambda>z<INr=rz<4IrQz<IIz>4Iz>IIzBad magic numberzBad version number �zFile is corrupt�
r?r3�
zcontent-typezcharset=zplural-forms�;zplural=�ascii�)�struct�unpack�getattr�_catalogr�readrS�LE_MAGIC�BE_MAGIC�OSErrorr��VERSIONS�strr]�split�decode�strip�lowerrfrgrX�	enumerate)"rjrkr��filenameZcatalogZbufZbuflen�magicr�ZmsgcountZ	masteridxZtransidxZiiZ
major_versionZ
minor_versionr0ZmlenZmoffZmendZtlenZtoffZtend�msgrtZlastkZb_item�item�k�vrrvrrrs�xrrrrANsr














zGNUTranslations._parsecCsRt�}|jj||�}||kr2|jr.|jj|�S|}|jrD|j|j�S|jtj��S)N)	�objectr�rErirrhrprrq)rjro�missingrtrrrr�szGNUTranslations.lgettextcCsvy|j||j|�f}Wn<tk
rT|jr>|jj|||�S|dkrL|}n|}YnX|jrh|j|j�S|jtj��S)Nr3)	r�r�KeyErrorrirrhrprrq)rjrrrsr9rtrrrr�s
zGNUTranslations.lngettextcCs6t�}|jj||�}||kr2|jr.|jj|�S|S|S)N)r�r�rErir)rjror�rtrrrr�szGNUTranslations.gettextcCsZy|j||j|�f}Wn<tk
rT|jr>|jj|||�S|dkrL|}n|}YnX|S)Nr3)r�rr�rir)rjrrrsr9rtrrrr�s
zGNUTranslations.ngettextN)rr3)rOr~rr�r�r�r�rArrrrrrrrrBsT	FcCs�|dkrt}|dkrTg}x(dD] }tjj|�}|r|jd�}PqWd|krT|jd�g}x0|D](}x"t|�D]}||krl|j|�qlWq^W|r�g}	nd}	xL|D]D}|dkr�Ptjj||dd|�}
tjj	|
�r�|r�|	j|
�q�|
Sq�W|	S)	N�LANGUAGE�LC_ALL�LC_MESSAGES�LANGr?�Cz%s.mo)r�r�r�r�)
�_default_localedir�os�environrEr�r^re�path�join�exists)�domain�	localedir�	languages�allZenvarrdZnelangsZlangZnelangrG�mofilerrrr�s8




cCs�|dkrt}t|||dd�}|s6|r*t�Sttd|��d}x�|D]|}|tjj|�f}	tj	|	�}
|
dkr�t
|d��}tj|	||��}
WdQRXtj|
�}
|r�|
j
|�|dkr�|
}q@|j|
�q@W|S)NT)r�z$No translation file found for domain�rb)rrrr�rr�r��abspath�
_translationsrE�open�
setdefault�copyrxrm)r�r�r�Zclass_rnrcZmofilesrGr��key�trkrrrr�s*



cCst||d|d�}|j|�dS)NT)rnrc)rr)r�r�rcr}r�rrrrsZmessagescCs|dk	r|atS)N)�_current_domain)r�rrrr	'scCs|dk	r|t|<tj|t�S)N)�_localedirsrEr�)r�r�rrrr
.scCs|dk	r|t|<tj|�S)N)�_localecodesetsrE)r�rcrrrr5scCs@y t|tj|d�tj|�d�}Wntk
r4|SX|j|�S)N)rc)rr�rEr�r�r)r�ror�rrrr<scCsRtj|�}yt|tj|d�|d�}Wn"tk
rF|j|pBtj��SX|j|�S)N)rc)	r�rErr�r�rprrqr)r�rorcr�rrrrDs
cCsTy t|tj|d�tj|�d�}Wn$tk
rD|dkr<|S|SYnX|j|||�S)N)rcr3)rr�rEr�r�r)r�rrrsr9r�rrrr
Ls
cCshtj|�}yt|tj|d�|d�}Wn4tk
rX|dkrB|}n|}|j|pTtj��SX|j|||�S)N)rcr3)	r�rErr�r�rprrqr)r�rrrsr9rcr�rtrrrrWs
cCs
tt|�S)N)rr�)rorrrrcscCs
tt|�S)N)rr�)rorrrrfscCstt|||�S)N)r
r�)rrrsr9rrrriscCstt|||�S)N)rr�)rrrsr9rrrrls�r"�r#�r$r%�r&r'r(r)�r*r+�r,r-r.)r�r�r�r�r�r����)r�)NNF)NNNFN)NNN)N)N)N)1�__doc__rr��ior�rr��sys�errnor�__all__r�r��base_prefixr��compile�VERBOSE�DOTALLrr r!rCr�rDrArPrXrerrrr�rrr�r�r�r	r
rrrr
rrrrrrrrrr�<module>s^&8



1$*K
&






Zerion Mini Shell 1.0