a �DOg�j�@s�ddlZddlZddlZgd�Zej�ejdd�Ze�dej ej B�Z dd�Z dd �Z d Zd d �eed �D�Zdddd�ZdFdd�Zdd�Zdd�Zdd�ZGdd�d�ZGdd�de�ZdGd d!�ZiZd"gZddddefd#d$�Zdedfd%d&�Ziaiad'adHd(d)�ZdId*d+�Z dJd,d-�Z!d.d/�Z"d0d1�Z#d2d3�Z$d4d5�Z%d6d7�Z&d8d9�Z'd:d;�Z(dd?�Z*d@dA�Z+dBdC�Z,dDdE�Z-eZ.dS)K�N)�NullTranslations�GNUTranslations�Catalog�find� translation�install� textdomain�bindtextdomain�bind_textdomain_codeset�dgettext� dngettext�gettext�lgettext� ldgettext� ldngettext� lngettext�ngettext�pgettext� dpgettext� npgettext� dnpgettext�share�localea� (?P[ \t]+) | # spaces and horizontal tabs (?P[0-9]+\b) | # decimal integer (?Pn\b) | # only n is allowed (?P[()]) | (?P[-*/%+?:]|[>, # <=, >=, ==, !=, &&, ||, # ? : # unary and bitwise ops # not allowed (?P\w+|.) # invalid token ccsPt�t|�D]8}|j}|dkr q |�|�}|dkr>td|��|Vq dVdS)N� WHITESPACES�INVALIDz invalid token in plural form: %s�)�re�finditer�_token_pattern� lastgroup�group� ValueError)�plural�mo�kind�value�r&�/usr/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'� o�r7��or�andz//)r*r+r1�����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)r9z%s %s %srD�?r�:z%s if %s else %s)�next�_parser!�intr)� _binary_ops� _c2py_ops�get) �tokens�priority�result�nexttok�subr%�jr4r6�right�if_true�if_falser&r&r'rHrsP           rHcCsXz t|�}Wn&ty2td|jjf�d�Yn0ddl}|�d|jjftd�|S)Nz'Plural value must be an integer, got %srrD)�round� TypeError� __class__�__name__�warnings�warn�DeprecationWarning)r@r4rZr&r&r'�_as_int�s  ����r]cCs�t|�dkrtd��z|tt|��\}}|r2t|��d}|D]6}|dkr`|d7}|dkrptd��q:|dkr:|d8}q:d ti}td ||�|d WSty�td��Yn0dS) Ni�z"plural form expression is too longrr>r9�z%plural form expression is too complexr?r]z�if True: def func(n): if not isinstance(n, int): n = _as_int(n) return int(%s) �func)�lenr!rHr(r)r]�exec�RecursionError)r"rOrP�depth�c�nsr&r&r'�c2py�s.   ��  rfcCs>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) Nrr9�rD�@r�.�_)r� normalizer�range�append�reverse)�locr�COMPONENT_CODESET�COMPONENT_TERRITORY�COMPONENT_MODIFIER�mask�pos�modifier�codeset� territory�language�retr4�valr&r&r'� _expand_lang�sF               r{c@s�eZdZddd�Zdd�Zdd�Zdd �Zd d �Zd d �Zdd�Z dd�Z dd�Z dd�Z dd�Z dd�Zdd�Zddd�ZdS) rNcCs.i|_d|_d|_d|_|dur*|�|�dS�N)�_info�_charset�_output_charset� _fallbackrH��self�fpr&r&r'�__init__�s zNullTranslations.__init__cCsdSr|r&r�r&r&r'rHszNullTranslations._parsecCs|jr|j�|�n||_dSr|)r�� add_fallback)r��fallbackr&r&r'r� szNullTranslations.add_fallbackcCs|jr|j�|�S|Sr|)r�r )r��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() insteadrg�ignore�.*\blgettext\b.*) rZr[r\rr��catch_warnings�filterwarningsrr�encode�getpreferredencoding)r�r�rZrr&r&r'rs� �* zNullTranslations.lgettextcCs*|jr|j�|||�S|dkr"|S|SdS�Nr9)r�r)r��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() insteadrgr��.*\blngettext\b.*r9) rZr[r\rr�r�r�rrr�r��r�r�r�r@rZr�tmsgr&r&r'r+s"� �. zNullTranslations.lngettextcCs|jr|j�||�S|Sr|)r�r)r��contextr�r&r&r'r=szNullTranslations.pgettextcCs,|jr|j�||||�S|dkr$|S|SdSr�)r�r)r�r�r�r�r@r&r&r'rBs zNullTranslations.npgettextcCs|jSr|)r}�r�r&r&r'�infoJszNullTranslations.infocCs|jSr|)r~r�r&r&r'�charsetMszNullTranslations.charsetcCsddl}|�dtd�|jS)Nrzoutput_charset() is deprecatedrg�rZr[r\r)r�rZr&r&r'�output_charsetPs �zNullTranslations.output_charsetcCs ddl}|�dtd�||_dS)Nrz"set_output_charset() is deprecatedrgr�)r�r�rZr&r&r'�set_output_charsetVs �z#NullTranslations.set_output_charsetcCsJddl}|j|jd<|durFhd�}|t|�@D]}t||�|j|<q0dS)Nrrj>rrrrr r)�builtinsr �__dict__�set�getattr)r��namesr��allowed�namer&r&r'r\s  zNullTranslations.install)N)N)rY� __module__� __qualname__r�rHr�r rrrrrr�r�r�r�rr&r&r&r'r�s rc@s\eZdZdZdZdZdZdd�Zdd�Zd d �Z d d �Z d d�Z dd�Z dd�Z dd�ZdS)rl�*l�$<z%s%s)rr9cCs|d?|d@fS)N�i��r&)r��versionr&r&r'� _get_versionsrszGNUTranslations._get_versionsc"Cs�ddlm}t|dd�}i|_}dd�|_|��}t|�}|d|dd��d}||jkr||d |dd ��\}} } } d } n6||jkr�|d |dd ��\}} } } d } n t dd|��|� |�\} }| |j vr�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)Nr)�unpackr�rcSs t|dk�Sr�)rI)r@r&r&r'�r8z(GNUTranslations._parse..z4Iz>IIzBad magic numberzBad version number �zFile is corrupt� z #-#-#-#-#rFr9� z content-typezcharset=z plural-forms�;zplural=�ascii�)�structr�r��_catalogr"�readr`�LE_MAGIC�BE_MAGIC�OSErrorr��VERSIONS�strrl�split�decode�strip� startswith�endswith�lowerr}r~rf� enumerate)"r�r�r��filename�catalog�buf�buflen�magicr��msgcount� masteridx�transidx�ii� major_version� minor_versionr4�mlen�moff�mend�tlen�toff�tend�msgr��lastk�b_item�item�k�vr"r�r�r��xr&r&r'rHvsv                      zGNUTranslations._parsecCspddl}|�dtd�ddl}t�}|j�||�}||urP|jrL|j�|�S|}|j rb|� |j �S|� |� ��S)Nrr�rg) rZr[r\r�objectr�rLr�rrr�r�)r�r�rZr�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�rgr9) rZr[r\rr�r"�KeyErrorr�rrr�r�r�r&r&r'r�s �   zGNUTranslations.lngettextcCs6t�}|j�||�}||ur2|jr.|j�|�S|S|Sr|)r�r�rLr�r )r�r�r�r�r&r&r'r �s zGNUTranslations.gettextcCs\z|j||�|�f}Wn>tyV|jr@|j�|||�YS|dkrN|}n|}Yn0|Sr�)r�r"r�r�r)r�r�r�r@r�r&r&r'r�s  zGNUTranslations.ngettextcCsF|j||f}t�}|j�||�}||urB|jr>|j�||�S|S|Sr|)�CONTEXTr�r�rLr�r)r�r�r�� 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�r"r�r�r)r�r�r�r�r@r�r�r&r&r'rs  zGNUTranslations.npgettextN)rYr�r�r�r�r�r�r�rHrrr rrrr&r&r&r'rfsY   rFc Cs�|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)�LANGUAGE�LC_ALL� LC_MESSAGES�LANGrF�Cr�z%s.mo) �_default_localedir�os�environrLr�rmr{�path�join�exists) �domain� localedir� languages�all�envarrz�nelangs�lang�nelangrO�mofiler&r&r'rs8       r� unspecifiedc 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 deprecatedrgr�z.*\bset_output_charset\b.*)rrr�errnor��FileNotFoundErrorr�r��abspath� _translationsrL�open� setdefault�copy� _unspecifiedrZr[r\r�r�r�r�)r�r�r��class_r�rv�mofilesr�rOr��key�tr�r�rZr&r&r'rGsD �  .  � �*  rcCst||d|d�}|�|�dS)NT)r�rv)rr)r�r�rvr�r�r&r&r'rrsr�messagescCs|dur |atSr|)�_current_domain)r�r&r&r'r�srcCs|dur|t|<t�|t�Sr|)� _localedirsrLr�)r�r�r&r&r'r �sr cCs0ddl}|�dtd�|dur&|t|<t�|�S)Nrz'bind_textdomain_codeset() is deprecatedrg)rZr[r\�_localecodesetsrL)r�rvrZr&r&r'r �s�r cCs8zt|t�|d��}Wnty,|YS0|�|�Sr|)rrrLr�r )r�r�r�r&r&r'r �s   r cCs�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() insteadrgr��.*\bparameter codeset\b.*�rvr�)rZr[r\rrrLr�r�rrr�r�r�r)r�r�rZrrvr�r&r&r'r�s&�  �8  �rcCsPzt|t�|d��}Wn*ty@|dkr4|YS|YSYn0|�|||�Sr�)rrrLr�r)r�r�r�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() insteadrgr�rrr9r�)rZr[r\rrrLr�r�rrr�r�r�r) r�r�r�r@rZrrvr�r�r&r&r'r�s,�  �8  �rcCs:zt|t�|d��}Wnty,|YS0|�||�Sr|)rrrLr�r)r�r�r�r�r&r&r'r�s   rcCsRzt|t�|d��}Wn*ty@|dkr4|YS|YSYn0|�||||�Sr�)rrrLr�r)r�r�r�r�r@r�r&r&r'r�s rcCs tt|�Sr|)r r)r�r&r&r'r �sr cCsZddl}|�dtd�|���(|�ddt�tt|�Wd�S1sL0YdS)Nrr�rgr�z.*\bldgettext\b.*)rZr[r\r�r�rr)r�rZr&r&r'r�s� �rcCstt|||�Sr|)r r)r�r�r@r&r&r'r�srcCs^ddl}|�dtd�|���,|�ddt�tt|||�Wd�S1sP0YdS)Nrr�rgr�z.*\bldngettext\b.*)rZr[r\r�r�rr)r�r�r@rZr&r&r'r�s� �rcCs tt||�Sr|)rr)r�r�r&r&r'r�srcCstt||||�Sr|)rr)r�r�r�r@r&r&r'rsr)r<)NNF)N)N)N)/r�r�sys�__all__r�r�� base_prefixr��compile�VERBOSE�DOTALLrr(r)rJr�rKrHr]rfr{rrrr�r�rrrrrrr r r rr rrrr rrrrrrr&r&r&r'�1sZ  �    1 $+h9 &� +