Your IP : 3.14.254.103


Current Path : /opt/alt/python39/lib64/python3.9/__pycache__/
Upload File :
Current File : //opt/alt/python39/lib64/python3.9/__pycache__/gettext.cpython-39.opt-1.pyc

a

R�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 dJd+d,�Z!dKd-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)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)�pluralZmo�kind�value�r"�,/opt/alt/python39/lib64/python3.9/gettext.py�	_tokenizeVs
r$cCs|rtd|�Std�SdS)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>o�r3��or�andz//)r&r'r-���cCs�d}t|�}|dkr&|d7}t|�}q|dkrXt|�\}}d||f}|dkr�td��nN|dkrnd	||f}n8zt|d
�}Wnty�t|�d�Yn0d||f}t|�}d}|tv�rt|}||krАq|d
vr�|d
vr�d|}t�||�}t||d�\}	}d|||	f}|}q�||k�r2dk�r>nnd|}|dk�r�|dk�r�t|d�\}
}|dk�rrt|��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)r5z%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#rDrsP




rDcCsXzt|�}Wn&ty2td|jjf�d�Yn0ddl}|�d|jjftd�|S)Nz'Plural value must be an integer, got %srr@)�round�	TypeError�	__class__�__name__�warnings�warn�DeprecationWarning)r<r0rSr"r"r#�_as_int�s����rVcCs�t|�dkrtd��z|tt|��\}}|r2t|��d}|D]6}|dkr`|d7}|dkrptd��q:|dkr:|d8}q:d	ti}td
||�|dWSty�td��Yn0d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 longrr:r5�z%plural form expression is too complexr;rVz�if True:
            def func(n):
                if not isinstance(n, int):
                    n = _as_int(n)
                return int(%s)
            �funcN)�lenrrDr$r%rV�exec�RecursionError)rrJrKZdepth�c�nsr"r"r#�c2py�s.

��
r^cCs>ddl}|�|�}d}d}d}d}|�d�}|dkrV||d�}|d|�}||O}nd}|�d�}|dkr�||d�}|d|�}||O}nd}|�d�}|dkr�||d�}	|d|�}||O}nd}	|}
g}t|d�D]R}||@s�|
}
||@�r|
|	7}
||@�r|
|7}
||@�r&|
|7}
|�|
�q�|��|S)	Nrr5�r@�@r�.�_)rZ	normalizer�range�append�reverse)ZlocrZCOMPONENT_CODESETZCOMPONENT_TERRITORYZCOMPONENT_MODIFIER�mask�posZmodifier�codesetZ	territoryZlanguageZretr0�valr"r"r#�_expand_lang�sF







