Your IP : 3.15.26.231


Current Path : /opt/alt/python38/lib64/python3.8/__pycache__/
Upload File :
Current File : //opt/alt/python38/lib64/python3.8/__pycache__/gettext.cpython-38.pyc

U

i�fj�@s�dZddlZddlZddlZddlZddddddd	d
ddd
ddddddddddgZej�ejdd�Z	e�
dejejB�Z
dd�Zdd�ZdZd d!�eed"�D�Zd#d$d%d&�ZdGd(d)�Zd*d+�Zd,d-�Zd.d/�ZGd0d�d�ZGd1d�de�ZdHd3d�ZiZd4gZdddd2efd5d�Zdedfd6d�Ziaiad7a dId8d	�Z!dJd9d
�Z"dKd:d�Z#d;d�Z$d<d�Z%d=d
�Z&d>d�Z'd?d�Z(d@d�Z)dAd�Z*dBd�Z+dCd�Z,dDd�Z-dEd�Z.dFd�Z/eZ0dS)La�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�NullTranslations�GNUTranslations�Catalog�find�translation�install�
textdomain�bindtextdomain�bind_textdomain_codeset�dgettext�	dngettext�gettext�lgettext�	ldgettext�
ldngettext�	lngettext�ngettext�pgettext�	dpgettext�	npgettext�
dnpgettextZshare�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
    ccsPt�t|�D]8}|j}|dkr q|�|�}|dkr>td|��|VqdVdS)NZWHITESPACESZINVALIDz invalid token in plural form: %s�)�re�finditer�_token_pattern�	lastgroup�group�
ValueError)�pluralZmoZkind�value�r!�,/opt/alt/python38/lib64/python3.8/gettext.py�	_tokenizeWs
r#cCs|rtd|�Std�SdS)Nz#unexpected token in plural form: %szunexpected end of plural form)r)r r!r!r"�_errorbsr$))�||)�&&)z==z!=)�<�>z<=z>=)�+�-)�*�/�%cCs i|]\}}|D]
}||�qqSr!r!)�.0�iZops�opr!r!r"�
<dictcomp>ps
r1��or�andz//)r%r&r,���cCs�d}t|�}|dkr&|d7}t|�}q|dkrXt|�\}}d||f}|dkr�td��nP|dkrnd	||f}n:zt|d
�}Wntk
r�t|�d�YnXd||f}t|�}d}|tk�rt|}||krҐq|d
kr�|d
kr�d|}t�||�}t||d�\}	}d|||	f}|}q�||k�r4dk�r@nnd|}|dk�r�|dk�r�t|d�\}
}|dk�rtt|��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)r2z%s %s %sr=�?r�:z%s if %s else %s)�next�_parser�intr$�_binary_ops�	_c2py_ops�get)�tokensZpriority�result�nexttok�subr �jr/r0�rightZif_trueZif_falser!r!r"rAssP




rAcCsZzt|�}Wn(tk
r4td|jjf�d�YnXddl}|�d|jjftd�|S)Nz'Plural value must be an integer, got %srr=)�round�	TypeError�	__class__�__name__�warnings�warn�DeprecationWarning)r9r/rPr!r!r"�_as_int�s ����rScCs�t|�dkrtd��z|tt|��\}}|r2t|��d}|D]6}|dkr`|d7}|dkrptd��q:|dkr:|d8}q:d	ti}td
||�|dWStk
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 longrr7r2�z%plural form expression is too complexr8rSz�if True:
            def func(n):
                if not isinstance(n, int):
                    n = _as_int(n)
                return int(%s)
            �funcN)�lenrrAr#r$rS�exec�RecursionError)rrGrHZdepth�c�nsr!r!r"�c2py�s.

