ok

Mini Shell

Direktori : /proc/thread-self/root/lib64/python3.6/__pycache__/
Upload File :
Current File : //proc/thread-self/root/lib64/python3.6/__pycache__/gettext.cpython-36.pyc

3


 \T�@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)�plural�moZkind�value�r�/usr/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>msr3��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)r4z%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�jr1r2�rightZif_trueZif_falserrr rBpsP



rBcCs:yt|�}Wn(tk
r4td|jjf�d�YnX|S)Nz'Plural value must be an integer, got %s)�round�	TypeError�	__class__�__name__)r:r1rrr �_as_int�srQcCs�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 longrr8r4�z%plural form expression is too complexr9rQz�if True:
            def func(n):
                if not isinstance(n, int):
                    n = _as_int(n)
                return int(%s)
            �funcN)�lenrrBr!r"rQ�exec�RecursionError)rrHrIZdepth�c�nsrrr �c2py�s(

rYc
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)Nr4r��@r�.�_r4rZr>)rZ	normalizer�range�append�reverse)
�locZCOMPONENT_CODESETZCOMPONENT_TERRITORYZCOMPONENT_MODIFIER�mask�posZmodifier�codesetZ	territoryZlanguageZretr1�valrrr �_expand_lang�sJ










rfc@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�	_fallbackrB)�self�fprrr �__init__�szNullTranslations.__init__cCsdS)Nr)rkrlrrr rBszNullTranslations._parsecCs|jr|jj|�n||_dS)N)rj�add_fallback)rk�fallbackrrr rnszNullTranslations.add_fallbackcCs|jr|jj|�S|S)N)rjr)rk�messagerrr r	szNullTranslations.gettextcCs2|jr|jj|�S|jr$|j|j�S|jtj��S)N)rjrri�encoder�getpreferredencoding)rkrprrr rs
zNullTranslations.lgettextcCs*|jr|jj|||�S|dkr"|S|SdS)Nr4)rjr)rk�msgid1�msgid2r:rrr rs
zNullTranslations.ngettextcCsH|jr|jj|||�S|dkr$|}n|}|jr:|j|j�S|jtj��S)Nr4)rjrrirqrrr)rkrsrtr:�tmsgrrr rszNullTranslations.lngettextcCs|jS)N)rg)rkrrr �info(szNullTranslations.infocCs|jS)N)rh)rkrrr �charset+szNullTranslations.charsetcCs|jS)N)ri)rkrrr �output_charset.szNullTranslations.output_charsetcCs
||_dS)N)ri)rkrwrrr �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)rk�namesr{rrr r4s
zNullTranslations.install)N)N)rP�
__module__�__qualname__rmrBrnrrrrrvrwrxryrrrrr r�s
c@sHeZdZdZdZdZdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
dd�ZdS)rl�*l�$<rr4cCs|d?|d@fS)z/Returns a tuple of major version, minor version�i��r)rk�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)Nr4)rC)r:rrr �<lambda>Usz(GNUTranslations._parse.<locals>.<lambda>z<INr>rz<4IrRz<IIz>4Iz>IIzBad magic numberzBad version number �zFile is corrupt�
r@r4�
zcontent-typezcharset=zplural-forms�;zplural=�ascii�)�struct�unpack�getattr�_catalogr�readrT�LE_MAGIC�BE_MAGIC�OSErrorr��VERSIONS�strr^�split�decode�strip�lowerrgrhrY�	enumerate)"rkrlr��filenameZcatalogZbufZbuflen�magicr�ZmsgcountZ	masteridxZtransidxZiiZ
major_versionZ
minor_versionr1ZmlenZmoffZmendZtlenZtoffZtend�msgruZlastkZb_item�item�k�vrrwrsrt�xrrr rBNsr














zGNUTranslations._parsecCsRt�}|jj||�}||kr2|jr.|jj|�S|}|jrD|j|j�S|jtj��S)N)	�objectr�rFrjrrirqrrr)rkrp�missingrurrr r�szGNUTranslations.lgettextcCsvy|j||j|�f}Wn<tk
rT|jr>|jj|||�S|dkrL|}n|}YnX|jrh|j|j�S|jtj��S)Nr4)	r�r�KeyErrorrjrrirqrrr)rkrsrtr:rurrr r�s
zGNUTranslations.lngettextcCs6t�}|jj||�}||kr2|jr.|jj|�S|S|S)N)r�r�rFrjr)rkrpr�rurrr r�szGNUTranslations.gettextcCsZy|j||j|�f}Wn<tk
rT|jr>|jj|||�S|dkrL|}n|}YnX|S)Nr4)r�rr�rjr)rkrsrtr:rurrr r�s
zGNUTranslations.ngettextN)rr4)rPrr�r�r�r�r�rBrrrrrrrr rBsT	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�environrFr�r_rf�path�join�exists)�domain�	localedir�	languages�allZenvarreZnelangsZlangZnelangrH�mofilerrr r�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�
_translationsrF�open�
setdefault�copyryrn)r�r�r�Zclass_rordZmofilesrHr��key�trlrrr r�s*



cCst||d|d�}|j|�dS)NT)rord)rr)r�r�rdr~r�rrr rsZmessagescCs|dk	r|atS)N)�_current_domain)r�rrr r	'scCs|dk	r|t|<tj|t�S)N)�_localedirsrFr�)r�r�rrr r
.scCs|dk	r|t|<tj|�S)N)�_localecodesetsrF)r�rdrrr r5scCs@y t|tj|d�tj|�d�}Wntk
r4|SX|j|�S)N)rd)rr�rFr�r�r)r�rpr�rrr r<scCsRtj|�}yt|tj|d�|d�}Wn"tk
rF|j|pBtj��SX|j|�S)N)rd)	r�rFrr�r�rqrrrr)r�rprdr�rrr rDs
cCsTy t|tj|d�tj|�d�}Wn$tk
rD|dkr<|S|SYnX|j|||�S)N)rdr4)rr�rFr�r�r)r�rsrtr:r�rrr r
Ls
cCshtj|�}yt|tj|d�|d�}Wn4tk
rX|dkrB|}n|}|j|pTtj��SX|j|||�S)N)rdr4)	r�rFrr�r�rqrrrr)r�rsrtr:rdr�rurrr rWs
cCs
tt|�S)N)rr�)rprrr rcscCs
tt|�S)N)rr�)rprrr rfscCstt|||�S)N)r
r�)rsrtr:rrr riscCstt|||�S)N)rr�)rsrtr:rrr rls�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"rDr�rErBrQrYrfrrrr�rrr�r�r�r	r
rrrr
rrrrrrrrrr �<module>s^&8



1$*K
&






Zerion Mini Shell 1.0