rjc@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|_|dur*|�|�dS�N)�_info�_charset�_output_charset�	_fallbackrD��self�fpr"r"r#�__init__�szNullTranslations.__init__cCsdSrkr"rpr"r"r#rDszNullTranslations._parsecCs|jr|j�|�n||_dSrk)ro�add_fallback)rq�fallbackr"r"r#rt
szNullTranslations.add_fallbackcCs|jr|j�|�S|Srk)ror
)rq�messager"r"r#r
szNullTranslations.gettextcCs�ddl}|�dtd�ddl}|jrf|���*|�ddt�|j�|�Wd�S1s\0Y|jrx|�	|j�S|�	|�
��S)Nr�/lgettext() is deprecated, use gettext() insteadr_�ignore�.*\blgettext\b.*)rSrTrUrro�catch_warnings�filterwarningsrrn�encode�getpreferredencoding)rqrvrSrr"r"r#rs�
�*zNullTranslations.lgettextcCs*|jr|j�|||�S|dkr"|S|SdS�Nr5)ror)rq�msgid1�msgid2r<r"r"r#r#s
zNullTranslations.ngettextcCs�ddl}|�dtd�ddl}|jrj|���.|�ddt�|j�|||�Wd�S1s`0Y|dkrx|}n|}|jr�|�	|j�S|�	|�
��S)Nr�1lngettext() is deprecated, use ngettext() insteadr_rx�.*\blngettext\b.*r5)rSrTrUrrorzr{rrnr|r}�rqrr�r<rSr�tmsgr"r"r#r+s"�
�.zNullTranslations.lngettextcCs|jr|j�||�S|Srk)ror)rq�contextrvr"r"r#r=szNullTranslations.pgettextcCs,|jr|j�||||�S|dkr$|S|SdSr~)ror)rqr�rr�r<r"r"r#rBs
zNullTranslations.npgettextcCs|jSrk)rl�rqr"r"r#�infoJszNullTranslations.infocCs|jSrk)rmr�r"r"r#�charsetMszNullTranslations.charsetcCsddl}|�dtd�|jS)Nrzoutput_charset() is deprecatedr_�rSrTrUrn)rqrSr"r"r#�output_charsetPs
�zNullTranslations.output_charsetcCs ddl}|�dtd�||_dS)Nrz"set_output_charset() is deprecatedr_r�)rqr�rSr"r"r#�set_output_charsetVs
�z#NullTranslations.set_output_charsetcCsJddl}|j|jd<|durFhd�}|t|�@D]}t||�|j|<q0dS)Nrrb>rrr
rrr)�builtinsr
�__dict__�set�getattr)rq�namesr�Zallowed�namer"r"r#r\szNullTranslations.install)N)N)rR�
__module__�__qualname__rsrDrtr
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)rr5cCs|d?|d@fS)z/Returns a tuple of major version, minor version�i��r")rq�versionr"r"r#�
_get_versionsrszGNUTranslations._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|��|�
|�\}
}|
|jvr�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|v�r|�dd�\}}|����}|��}||j|<|}n|�r|j|d|7<|dk�r8|�d�d|_n0|dk�r�|�d�}|d�d�d}t|�|_�q�|j�pvd}d|v�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~)rE)r<r"r"r#�<lambda>r4z(GNUTranslations._parse.<locals>.<lambda>z<INr@z<4IrWz<IIz>4Iz>IIzBad magic numberzBad version number �zFile is corrupt�
z	#-#-#-#-#rBr5�
zcontent-typezcharset=zplural-forms�;zplural=�ascii�)Zstructr�r��_catalogr�readrY�LE_MAGIC�BE_MAGIC�OSErrorr��VERSIONS�strrc�split�decode�strip�
startswith�endswith�lowerrlrmr^�	enumerate)"rqrrr��filenameZcatalogZbufZbuflen�magicr�ZmsgcountZ	masteridxZtransidxZiiZ
major_versionZ
minor_versionr0ZmlenZmoffZmendZtlenZtoffZtend�msgr�ZlastkZb_item�item�k�vrr�rr��xr"r"r#rDvsv














zGNUTranslations._parsecCspddl}|�dtd�ddl}t�}|j�||�}||urP|jrL|j�|�S|}|j	rb|�
|j	�S|�
|���S)Nrrwr_)rSrTrUr�objectr�rHrorrnr|r})rqrvrSr�missingr�r"r"r#r�s�zGNUTranslations.lgettextcCs�ddl}|�dtd�ddl}z|j||�|�f}Wn>tyt|jr^|j�|||�YS|dkrl|}n|}Yn0|j	r�|�
|j	�S|�
|���S)Nrr�r_r5)rSrTrUrr�r�KeyErrorrorrnr|r}r�r"r"r#r�s �
zGNUTranslations.lngettextcCs6t�}|j�||�}||ur2|jr.|j�|�S|S|Srk)r�r�rHror
)rqrvr�r�r"r"r#r
�szGNUTranslations.gettextcCs\z|j||�|�f}Wn>tyV|jr@|j�|||�YS|dkrN|}n|}Yn0|Sr~)r�rr�ror)rqrr�r<r�r"r"r#r�s
zGNUTranslations.ngettextcCsF|j||f}t�}|j�||�}||urB|jr>|j�||�S|S|Srk)�CONTEXTr�r�rHror)rqr�rv�ctxt_msg_idr�r�r"r"r#rszGNUTranslations.pgettextc	Csl|j||f}z|j||�|�f}Wn@tyf|jrP|j�||||�YS|dkr^|}n|}Yn0|Sr~)r�r�rr�ror)rqr�rr�r<r�r�r"r"r#rs
zGNUTranslations.npgettextN)rRr�r�r�r�r�r�r�rDrrr
rrrr"r"r"r#rfsY	
rFcCs�|durt}|durRg}dD]"}tj�|�}|r|�d�}q@qd|vrR|�d�g}|D]$}t|�D]}||vrf|�|�qfqZ|r�g}	nd}	|D]J}|dkr�q�tj�||dd|�}
tj�	|
�r�|r�|	�|
�q�|
Sq�|	S)N)ZLANGUAGE�LC_ALL�LC_MESSAGESZLANGrB�Cr�z%s.mo)
�_default_localedir�os�environrHr�rdrj�path�join�exists)�domain�	localedir�	languages�allZenvarriZnelangsZlangZnelangrJ�mofiler"r"r#rs8


rZunspecifiedc	CsD|durt}t|||dd�}|sB|r*t�Sddlm}t|d|��d}|D]�}	|tj�|	�f}
t	�
|
�}|dur�t|	d�� }t	�|
||��}Wd�n1s�0Yddl
}
|
�
|�}|tu�r$ddl}|�dtd�|�r$|���(|�d	d
t�|�|�Wd�n1�s0Y|du�r4|}qJ|�|�qJ|S)NT)r�r)�ENOENTz$No translation file found for domain�rbzparameter codeset is deprecatedr_rxz.*\bset_output_charset\b.*)rrr�errnor��FileNotFoundErrorr�r��abspath�
_translationsrH�open�
setdefault�copy�_unspecifiedrSrTrUrzr{r�rt)r�r�r�Zclass_rurhZmofilesr�rJr��key�trrr�rSr"r"r#rGsD�
.

�
�*
rcCst||d|d�}|�|�dS)NT)rurh)rr)r�r�rhr�r�r"r"r#rrsrZmessagescCs|dur|atSrk)�_current_domain)r�r"r"r#r�srcCs|dur|t|<t�|t�Srk)�_localedirsrHr�)r�r�r"r"r#r	�sr	cCs0ddl}|�dtd�|dur&|t|<t�|�S)Nrz'bind_textdomain_codeset() is deprecatedr_)rSrTrU�_localecodesetsrH)r�rhrSr"r"r#r
�s�r
cCs8zt|t�|d��}Wnty,|YS0|�|�Srk)rr�rHr�r
)r�rvr�r"r"r#r�s

rcCs�ddl}|�dtd�ddl}t�|�}zP|���4|�ddt�t|t	�|d�|d�}Wd�n1sl0YWn$t
y�|�|p�|���YS0|���(|�ddt�|�
|�Wd�S1s�0YdS)Nrz1ldgettext() is deprecated, use dgettext() insteadr_rx�.*\bparameter codeset\b.*�rhry)rSrTrUrr�rHrzr{rr�r�r|r}r)r�rvrSrrhr�r"r"r#r�s&�

�8
�rcCsPzt|t�|d��}Wn*ty@|dkr4|YS|YSYn0|�|||�Sr~)rr�rHr�r)r�rr�r<r�r"r"r#r�src	Cs�ddl}|�dtd�ddl}t�|�}zP|���4|�ddt�t|t	�|d�|d�}Wd�n1sl0YWn6t
y�|dkr�|}n|}|�|p�|���YS0|���,|�ddt�|�
|||�Wd�S1s�0YdS)	Nrz3ldngettext() is deprecated, use dngettext() insteadr_rxr�r�r5r�)rSrTrUrr�rHrzr{rr�r�r|r}r)	r�rr�r<rSrrhr�r�r"r"r#r�s,�

�8
�rcCs:zt|t�|d��}Wnty,|YS0|�||�Srk)rr�rHr�r)r�r�rvr�r"r"r#r�s

rcCsRzt|t�|d��}Wn*ty@|dkr4|YS|YSYn0|�||||�Sr~)rr�rHr�r)r�r�rr�r<r�r"r"r#r�srcCs
tt|�Srk)rr�)rvr"r"r#r
�sr
cCsZddl}|�dtd�|���(|�ddt�tt|�Wd�S1sL0YdS)Nrrwr_rxz.*\bldgettext\b.*)rSrTrUrzr{rr�)rvrSr"r"r#r�s�
�rcCstt|||�Srk)rr�)rr�r<r"r"r#r�srcCs^ddl}|�dtd�|���,|�ddt�tt|||�Wd�S1sP0YdS)Nrr�r_rxz.*\bldngettext\b.*)rSrTrUrzr{rr�)rr�r<rSr"r"r#r�s�
�rcCstt||�Srk)rr�)r�rvr"r"r#r�srcCstt||||�Srk)rr�)r�rr�r<r"r"r#rsr)r8)NNF)N)N)N)0�__doc__r�r�sys�__all__r�r��base_prefixr��compile�VERBOSE�DOTALLrr$r%rFr�rGrDrVr^rjrrrr�r�rrr�r�r�rr	r
rrrrrrr
rrrrrrr"r"r"r#�<module>s\0
�

1$+h9
&�
+




	


?>