��
r[c
Cs4t�|�}d}d}d}d}|�d�}|dkrN||d�}|d|�}||O}nd}|�d�}|dkr�||d�}|d|�}||O}nd}|�d�}|dkr�||d�}|d|�}||O}nd}|}	g}
t|d�D]P}||@s�|	}||@r�||7}||@�r
||7}||@�r||7}|
�|�q�|
��|
S)	Nr2�r=r�@r�.�_)rZ	normalizer�range�append�reverse)
ZlocZCOMPONENT_CODESETZCOMPONENT_TERRITORYZCOMPONENT_MODIFIER�mask�posZmodifier�codesetZ	territoryZlanguageZretr/�valr!r!r"�_expand_lang�sJ









rgc@s�eZdZddd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zddd�ZdS) rNcCs.i|_d|_d|_d|_|dk	r*|�|�dS�N)�_info�_charset�_output_charset�	_fallbackrA��self�fpr!r!r"�__init__�szNullTranslations.__init__cCsdSrhr!rmr!r!r"rAszNullTranslations._parsecCs|jr|j�|�n||_dSrh)rl�add_fallback)rn�fallbackr!r!r"rq
szNullTranslations.add_fallbackcCs|jr|j�|�S|Srh)rlr
)rn�messager!r!r"r
szNullTranslations.gettextc
Csrddl}|�dtd�|jrR|���(|�ddt�|j�|�W5QR�SQRX|jrd|�|j�S|�t	�
��S)Nr�/lgettext() is deprecated, use gettext() insteadr\�ignore�.*\blgettext\b.*)rPrQrRrl�catch_warnings�filterwarningsrrk�encoder�getpreferredencoding)rnrsrPr!r!r"rs�
�zNullTranslations.lgettextcCs*|jr|j�|||�S|dkr"|S|SdS�Nr2)rlr)rn�msgid1�msgid2r9r!r!r"r"s
zNullTranslations.ngettextc
Cs�ddl}|�dtd�|jrV|���,|�ddt�|j�|||�W5QR�SQRX|dkrd|}n|}|jrz|�|j�S|�t	�
��S)Nr�1lngettext() is deprecated, use ngettext() insteadr\ru�.*\blngettext\b.*r2)rPrQrRrlrwrxrrkryrrz�rnr|r}r9rP�tmsgr!r!r"r*s"�
�"zNullTranslations.lngettextcCs|jr|j�||�S|Srh)rlr)rn�contextrsr!r!r"r;szNullTranslations.pgettextcCs,|jr|j�||||�S|dkr$|S|SdSr{)rlr)rnr�r|r}r9r!r!r"r@s
zNullTranslations.npgettextcCs|jSrh)ri�rnr!r!r"�infoHszNullTranslations.infocCs|jSrh)rjr�r!r!r"�charsetKszNullTranslations.charsetcCsddl}|�dtd�|jS)Nrzoutput_charset() is deprecatedr\�rPrQrRrk)rnrPr!r!r"�output_charsetNs�zNullTranslations.output_charsetcCs ddl}|�dtd�||_dS)Nrz"set_output_charset() is deprecatedr\r�)rnr�rPr!r!r"�set_output_charsetTs�z#NullTranslations.set_output_charsetcCsRddl}|j|jd<|dk	rNddddddh}|t|�@D]}t||�|j|<q8dS)	Nrr_r
rrrrr)�builtinsr
�__dict__�set�getattr)rn�namesr�Zallowed�namer!r!r"rZs�zNullTranslations.install)N)N)rO�
__module__�__qualname__rprArqr
rrrrrr�r�r�r�rr!r!r!r"r�s

