Your IP : 18.116.28.79


Current Path : /opt/alt/python310/lib64/python3.10/__pycache__/
Upload File :
Current File : //opt/alt/python310/lib64/python3.10/__pycache__/gettext.cpython-310.opt-1.pyc

o

6��f�j�@s�dZddlZddlZddlZgd�Zej�ejdd�Ze�	dej
ejB�Zdd�Z
d	d
�ZdZdd
�eed�D�Zdddd�ZdGdd�Zdd�Zdd�Zdd�ZGdd�d�ZGdd�de�ZdHd!d"�ZiZd#gZdddd efd$d%�Zdedfd&d'�Ziaiad(adId)d*�Z dId+d,�Z!dId-d.�Z"d/d0�Z#d1d2�Z$d3d4�Z%d5d6�Z&d7d8�Z'd9d:�Z(d;d<�Z)d=d>�Z*d?d@�Z+dAdB�Z,dCdD�Z-dEdF�Z.eZ/dS)Ja�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
    ccsR�t�t|�D]}|j}|dkrq|�|�}|dkr td|��|VqdVdS)NZWHITESPACESZINVALIDz invalid token in plural form: %s�)�re�finditer�_token_pattern�	lastgroup�group�
ValueError)�pluralZmo�kind�value�r"�./opt/alt/python310/lib64/python3.10/gettext.py�	_tokenizeVs�

r$cCs|rtd|�Std�S)Nz#unexpected token in plural form: %szunexpected end of plural form)r)r!r"r"r#�_errorasr%))�||)�&&)z==z!=)�<�>z<=z>=)�+�-)�*�/�%cCs i|]\}}|D]}||�qqSr"r")�.0�i�ops�opr"r"r#�
<dictcomp>os r3��or�andz//)r&r'r-���cCs�d}t|�}|dkr|d7}t|�}|dks
|dkr/t|�\}}d||f}|dkr.td��n%|dkr:d	||f}nzt|d
�}WntyMt|�d�wd||f}t|�}d}|tvr�t|}||krgn(|d
vrs|d
vrsd|}t�||�}t||d�\}	}d|||	f}|}|tvs^||kr�dkr�nnd|}|dkr�|dkr�t|d�\}
}|dkr�t|��t|�\}}d|
||f}|dkr�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 %sr?�?r�:z%s if %s else %s)�next�_parser�intr%�_binary_ops�	_c2py_ops�get)�tokensZpriority�result�nexttok�subr!�jr0r2�rightZif_trueZif_falser"r"r#rCrsX��
��rCcCsTzt|�}Wntytd|jjf�d�wddl}|�d|jjftd�|S)Nz'Plural value must be an integer, got %srr?)�round�	TypeError�	__class__�__name__�warnings�warn�DeprecationWarning)r;r0rRr"r"r#�_as_int�s �����rUcCs�t|�dkr
td��z>tt|��\}}|rt|��d}|D]}|dkr0|d7}|dkr/td��q|dkr8|d8}qd	ti}td
||�|dWStyStd��w)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 longrr9r4�z%plural form expression is too complexr:rUz�if True:
            def func(n):
                if not isinstance(n, int):
                    n = _as_int(n)
                return int(%s)
            �func)�lenrrCr$r%rU�exec�RecursionError)rrIrJZdepth�c�nsr"r"r#�c2py�s4����
�r]cCs8ddl}|�|�}d}d}d}d}|�d�}|dkr+||d�}|d|�}||O}nd}|�d�}|dkrG||d�}|d|�}||O}nd}|�d�}|dkrc||d�}	|d|�}||O}nd}	|}
g}t|d�D]&}||@s�|
}
||@r�|
|	7}
||@r�|
|7}
||@r�|
|7}
|�|
�qo|��|S)	Nrr4�r?�@r�.�_)rZ	normalizer�range�append�reverse)ZlocrZCOMPONENT_CODESETZCOMPONENT_TERRITORYZCOMPONENT_MODIFIER�mask�posZmodifier�codesetZ	territoryZlanguageZretr0�valr"r"r#�_expand_lang�sH








