QfHSdZddlZddlZddlZddlZgdZej jejddZ ejdejejzZ dZdZd Zeed Dcic]\}}|D]}||c}}}Zd d d dZd&dZdZdZdZGddZGddeZd'dZiZ d(dZd)dddZiadad)dZd)dZ dZ!dZ"d Z#d!Z$d"Z%d#Z&d$Z'd%Z(eZ)ycc}}}w)*aInternationalization 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)NullTranslationsGNUTranslationsCatalogbindtextdomainfind translationinstall textdomaindgettext dngettextgettextngettextpgettext dpgettext npgettext dnpgettextsharelocalea (?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 c#Ktjt|D]<}|j}|dk(r|j |}|dk(rt d|z|>dyw)N WHITESPACESINVALIDz invalid token in plural form: %s)refinditer_token_pattern lastgroupgroup ValueError)pluralmokindvalues ./opt/alt/python312/lib64/python3.12/gettext.py _tokenizer$Wsakk.&1|| =  9 ?%GH H 2 HsAA!c8|rtd|zStdS)Nz#unexpected token in plural form: %szunexpected end of plural form)r)r"s r#_errorr&cs" ?%GHH9::))||)&&)z==z!=)<>z<=z>=)+-)*/%orandz//)r(r)r/cd}t|}|dk(r|dz }t|}|dk(r|dk(r&t|\}}|d|d}|dk7r+td|dk(r||}n t|d}d ||fz}t|}d }|t vrYt |}||krnJ|d vr |d vrd |z}t j||}t||d z\} }|d|d| }|}|t vrY||cxk(rdk(rnnd |z}|dk(rF|dkrAt|d\} }|dk7r t |t|\} }| d|d| }|dk(rd |z}||fS#t$r t |dwxYw)Nr!znot ()z%unbalanced parenthesis in plural formn z%s%dd)z(%s)r1 r<?r:z if z else )next_parserintr& _binary_ops _c2py_opsget) tokenspriorityresultnexttoksubr"jioprightif_trueif_falses r#rArAvs F6lG S.&v, S.#~f~ W#S) c>DE E C!7+ ,$E65/)6lG A [   x<  ;1;f_F ]]7G ,A.w%r51  [  H&#~(a-!&!, c>/ !"6N''.A q=f_F 7?= ,/t + ,s ! EEc t|ddl}t j d}d}|jb|jjdtk(r@|dz }|j}|j#|jjdtk(r@|jd|jjt||S#t$r$td|jjdwxYw)Nz%Plural value must be an integer, got rr1__name__) round TypeError __class__rSwarningssys _getframef_back f_globalsrEwarnDeprecationWarning)r8rWframe stacklevels r#_as_intr`s; a  MM! EJ ,, "u':'::'F('Ra   ,, "u':'::'F('R MM;;''*$ H ;--016: ;;s C-C3cNt|dkDr td tt|\}}|r t |d}|D](}|dk(r|dz }|dkDstd|dk(s$|dz}*t t d }td |z||d S#t$r tdwxYw) zGets a C expression as used in PO files for plural forms and returns a Python function that implements an equivalent expression. iz"plural form expression is too longrr6r1z%plural form expression is too complexr7)r`rSzif True: def func(n): if not isinstance(n, int): n = _as_int(n) return int(%s) func) lenrrAr$r&r`rSexecRecursionError)rrHrIdepthcnss r#c2pyrjs  6{T=>>B 6!23 / !ACx 2:%%LMMc !h 7       &z B@AABs:BB''BB$cddl}|j|}d}d}d}d}|jd}|dk\r||d}|d|}||z}nd}|jd}|dk\r||d}|d|}||z}nd}|jd}|dk\r||d} |d|}||z}nd} |} g} t|dzD]:} | |zr | } | |zr| | z } | |zr| |z } | |zr| |z } | j | <| j | S) Nrr1rRr<@r._)r normalizerrangeappendreverse)locrCOMPONENT_CODESETCOMPONENT_TERRITORYCOMPONENT_MODIFIERmaskposmodifiercodeset territorylanguageretrLvals r# _expand_langrsS   3 C    D ((3-C axst9$3i "" ((3-C axcd)$3i !! ((3-C axI $3i ## H C 46]TE C&&y(8$$w%%x JJsO KKM Jr'cLeZdZd dZdZdZdZdZdZdZ d Z d Z d d Z y) rNcVi|_d|_d|_||j|yyN)_info_charset _fallbackrAselffps r#__init__zNullTranslations.__init__ s,   > KKO r'cyrrs r#rAzNullTranslations._parses r'cb|jr|jj|y||_yr)r add_fallback)rfallbacks r#rzNullTranslations.add_fallbacks" >> NN ' ' 1%DNr'cT|jr|jj|S|Sr)rr )rmessages r#r zNullTranslations.gettexts# >>>>))'2 2r'cf|jr|jj|||S|dk(r|S|SNr1)rr)rmsgid1msgid2r8s r#rzNullTranslations.ngettext s3 >>>>**661= = 6MMr'cV|jr|jj||S|Sr)rr)rcontextrs r#rzNullTranslations.pgettext(s% >>>>**7G< <r'ch|jr|jj||||S|dk(r|S|Sr)rr)rrrrr8s r#rzNullTranslations.npgettext-s5 >>>>++GVVQG G 6MMr'c|jSr)rrs r#infozNullTranslations.info5s zzr'c|jSr)rrs r#charsetzNullTranslations.charset8s }}r'cddl}|j|jd<|1hd}|t|zD]}t |||j|<yy)Nrrn>r rrr)builtinsr __dict__setgetattr)rnamesrallowednames r#r zNullTranslations.install;sS!%#  FG#e*,*1$*=!!$'- r'r) rS __module__ __qualname__rrArr rrrrrr rr'r#rr s4 &   >r'rc@eZdZdZdZdZdZdZdZdZ dZ d Z d Z y ) rl*l$<z%s%s)rr1c|dz |dzfS)z/Returns a tuple of major version, minor versionir)rversions r# _get_versionszGNUTranslations._get_versionsPs2 w/00r'cddlm}t|dd}ix|_}d|_|j }t |}|d|ddd}||jk(r|d |dd \}} } } d } n0||jk(r|d |dd \}} } } d } n tdd||j|\} }| |jvrtddt| z|td| D]}|| || | dz\}}||z}|| || | dz\}}||z}||kr||kr |||}|||}n tdd||dk(r4d}|jdD]}|jj!}|s%|j#dr|j%drHdx}}d|vrU|jdd\}}|j!j'}|j!}||j(|<|}n|r|j(|xxd|zz cc<|dk(r|jdd|_|dk(s|jd}|djdd}t-||_ |j*xsd}d|vrV|jd\}} |jd}t||}t/|D]\}}!t|!||||f<nt|||t||<| dz } | dz } y)z8Override this method to support alternative .mo formats.r)unpackrrct|dk7Sr)rB)r8s r#z(GNUTranslations._parse..]s AF r'z4Iz>IIzBad magic numberzBad version number zFile is corrupt z #-#-#-#-#r?r1 z content-typezcharset=z plural-forms;zplural=ascii)structrr_catalogrreadrdLE_MAGICBE_MAGICOSErrorrVERSIONSstrrpsplitdecodestrip startswithendswithlowerrrrj enumerate)"rrrfilenamecatalogbufbuflenmagicrmsgcount masteridxtransidxii major_version minor_versionrLmlenmoffmendtlentofftendmsgtmsglastkb_itemitemkvrrrrxs" r#rAzGNUTranslations._parseTs1 "2vr*#%$ + ggiStS!W%a( DMM !5;E3q95M 2GXy(B dmm #5;E3q95M 2GXy(B!/: :'+'9'9''B$ }  -!2S5GGR Rq(#AC )A+$>?JD$$;DC!$<=JD$$;Df}$tn4~a!2H==qy"jj/F!==?002D {3 k8R  LAd{#zz#q11GGIOO-GGI() 1 ! 5)TD[8)N*() (;A(> n,GGCL!"1I!6q!9&*6l +0>mm.wG#~!$7!3zz'*VW-%dODAq+.q'?GVQK(,.1w-?C)* NI MHs$r'ct}|jj||}||ur-|jj||jdf|}||ur|S|jr|jj |S|Sr)objectrrErrr )rrmissingrs r#r zGNUTranslations.gettextsw(}}  '2 7?==$$gt{{1~%>HD w K >>>>))'2 2r'c |j||j|f}|S#t$r;|jr|jj |||cYS|dk(r|}Y|S|}Y|SwxYwr)rrKeyErrorrr)rrrr8rs r#rzGNUTranslations.ngettextsy ==&$++a.!9:D  ~~~~..vvqAAAv   s $2A(A("A('A(c2|j||fz}t}|jj||}||ur-|jj||j df|}||ur|S|j r|j j ||S|Sr)CONTEXTrrrErrr)rrr ctxt_msg_idrrs r#rzGNUTranslations.pgettextsllgw%77 (}}  g6 7?==$$k4;;q>%BGLD w K >>>>**7G< <r'c|j||fz} |j||j|f}|S#t$r<|jr |jj ||||cYS|dk(r|}Y|S|}Y|SwxYwr)rrrrrr)rrrrr8rrs r#rzGNUTranslations.npgettextsllgv%66  ==dkk!n!<=D  ~~~~//KKAv   s 53A:*A:4A:9A:N) rSrrrrrrrrAr rrrrr'r#rrDs:HHGH1Wr    r'rc|t}|Rg}dD]6}tjj|}|s%|j d}nd|vr|j dg}|D](}t |D]}||vs|j |*|rg} nd} |D]f}|dk(r| Stjj||dd|z} tjj| sP|r| j | d| cS| S)N)LANGUAGELC_ALL LC_MESSAGESLANGr?Crz%s.mo) _default_localedirosenvironrErrqrpathjoinexists) domain localedir languagesallenvarr~nelangslangnelangrHmofiles r#rrs&  BE**..'CIIcN  C i    S !G"4(FW$v&)   3;  M i}g>NO 77>>& ! f%  Mr'c|t}t|||d}|s|r tSddlm}t |d|d}|D]}|t jj|f} tj| } | 1t|d5} tj| || } dddddl } | j| } || }|j| |S#1swY8xYw)NT)rr)ENOENTz$No translation file found for domainrb)rrrerrnorFileNotFoundErrorrrabspath _translationsrEopen setdefaultcopyr) rrrclass_rmofilesrrHrkeytrrs r#rrs ~ 69iT:G  #% %  FP PFrwwv./   c " 9fd#r!,,S&*=$  IIaL >F    "!" M$#s CC! )rcBt||d}|j|y)NT)r)rr )rrrr s r#r r )sFI5AIIer'messagesc||atSr)_current_domain)rs r#r r 4s   r'cL| |t|<tj|tSr) _localedirsrEr)rrs r#rr;s$' F ??6#5 66r'c t|tj|d}|j |S#t$r|cYSwxYwr)rrrErr )rrr s r#r r BsE   = > 99W  s 3 AAc t|tj|d}|j |||S#t$r|dk(r|cYS|cYSwxYwr)rrrErr)rrrr8r s r#r r JsU   = > ::ffa ((  6MM s 5A A  A c t|tj|d}|j ||S#t$r|cYSwxYwr)rrrErr)rrrr s r#rrUsG   = > ::gw '' s 4 AAc t|tj|d}|j ||||S#t$r|dk(r|cYS|cYSwxYwr)rrrErr)rrrrr8r s r#rr]sW   = > ;;w 22  6MM s 6A A  A c"tt|Sr)r r )rs r#r r hs OW --r'c&tt|||Sr)r r )rrr8s r#rrls _ffa 88r'c$tt||Sr)rr )rrs r#rrps _gw 77r'c(tt||||Sr)rr )rrrr8s r#rrts ow BBr'))NNF)NNNFr)*__doc__operatorrrrX__all__rr base_prefixrcompileVERBOSEDOTALLrr$r&rCrrDrAr`rjrrrrrrr rr r rr r rrr rrrr)rLopsrMs000r#r!sY `  WW\\#//7HE  BII    ; $-[!#<K#<Csr1usr#<K u4 0 /d (!BH'T7>7>tW&Wv!J 37&+DT  7)(3.98C$ iLs=C8