c@s\eZdZdZdZdZdZdd�Zdd�Zd	d
�Z	dd�Z
d
d�Zdd�Zdd�Z
dd�ZdS)rl�*l�$<z%s%s)rr2cCs|d?|d@fS)z/Returns a tuple of major version, minor version�i��r!)rn�versionr!r!r"�
_get_versionspszGNUTranslations._get_versionsc"Cs�ddlm}t|dd�}i|_}dd�|_|��}t|�}|d|dd	��d}||jkr||d
|d	d��\}}	}
}d}n6||jkr�|d
|d	d��\}}	}
}d}nt	dd|��|�
|�\}
}|
|jkr�t	ddt|
�|��t
d|	�D�]}||||
|
d��\}}||}|||||d��\}}||}||k�r`||k�r`|||�}|||�}nt	dd|��|dk�rld}|�d�D]�}|����}|�s��q�|�d��r�|�d��r��q�d}}d|k�r|�dd�\}}|����}|��}||j|<|}n|�r|j|d|7<|dk�r8|�d�d|_n0|dk�r�|�d�}|d�d�d}t|�|_�q�|j�pvd}d|k�r�|�d�\}} |�d�}t||�}t|�D]\}}!t|!|�|||f<�q�nt||�|t||�<|
d7}
|d7}q�dS)z8Override this method to support alternative .mo formats.r)�unpackr�rcSst|dk�Sr{)rB)r9r!r!r"�<lambda>}�z(GNUTranslations._parse.<locals>.<lambda>z<INr=z<4IrTz<IIz>4Iz>IIzBad magic numberzBad version number �zFile is corrupt�
z	#-#-#-#-#r?r2�
zcontent-typezcharset=zplural-forms�;zplural=�ascii�)Zstructr�r��_catalogr�readrV�LE_MAGIC�BE_MAGIC�OSErrorr��VERSIONS�strr`�split�decode�strip�
startswith�endswith�lowerrirjr[�	enumerate)"rnror��filenameZcatalogZbufZbuflen�magicr�ZmsgcountZ	masteridxZtransidxZiiZ
major_versionZ
minor_versionr/ZmlenZmoffZmendZtlenZtoffZtend�msgr�ZlastkZb_item�item�k�vrr�r|r}�xr!r!r"rAtsv














zGNUTranslations._parsecCshddl}|�dtd�t�}|j�||�}||krH|jrD|j�|�S|}|jrZ|�	|j�S|�	t
���S)Nrrtr\)rPrQrR�objectr�rErlrrkryrrz)rnrsrP�missingr�r!r!r"r�s�zGNUTranslations.lgettextcCs�ddl}|�dtd�z|j||�|�f}Wn@tk
rn|jrX|j�|||�YS|dkrf|}n|}YnX|jr�|�	|j�S|�	t
���S)Nrr~r\r2)rPrQrRr�r�KeyErrorrlrrkryrrzr�r!r!r"r�s �
zGNUTranslations.lngettextcCs6t�}|j�||�}||kr2|jr.|j�|�S|S|Srh)r�r�rErlr
)rnrsr�r�r!r!r"r
�szGNUTranslations.gettextcCs^z|j||�|�f}Wn@tk
rX|jrB|j�|||�YS|dkrP|}n|}YnX|Sr{)r�rr�rlr)rnr|r}r9r�r!r!r"r�s
zGNUTranslations.ngettextcCsF|j||f}t�}|j�||�}||krB|jr>|j�||�S|S|Srh)�CONTEXTr�r�rErlr)rnr�rs�ctxt_msg_idr�r�r!r!r"rszGNUTranslations.pgettextc	Csn|j||f}z|j||�|�f}WnBtk
rh|jrR|j�||||�YS|dkr`|}n|}YnX|Sr{)r�r�rr�rlr)rnr�r|r}r9r�r�r!r!r"rs
zGNUTranslations.npgettextN)rOr�r�r�r�r�r�r�rArrr
rrrr!r!r!r"rdsY	
FcCs�|dkrt}|dkrRg}dD]"}tj�|�}|r|�d�}q@qd|krR|�d�g}|D]$}t|�D]}||krf|�|�qfqZ|r�g}	nd}	|D]J}|dkr�q�tj�||dd|�}
tj�	|
�r�|r�|	�|
�q�|
Sq�|	S)N)ZLANGUAGE�LC_ALL�LC_MESSAGESZLANGr?�Cr�z%s.mo)
�_default_localedir�os�environrEr�rarg�path�join�exists)�domain�	localedir�	languages�allZenvarrfZnelangsZlangZnelangrG�mofiler!r!r"rs8