�ric@s�eZdZddd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zddd�ZdS)rNcCs2i|_d|_d|_d|_|dur|�|�dSdS�N)�_info�_charset�_output_charset�	_fallbackrC��self�fpr"r"r#�__init__�s�zNullTranslations.__init__cCsdSrjr"ror"r"r#rCszNullTranslations._parsecCs |jr|j�|�dS||_dSrj)rn�add_fallback)rp�fallbackr"r"r#rs
s
zNullTranslations.add_fallbackcCs|jr	|j�|�S|Srj)rnr
)rp�messager"r"r#r
szNullTranslations.gettextcCs�ddl}|�dtd�ddl}|jr3|���|�ddt�|j�|�Wd�S1s.wY|jr<|�	|j�S|�	|�
��S)Nr�/lgettext() is deprecated, use gettext() insteadr^�ignore�.*\blgettext\b.*)rRrSrTrrn�catch_warnings�filterwarningsrrm�encode�getpreferredencoding)rprurRrr"r"r#rs�
�
 �zNullTranslations.lgettextcCs&|jr|j�|||�S|dkr|S|S�Nr4)rnr)rp�msgid1�msgid2r;r"r"r#r#s
zNullTranslations.ngettextcCs�ddl}|�dtd�ddl}|jr5|���|�ddt�|j�|||�Wd�S1s0wY|dkr<|}n|}|jrG|�	|j�S|�	|�
��S)Nr�1lngettext() is deprecated, use ngettext() insteadr^rw�.*\blngettext\b.*r4)rRrSrTrrnryrzrrmr{r|�rpr~rr;rRr�tmsgr"r"r#r+s$�
� �zNullTranslations.lngettextcCs|jr
|j�||�S|Srj)rnr)rp�contextrur"r"r#r=szNullTranslations.pgettextcCs(|jr|j�||||�S|dkr|S|Sr})rnr)rpr�r~rr;r"r"r#rBs
zNullTranslations.npgettextcC�|jSrj)rk�rpr"r"r#�infoJ�zNullTranslations.infocCr�rj)rlr�r"r"r#�charsetMr�zNullTranslations.charsetcCsddl}|�dtd�|jS)Nrzoutput_charset() is deprecatedr^�rRrSrTrm)rprRr"r"r#�output_charsetPs
�zNullTranslations.output_charsetcCs ddl}|�dtd�||_dS)Nrz"set_output_charset() is deprecatedr^r�)rpr�rRr"r"r#�set_output_charsetVs
�
z#NullTranslations.set_output_charsetcCsNddl}|j|jd<|dur#hd�}|t|�@D]}t||�|j|<qdSdS)Nrra>r
rrrrr)�builtinsr
�__dict__�set�getattr)rp�namesr�Zallowed�namer"r"r#r\s�zNullTranslations.installrj)rQ�
__module__�__qualname__rrrCrsr
rrrrrr�r�r�r�rr"r"r"r#r�s
rc@s\eZdZdZdZdZdZdd�Zdd�Zd	d
�Z	dd�Z
d
d�Zdd�Zdd�Z
dd�ZdS)rl�*l�$<z%s%s)rr4cCs|d?|d@fS)z/Returns a tuple of major version, minor version�i��r")rp�versionr"r"r#�
_get_versionsrszGNUTranslations._get_versionsc"Cs�ddlm}t|dd�}i|_}dd�|_|��}t|�}|d|dd	��d}||jkr>|d
|d	d��\}}	}
}d}n||jkrS|d
|d	d��\}}	}
}d}nt	dd|��|�
|�\}
}|
|jvrot	ddt|
�|��t
d|	�D]�}||||
|
d��\}}||}|||||d��\}}||}||kr�||kr�|||�}|||�}nt	dd|��|dk�r,d}|�d�D]l}|����}|s�q�|�d�r�|�d�r�q�d}}d|vr�|�dd�\}}|����}|��}||j|<|}n|�r|j|d|7<|dk�r|�d�d|_q�|dk�r+|�d�}|d�d�d}t|�|_q�|j�p1d}d|v�r\|�d�\}} |�d�}t||�}t|�D]\}}!t|!|�|||f<�qLn
t||�|t||�<|
d7}
|d7}qtdS)z8Override this method to support alternative .mo formats.r)�unpackr�rcSst|dk�Sr})rD)r;r"r"r#�<lambda>sz(GNUTranslations._parse.<locals>.<lambda>z<INr?z<4IrVz<IIz>4Iz>IIzBad magic numberzBad version number �zFile is corrupt�
z	#-#-#-#-#rAr4�
zcontent-typezcharset=zplural-forms�;zplural=�ascii�)Zstructr�r��_catalogr�readrX�LE_MAGIC�BE_MAGIC�OSErrorr��VERSIONS�strrb�split�decode�strip�
startswith�endswith�lowerrkrlr]�	enumerate)"rprqr��filenameZcatalogZbufZbuflen�magicr�ZmsgcountZ	masteridxZtransidxZiiZ
major_versionZ
minor_versionr0ZmlenZmoffZmendZtlenZtoffZtend�msgr�ZlastkZb_item�item�k�vrr�r~r�xr"r"r#rCvs|










