grthtrhthjhtyjytjytkergtrhtrjytjerhrfhó zfc@sIdZddlZddlZddlZddlZddlZddlZddlmZdddddd d d d d dddddddgZ ej j ej ddƒZ ejdejejBƒZd„Zd„ZdBdCdDdEdFdGfZd'„eed(ƒDƒZid)d6d*d6d+d%6Zdd,„Zd-„Zd.„Zd/„ZddHd0„ƒYZdefd1„ƒYZddd2d3„ZiZddde dd4„Z!de ddd5„Z"ia#ia$d6a%dd7„Z&dd8„Z'dd9„Z(d:„Z)d;„Z*d<„Z+d=„Z,d>„Z-d?„Z.d@„Z/dA„Z0e!Z1dS(Isª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. iÿÿÿÿN(tENOENTtNullTranslationstGNUTranslationstCatalogtfindt translationtinstallt textdomaintbindtextdomaintbind_textdomain_codesettdgettextt dngettexttgettexttlgettextt ldgettextt ldngettextt lngettexttngettexttsharetlocalesÊ (?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 ccstxhtjt|ƒD]T}|j}|dkr4qn|j|ƒ}|dkrbtd|ƒ‚n|VqWdVdS(Nt WHITESPACEStINVALIDs invalid token in plural form: %st(tretfinditert_token_patternt lastgrouptgroupt ValueError(tpluraltmotkindtvalue((s/usr/lib64/python2.7/gettext.pyt _tokenizeTs    cCs"|rtd|ƒStdƒSdS(Ns#unexpected token in plural form: %ssunexpected end of plural form(R(R ((s/usr/lib64/python2.7/gettext.pyt_error_ss||s&&s==s!=ts<=s>=t+t-t*t/t%cCs,i|]"\}}|D]}||“qqS(((t.0titopstop((s/usr/lib64/python2.7/gettext.pys ms itortands//c CsMd}t|ƒ}x&|dkr:|d7}t|ƒ}qW|dkr‡t|ƒ\}}d||f}|dkrétdƒ‚qénb|dkr¦d ||f}nCyt|d ƒ}Wntk rØt|ƒ‚nXd ||f}t|ƒ}d }x“|tkr�t|}||kr$Pn|dkrI|dkrId|}ntj||ƒ}t||dƒ\} }d||| f}|}qþW||ko¨dknrºd|}n|dkrC|dkrCt|dƒ\} }|dkrt|ƒ‚nt|ƒ\} }d| || f}|dkrCd|}qCn||fS(NRt!snot t(s%s(%s)t)s%unbalanced parenthesis in plural formtns%s%si s%s%didiis(%s)is%s %s %st?it:s%s if %s else %s(ii(ii(tnextt_parseRtintR"t _binary_opst _c2py_opstget( ttokenstprioritytresulttnexttoktsubR tjR+R-trighttif_truetif_false((s/usr/lib64/python2.7/gettext.pyR7psP              cCsAyt|ƒ}Wn*tk r<td|jjfƒ‚nX|S(Ns'Plural value must be an integer, got %s(troundt TypeErrort __class__t__name__(R3R+((s/usr/lib64/python2.7/gettext.pyt_as_int¡s  cBsûe|ƒdkr!edƒ‚ny¶ee|ƒƒ\}}|rQe|ƒ‚nd}x[|D]S}|dkr˜|d7}|dkr±edƒ‚q±q^|dkr^|d8}q^q^Wied 6}d ||U|d SWnek röedƒ‚nXd S( s‰Gets a C expression as used in PO files for plural forms and returns a Python function that implements an equivalent expression. iès"plural form expression is too longiR1iis%plural form expression is too complexR2RIs˜if 1: def func(n): if not isinstance(n, int): n = _as_int(n) return int(%s) tfuncN(tlenRR7R!R"RIt RuntimeError(RR>R?tdepthtctns((s/usr/lib64/python2.7/gettext.pytc2py©s&         cCs•ddlm}||ƒ}d }d }d }d}|jdƒ}|dkrp||}|| }||O}nd}|jdƒ}|dkr²||}|| }||O}nd}|jd ƒ}|dkrô||} || }||O}nd} |} g} x~t|dƒD]l} | |@s| } | |@rE| | 7} n| |@r\| |7} n| |@rs| |7} n| j| ƒqqW| jƒ| S( Niÿÿÿÿ(t normalizeiiit@Rt.t_iii(RRQRtrangetappendtreverse(RRQtCOMPONENT_CODESETtCOMPONENT_TERRITORYtCOMPONENT_MODIFIERtmasktpostmodifiertcodesett territorytlanguagetretR+tval((s/usr/lib64/python2.7/gettext.pyt _expand_langÍsL                  cBs�eZdd„Zd„Zd„Zd„Zd„Zd„Zd„Z d„Z d„Z d „Z d „Z d „Zd „Zedd „ZRS(cCsDi|_d|_d|_d|_|dk r@|j|ƒndS(N(t_infotNonet_charsett_output_charsett _fallbackR7(tselftfp((s/usr/lib64/python2.7/gettext.pyt__init__ùs      cCsdS(N((RiRj((s/usr/lib64/python2.7/gettext.pyR7scCs)|jr|jj|ƒn ||_dS(N(Rht add_fallback(Ritfallback((s/usr/lib64/python2.7/gettext.pyRls cCs|jr|jj|ƒS|S(N(RhR (Ritmessage((s/usr/lib64/python2.7/gettext.pyR s cCs|jr|jj|ƒS|S(N(RhR (RiRn((s/usr/lib64/python2.7/gettext.pyR s cCs7|jr|jj|||ƒS|dkr/|S|SdS(Ni(RhR(Ritmsgid1tmsgid2R3((s/usr/lib64/python2.7/gettext.pyRs   cCs7|jr|jj|||ƒS|dkr/|S|SdS(Ni(RhR(RiRoRpR3((s/usr/lib64/python2.7/gettext.pyRs   cCs#|jr|jj|ƒSt|ƒS(N(Rhtugettexttunicode(RiRn((s/usr/lib64/python2.7/gettext.pyRq$s cCsC|jr|jj|||ƒS|dkr5t|ƒSt|ƒSdS(Ni(Rht ungettextRr(RiRoRpR3((s/usr/lib64/python2.7/gettext.pyRs)s    cCs|jS(N(Rd(Ri((s/usr/lib64/python2.7/gettext.pytinfo1scCs|jS(N(Rf(Ri((s/usr/lib64/python2.7/gettext.pytcharset4scCs|jS(N(Rg(Ri((s/usr/lib64/python2.7/gettext.pytoutput_charset7scCs ||_dS(N(Rg(RiRu((s/usr/lib64/python2.7/gettext.pytset_output_charset:scCsÐddl}|r|jp!|j|jdXRs4Is>IIsBad magic numberisFile is corruptt#R5is s content-typescharset=s plural-formst;splural=sN(tstructtunpacktgetattrt_catalogRtreadRKtLE_MAGICtBE_MAGICtIOErrortxrangeRet splitlineststript startswithtsplittlowerRdRfRPRrRU(RiRjR„tfilenametcatalogtbuftbuflentmagictversiontmsgcountt masteridxttransidxtiiR+tmlentmofftmendttlenttoffttendtmsgttmsgtlastktitemtktvRRoRptx((s/usr/lib64/python2.7/gettext.pyR7Qsx     " "                 (   cCs}tƒ}|jj||ƒ}||krG|jrC|jj|ƒS|S|jr`|j|jƒS|jry|j|jƒS|S(N(tobjectR†R;RhR RgtencodeRf(RiRntmissingR¢((s/usr/lib64/python2.7/gettext.pyR ¥s     cCsstƒ}|jj||ƒ}||krG|jrC|jj|ƒS|S|jr`|j|jƒS|jtjƒƒS(N( R¨R†R;RhR RgR©Rtgetpreferredencoding(RiRnRªR¢((s/usr/lib64/python2.7/gettext.pyR ³s    cCs¡yV|j||j|ƒf}|jr8|j|jƒS|jrQ|j|jƒS|SWnDtk rœ|jr…|jj|||ƒS|dkr•|S|SnXdS(Ni(R†RRgR©RftKeyErrorRhR(RiRoRpR3R¢((s/usr/lib64/python2.7/gettext.pyR¾s     cCs—yL|j||j|ƒf}|jr8|j|jƒS|jtjƒƒSWnDtk r’|jr{|jj|||ƒS|dkr‹|S|SnXdS(Ni( R†RRgR©RR«R¬RhR(RiRoRpR3R¢((s/usr/lib64/python2.7/gettext.pyRÎs    cCsQtƒ}|jj||ƒ}||krM|jrC|jj|ƒSt|ƒS|S(N(R¨R†R;RhRqRr(RiRnRªR¢((s/usr/lib64/python2.7/gettext.pyRqÜs    cCs~y |j||j|ƒf}WnWtk ry|jrO|jj|||ƒS|dkrjt|ƒ}qzt|ƒ}nX|S(Ni(R†RR¬RhRsRr(RiRoRpR3R¢((s/usr/lib64/python2.7/gettext.pyRsås    ( RHR}RˆR‰R7R R RRRqRs(((s/usr/lib64/python2.7/gettext.pyRLs T    ic CsT|dkrt}n|dkr‚g}x9dD]1}tjj|ƒ}|r.|jdƒ}Pq.q.Wd|kr‚|jdƒq‚ng}xA|D]9}x0t|ƒD]"}||kr¢|j|ƒq¢q¢Wq�W|rÛg} nd} xl|D]d}|dkrþPntjj ||dd|ƒ} tjj | ƒrè|rE| j| ƒqL| SqèqèW| S( NtLANGUAGEtLC_ALLt LC_MESSAGEStLANGR5tCs%s.mo(R­R®R¯R°( Ret_default_localedirtostenvironR;R�RVRctpathtjointexists( tdomaint localedirt languagestalltenvarRbtnelangstlangtnelangR>tmofile((s/usr/lib64/python2.7/gettext.pyRós8           c Cs|dkrt}nt|||ddƒ}|sU|r@tƒSttd|ƒ‚nd}x»|D]³}|tjj|ƒf} t j | ƒ} | dkrÎt |dƒ�} t j | || ƒƒ} WdQXnt j | ƒ} |ró| j|ƒn|dkr| }qb|j| ƒqbW|S(NR»is$No translation file found for domaintrb(ReRRRRŠRR³Rµtabspatht _translationsR;topent setdefaulttcopyRwRl( R¸R¹Rºtclass_RmR^tmofilesR>RÀtkeyttRj((s/usr/lib64/python2.7/gettext.pyRs*    !  cCs/t||dtd|ƒ}|j||ƒdS(NRmR^(RtTrueR(R¸R¹RrR^R|RÊ((s/usr/lib64/python2.7/gettext.pyR:stmessagescCs|dk r|antS(N(Ret_current_domain(R¸((s/usr/lib64/python2.7/gettext.pyRHs  cCs)|dk r|t|=(R%R&(R'R(R)((2t__doc__RRÆR³RRƒtsysterrnoRt__all__RµR¶tprefixR²tcompiletVERBOSEtDOTALLRR!R"R9t enumerateR:R7RIRPRcRRReRRÃR~RRRÎRÏRÍRRR R RR RR R RRR(((s/usr/lib64/python2.7/gettext.pyt s\&H      1  $ +T§&