Zunspecifiedc
Cs|dkrt}t|||dd�}|sB|r*t�Sddlm}t|d|��d}|D]�}	|tj�|	�f}
t	�
|
�}|dkr�t|	d��}t	�|
||��}W5QRXddl
}
|
�
|�}|tk	r�ddl}|�dtd�|r�|���|�d	d
t�|�|�W5QRX|dk�r|}qJ|�|�qJ|S)NT)r�r)�ENOENTz$No translation file found for domain�rbzparameter codeset is deprecatedr\ruz.*\bset_output_charset\b.*)rrr�errnor��FileNotFoundErrorr�r��abspath�
_translationsrE�open�
setdefault�copy�_unspecifiedrPrQrRrwrxr�rq)r�r�r�Zclass_rrreZmofilesr�rGr��key�tror�rPr!r!r"rCsH�

�
�
cCst||d|d�}|�|�dS)NT)rrre)rr)r�r�rer�r�r!r!r"rnsZmessagescCs|dk	r|atSrh)�_current_domain)r�r!r!r"r|scCs|dk	r|t|<t�|t�Srh)�_localedirsrEr�)r�r�r!r!r"r	�scCs0ddl}|�dtd�|dk	r&|t|<t�|�S)Nrz'bind_textdomain_codeset() is deprecatedr\)rPrQrR�_localecodesetsrE)r�rerPr!r!r"r
�s�cCs:zt|t�|d��}Wntk
r.|YSX|�|�Srh)rr�rEr�r
)r�rsr�r!r!r"r�s

c
Cs�ddl}|�dtd�t�|�}z<|���*|�ddt�t|t�|d�|d�}W5QRXWn&t	k
r�|�
|pzt���YSX|���&|�ddt�|�
|�W5QR�SQRXdS)Nrz1ldgettext() is deprecated, use dgettext() insteadr\ru�.*\bparameter codeset\b.*�rerv)rPrQrRr�rErwrxrr�r�ryrrzr)r�rsrPrer�r!r!r"r�s&�

�$
�cCsRzt|t�|d��}Wn,tk
rB|dkr6|YS|YSYnX|�|||�Sr{)rr�rEr�r)r�r|r}r9r�r!r!r"r�sc
Cs�ddl}|�dtd�t�|�}z<|���*|�ddt�t|t�|d�|d�}W5QRXWn8t	k
r�|dkrz|}n|}|�
|p�t���YSX|���*|�ddt�|�
|||�W5QR�SQRXdS)	Nrz3ldngettext() is deprecated, use dngettext() insteadr\rur�r�r2r)rPrQrRr�rErwrxrr�r�ryrrzr)r�r|r}r9rPrer�r�r!r!r"r�s,�

�$
�cCs<zt|t�|d��}Wntk
r.|YSX|�||�Srh)rr�rEr�r)r�r�rsr�r!r!r"r�s

cCsTzt|t�|d��}Wn,tk
rB|dkr6|YS|YSYnX|�||||�Sr{)rr�rEr�r)r�r�r|r}r9r�r!r!r"r�scCs
tt|�Srh)rr�)rsr!r!r"r
�sc
CsNddl}|�dtd�|���&|�ddt�tt|�W5QR�SQRXdS)Nrrtr\ruz.*\bldgettext\b.*)rPrQrRrwrxrr�)rsrPr!r!r"r�s�
�cCstt|||�Srh)rr�)r|r}r9r!r!r"r�sc
CsRddl}|�dtd�|���*|�ddt�tt|||�W5QR�SQRXdS)Nrr~r\ruz.*\bldngettext\b.*)rPrQrRrwrxrr�)r|r}r9rPr!r!r"r�s�
�cCstt||�Srh)rr�)r�rsr!r!r"r�scCstt||||�Srh)rr�)r�r|r}r9r!r!r"r�s)r5)NNF)N)N)N)1�__doc__rr�r�sys�__all__r�r��base_prefixr��compile�VERBOSE�DOTALLrr#r$rCr�rDrArSr[rgrrrr�r�rrr�r�r�rr	r
rrrrrrr
rrrrrrr!r!r!r"�<module>s�0�
�

1$*f7
&�
+




	


?>