�



�
�zGNUTranslations._parsecCspddl}|�dtd�ddl}t�}|j�||�}||ur(|jr&|j�|�S|}|j	r1|�
|j	�S|�
|���S)Nrrvr^)rRrSrTr�objectr�rGrnrrmr{r|)rprurRr�missingr�r"r"r#r�s�zGNUTranslations.lgettextcCs�ddl}|�dtd�ddl}z|j||�|�f}Wnty:|jr/|j�|||�YS|dkr6|}n|}Ynw|j	rD|�
|j	�S|�
|���S)Nrr�r^r4)rRrSrTrr�r�KeyErrorrnrrmr{r|r�r"r"r#r�s$���zGNUTranslations.lngettextcCs6t�}|j�||�}||ur|jr|j�|�S|S|Srj)r�r�rGrnr
)rprur�r�r"r"r#r
�szGNUTranslations.gettextcCs`z
|j||�|�f}W|Sty/|jr!|j�|||�YS|dkr*|}Y|S|}Y|Swr})r�rr�rnr)rpr~rr;r�r"r"r#r�s���zGNUTranslations.ngettextcCsF|j||f}t�}|j�||�}||ur!|jr|j�||�S|S|Srj)�CONTEXTr�r�rGrnr)rpr�ru�ctxt_msg_idr�r�r"r"r#rszGNUTranslations.pgettextc	Csp|j||f}z
|j||�|�f}W|Sty7|jr)|j�||||�YS|dkr2|}Y|S|}Y|Swr})r�r�rr�rnr)rpr�r~rr;r�r�r"r"r#rs���zGNUTranslations.npgettextN)rQr�r�r�r�r�r�r�rCrrr
rrrr"r"r"r#rfsY	
rFcCs�|durt}|dur)g}dD]}tj�|�}|r|�d�}nqd|vr)|�d�g}|D]}t|�D]}||vr>|�|�q3q-|rEg}	nd}	|D]&}|dkrR|	Stj�||dd|�}
tj�	|
�ro|rk|	�|
�qI|
SqI|	S)N)ZLANGUAGE�LC_ALL�LC_MESSAGESZLANGrA�Cr�z%s.mo)
�_default_localedir�os�environrGr�rcri�path�join�exists)�domain�	localedir�	languages�allZenvarrhZnelangsZlangZnelangrI�mofiler"r"r#rsB
�

����rZunspecifiedc	Cs<|durt}t|||dd�}|s!|rt�Sddlm}t|d|��d}|D]v}	|tj�|	�f}
t	�
|
�}|durUt|	d��}t	�|
||��}Wd�n1sPwYddl
}
|
�
|�}|tur�ddl}|�dtd�|r�|���|�d	d
t�|�|�Wd�n1s�wY|dur�|}q%|�|�q%|S)NT)r�r)�ENOENTz$No translation file found for domain�rbzparameter codeset is deprecatedr^rwz.*\bset_output_charset\b.*)rrr�errnor��FileNotFoundErrorr�r��abspath�
_translationsrG�open�
setdefault�copy�_unspecifiedrRrSrTryrzr�rs)r�r�r�Zclass_rtrgZmofilesr�rIr��key�trqr�rRr"r"r#rGsH�
�
�
��rcCst||d|d�}|�|�dS)NT)rtrg)rr)r�r�rgr�r�r"r"r#rrsrZmessagescCs|dur|atSrj)�_current_domain)r�r"r"r#r�srcCs|dur|t|<t�|t�Srj)�_localedirsrGr�)r�r�r"r"r#r	�sr	cCs0ddl}|�dtd�|dur|t|<t�|�S)Nrz'bind_textdomain_codeset() is deprecatedr^)rRrSrT�_localecodesetsrG)r�rgrRr"r"r#r
�s�
r
cCs8zt|t�|d��}Wnty|YSw|�|�Srj)rr�rGr�r
)r�rur�r"r"r#r�s�
rcCs�ddl}|�dtd�ddl}t�|�}z(|���|�ddt�t|t	�|d�|d�}Wd�n1s6wYWnt
yN|�|pJ|���YSw|���|�ddt�|�
|�Wd�S1sjwYdS)Nrz1ldgettext() is deprecated, use dgettext() insteadr^rw�.*\bparameter codeset\b.*�rgrx)rRrSrTrr�rGryrzrr�r�r{r|r)r�rurRrrgr�r"r"r#r�s.�

����
�$�rcCsLzt|t�|d��}Wnty|dkr|YS|YSw|�|||�Sr})rr�rGr�r)r�r~rr;r�r"r"r#r�s�rc	Cs�ddl}|�dtd�ddl}t�|�}z(|���|�ddt�t|t	�|d�|d�}Wd�n1s6wYWnt
yW|dkrJ|}n|}|�|pS|���YSw|���|�ddt�|�
|||�Wd�S1suwYdS)	Nrz3ldngettext() is deprecated, use dngettext() insteadr^rwr�r�r4r�)rRrSrTrr�rGryrzrr�r�r{r|r)	r�r~rr;rRrrgr�r�r"r"r#r�s4�

����
�$�rcCs:zt|t�|d��}Wnty|YSw|�||�Srj)rr�rGr�r)r�r�rur�r"r"r#r�s�rcCsNzt|t�|d��}Wnty|dkr|YS|YSw|�||||�Sr})rr�rGr�r)r�r�r~rr;r�r"r"r#r�s�rcCs
tt|�Srj)rr�)rur"r"r#r
�s
r
cCsZddl}|�dtd�|���|�ddt�tt|�Wd�S1s&wYdS)Nrrvr^rwz.*\bldgettext\b.*)rRrSrTryrzrr�)rurRr"r"r#r�s�
�$�rcCstt|||�Srj)rr�)r~rr;r"r"r#r�srcCs^ddl}|�dtd�|���|�ddt�tt|||�Wd�S1s(wYdS)Nrr�r^rwz.*\bldngettext\b.*)rRrSrTryrzrr�)r~rr;rRr"r"r#r�s�
�$�rcCstt||�Srj)rr�)r�rur"r"r#r�srcCstt||||�Srj)rr�)r�r~rr;r"r"r#rsr)r7)NNFrj)0�__doc__r�r�sys�__all__r�r��base_prefixr��compile�VERBOSE�DOTALLrr$r%rEr�rFrCrUr]rirrrr�r�rrr�r�r�rr	r
rrrrrrr
rrrrrrr"r"r"r#�<module>s^0
�

1$+h
9&
�+




	


?>