B A@stddlZddlZddlZddlZdddddddd d d d d dddddgZejejddZe dej ej BZ ddZ ddZdZddeedDZddd d!Zd=d#d$Zd%d&Zd'd(Zd)d*ZGd+ddZGd,ddeZd>d.dZiZd?d/dZd@d0dZiaiad1adAd2dZdBd3d Z dCd4d Z!d5d Z"d6dZ#d7d Z$d8dZ%d9d Z&d:dZ'd;dZ(d[ \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 ccsTxHtt|D]8}|j}|dkr"q||}|dkr@td||VqWdVdS)N WHITESPACESINVALIDz invalid token in plural form: %s)refinditer_token_pattern lastgroupgroup ValueError)pluralmokindvaluer!*/opt/alt/python37/lib/python3.7/gettext.py _tokenizeVs   r#cCs|rtd|StdSdS)Nz#unexpected token in plural form: %szunexpected end of plural form)r)r r!r!r"_erroras r$))z||)z&&)z==z!=)<>z<=z>=)+-)*/%cCs i|]\}}|D] }||qqSr!r!).0iZopsopr!r!r" osr/orandz//)z||z&&r*c Csd}t|}x|dkr(|d7}t|}qW|dkr\t|\}}d||f}|dkrtdnP|dkrrd ||f}n:yt|d }Wntk rt|dYnXd ||f}t|}d }xh|tkr t|}||krP|d kr|d krd|}t||}t||d\} }d||| f}|}qW||kr:dkrFnnd|}|dkr|dkrt|d\} }|dkrzt|t|\} }d| || f}|dkrd|}||fS)Nr!znot (z%s(%s))z%unbalanced parenthesis in plural formnz%s%s z%s%dd)z(%s)r0z%s %s %sr;?r:z%s if %s else %s)next_parserintr$ _binary_ops _c2py_opsget) tokenspriorityresultnexttoksubr jr-r.rightif_trueif_falser!r!r"r?rsP           r?cCsZy t|}Wn(tk r4td|jjfdYnXddl}|d|jjftd|S)Nz'Plural value must be an integer, got %srr;)round TypeError __class____name__warningswarnDeprecationWarning)r7r-rQr!r!r"_as_ints  rTcCst|dkrtdy~tt|\}}|r2t|d}x>|D]6}|dkrb|d7}|dkrrtdq<|dkr<|d8}qt|D]\}}!t |!||||f<qWnt |||t ||<| d7} | d7} qWdS)Nr)unpacknamercSs t|dkS)Nr0)r@)r7r!r!r"]z(GNUTranslations._parse..z4Iz>IIzBad magic numberzBad version number zFile is corrupt r=r0 z content-typezcharset=z plural-forms;zplural=ascii)structrgetattr_catalogrreadrWLE_MAGICBE_MAGICOSErrorrVERSIONSstrrcsplitdecodestriplowerrsrtr] enumerate)"rwrxrfilenamecatalogbufbuflenmagicrmsgcount masteridxtransidxii major_version minor_versionr-mlenmoffmendtlentofftendmsgrlastkb_itemitemkvrrrrxr!r!r"r?Tsr                      zGNUTranslations._parsecCsRt}|j||}||kr2|jr.|j|S|}|jrD||jS|tS)N) objectrrCrvrrur}rr~)rwr|missingrr!r!r"rs  zGNUTranslations.lgettextcCsvy|j|||f}Wn<tk rT|jr>|j|||S|dkrL|}n|}YnX|jrh||jS|tS)Nr0) rrKeyErrorrvrrur}rr~)rwrrr7rr!r!r"rs  zGNUTranslations.lngettextcCs6t}|j||}||kr2|jr.|j|S|S|S)N)rrrCrvr )rwr|rrr!r!r"r s zGNUTranslations.gettextcCsZy|j|||f}Wn<tk rT|jr>|j|||S|dkrL|}n|}YnX|S)Nr0)rrrrvr)rwrrr7rr!r!r"rs zGNUTranslations.ngettextN) rPrrrrrrr?rrr rr!r!r!r"rHsV  Fc Cs|dkr t}|dkrTg}x(dD] }tj|}|r|d}PqWd|krT|dg}x0|D](}x"t|D]}||krl||qlWq^W|rg} nd} xL|D]D}|dkrPtj||dd|} tj | r|r| | q| SqW| S)N)LANGUAGELC_ALL LC_MESSAGESLANGr=Crz%s.mo) _default_localedirosenvironrCrrdrrpathjoinexists) domain localedir languagesallenvarrqnelangslangnelangrFmofiler!r!r"rs8        c Cs|dkr t}t|||dd}|sB|r*tSddlm}t|d|d}x|D]} |tj| f} t | } | dkrt | d} t | || } WdQRXddl } | | } |r| ||dkr| }qL|| qLW|S)NT)rr)ENOENTz$No translation file found for domainrb)rrrerrnorFileNotFoundErrorrrabspath _translationsrCopen setdefaultcopyrrz)rrrclass_r{rmmofilesrrFrkeytrxrr!r!r"rs0      cCst||d|d}||dS)NT)r{rm)rr)rrrmrrr!r!r"r&smessagescCs|dk r |atS)N)_current_domain)rr!r!r"r4scCs|dk r|t|<t|tS)N) _localedirsrCr)rrr!r!r"r ;scCs|dk r|t|<t|S)N)_localecodesetsrC)rrmr!r!r"r BscCs@y t|t|dt|d}Wntk r4|SX||S)N)rm)rrrCrrr )rr|rr!r!r"r Is cCsRt|}yt|t|d|d}Wn"tk rF||pBtSX||S)N)rm) rrCrrrr}rr~r)rr|rmrr!r!r"rQs  cCsTy t|t|dt|d}Wn$tk rD|dkr<|S|SYnX||||S)N)rmr0)rrrCrrr)rrrr7rr!r!r"r Ys cCsht|}yt|t|d|d}Wn4tk rX|dkrB|}n|}||pTtSX||||S)N)rmr0) rrCrrrr}rr~r)rrrr7rmrrr!r!r"rds cCs tt|S)N)r r)r|r!r!r"r pscCs tt|S)N)rr)r|r!r!r"rsscCstt|||S)N)r r)rrr7r!r!r"rvscCstt|||S)N)rr)rrr7r!r!r"rys)r3)NNF)NNNFN)NNN)N)N)N)+rrrsys__all__rr base_prefixrcompileVERBOSEDOTALLrr#r$rArrBr?rTr]rrrrrrrrrrrrr r r rr rr rrrrr!r!r!r"1sV        1 $*K & #