U e5do1M@s0dZddlZddlZddlZddlZddlZddlmZddl Z dddddd d d d d dddddddddddddgZ ddZ ddZ z ddl TWnLek rd Zd!Zd"ZdZd#Zd$Zd%Zd&ZeZd'd Zdd(dZYnXd ekre Zd ekre ZeZiZe ed)d Zd*d+Z!dd-d.Z"d/d0Z#e$d1Z%dd2d3Z&dd4dZ'dd5dZ(dd7dZ)d8d Zd9d:Z*e+fd;dZ,dZ.eZ/d?d@Z0dAdBZ1dCdZ2dDdEZ3dFdGZ4ddIdZ5efdJdZ6ddKdZefdLd Z7ej89dMr ddNdZ:nRze;Wn<ee?e>@D]"\ZAZBeACdrdsZAe>DeAeBqdtdtdtdudvdwdxdxdydzd{d{d|d}d~ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddSddSdSd|ddSdSddddddddd|ddddddddddddddddddddddddddddddddddddddddddd|ddddddddddddddddddd|dddddddd|dd|dSd|dddddddddddddddddddddddddddd͐ddddddddddddd d d d d dd d dd d d d d ddddddddddddddddddΐddddddddddddddddddd d!d!d!d"d#d$d%d&d'd'd(d)d'd'd&d&d|dd|dd|dd*d+d*d*d,d,d,ddd-d.d.d.d/d/d.d.d.d.d.d0d0d0d1d0d2d3d4d4d5d6d6d7d7d7d8d7d7d9d9d:d;d<d<d=d=d>d?d@dAdBdCdDdEdEdFdFdEdCdCdGdGdHdIdJdJdKdLdMdNdOdOdPdQdRdRdSdSdTdUdVdVdWdWdXdXdYdZddd[d\d]d^d_d`dȐdaddȐdbdbdcdddcdcdcdcdededfdfdddddbdgdgdhdidjdjdkdldldmdndodpdqdrdqdsdsdtdtdtdudvdSdSdwdwdxdudvdudydzd{d{d{d|d|d}d{d~ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddÐdÐdÐdÐdĐdĐdŐdŐdƐdǐdȐdɐdɐdʐdʐdːd̐dddΐdddАdАdѐdҐddddӐdӐdԐLZEdՐd֐dאdؐdِdڐdېdܐdݐdސdߐdddddddddddddddddddddddddddddddddddddddddddd d d d d dddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d.d/d0d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAdBdCdDdEdFdGdHdIdJdKdLdMdNdOdPdQdRdSdTdUdVdWdXdYdZd[d\d]d^d_d`dadbdcdddedfdgdfdgdhdidjdkdldmdndmdodpdqdrdsdtdudvdwdxdydzd{d|d}d~ddddddddddddddddddddddddddddddddZFddZGzeWne int. Compares two strings according to the locale. )abrr/usr/lib64/python3.8/locale.py_strcoll!srcCs|S)z\ strxfrm(string) -> string. Returns a string that behaves for cmp locale-aware. r)srrr_strxfrm'sr)*cCs,dgddddgdddddddddddddS)zd localeconv() -> dict. Returns numeric and monetary locale-specific parameters. r!.)groupingcurrency_symbol n_sign_posn p_cs_precedes n_cs_precedes mon_groupingn_sep_by_space decimal_point negative_sign positive_signp_sep_by_spaceint_curr_symbol p_sign_posn thousands_sepmon_thousands_sep frac_digitsmon_decimal_pointint_frac_digitsrrrrrr ?s&cCs|dkrtddS)zd setlocale(integer,string=None) -> string. Activates/queries locale processing. )Nr(Cz*_locale emulation only supports "C" localer<)r)categoryvaluerrrrWscCst}tr|t|S)N) _localeconv_override_localeconvupdate)drrrr ls ccsJd}|D]<}|tkrdS|dkr:|dkr2td|Vq2|V|}qdS)Nrzinvalid grouping)r ValueError)r*Z last_intervalintervalrrr_grouping_intervalszsrEFc Cst}||rdpd}||r dp"d}|s2|dfS|ddkr\|}|t|d}|}nd}d}g}t|D]B} |r|dd kr|}d}q||| d|d| }qp|r|||||||t|t|d fS) Nr8r7r/r*r r( 0123456789r&)r rstriplenrEappendreversejoin) rmonetaryconvr7r*strippedZ right_spacesZ left_spacesgroupsrDrrr_groups2   rRcCsdd}|r&||dkr&|d7}|d8}qt|d}|rT||dkrT|d8}|d8}q2|||dS)NrrGr&)rJ)rZamountZlposZrposrrr_strip_paddings   rSzG%(?:\((?P.*?)\))?(?P[-#0-9 +*.hlL]*?)[eEfFgGdiouxXcrs%]c Gs|r||f|}n||}|ddkr~d}|d}|rRt|d|d\|d<}t|r^dp`d}||}|rt||}n2|ddkrd}|rt||d\}}|rt||}|S) NrFZeEfFgGrr)rNr:r1Zdiu)splitrRr rMrS) percentr>r*rN additionalZ formattedZsepspartsr1rrr_formats*       rYc Cs tt|}td|}t|tjrjg}|D]8}|ddkrN|dq.|t ||||q.nt|t sz|f}g}d}|D]r}|ddkr|dq|d d} |t |||||f||d|d| |d| 7}qt |}||S)aFormats a string in the same way that the % formatting would use, but takes the current locale into account. Grouping is applied if the third parameter is true. Conversion uses monetary thousands separator and grouping strings if forth parameter monetary is true.z%srF%rZ modifiersr r&) list _percent_refinditersub isinstance_collections_abcMappinggrouprKrYtuplecount) fvalr*rNZpercentsZnew_fZnew_valZperciZ starcountrrrrs4      cGs^ddl}|jdtddt|}|r:t|t|krJtdt|t ||||f|S)z&Deprecated, use format_string instead.rNz`This method will be removed in a future version of Python. Use 'locale.format_string()' instead.r') stacklevelzHformat() must be given exactly one %%char format specifier, %s not valid) warningswarnDeprecationWarningr\matchrJrbrCreprrY)rVr>r*rNrWrirlrrrrs Tc Csft}||rdpd}|dkr&tdtd|t||dd}d|d }|r||rXd pZd }||d krld pnd}||d krdpd} |r|| rdpd|}n|| rdpd|}||d krdpd} ||d krdpd} | d krd|d}n`| dkr| |}nL| dkr|| }n8| dkr2|d| }n | dkrJ|d | }n| |}|ddd dS)zIFormats val according to the currency settings in the current locale.r;r9r!z9Currency formatting is not possible using the 'C' locale.z%%.%ifTrT<>r5r+rr.r-r0r4rGr(r,r6r2r3()r&r'r#r%)r rCrYabsreplace) rfZsymbolr*Z internationalrOZdigitsrZsmbZprecedesZ separatedZsign_posZsignrrrrs6       cCs td|S)z8Convert float to string, taking the locale into account.z%.12g)rY)rfrrrr0scCs:t}|d}|r||d}|d}|r6||d}|S)zHParses a string as a normalized number according to the locale settings.r7r(r1r))r rs)stringrOtsZddrrr delocalize4s  rvcCs |t|S)zi>iLi:iiziNi|iPiPiaiiiiHici)iiiiFikikik iiii;$i;i;i;i;i; i; i;i;iOi iiii[ili2ii$i i i i i i i i i $i (i ,i 0i 4i 8i <i @i Di Hi Li Pi TiAiiiZi(i_iIiDiJiiQiQiiBii"i.i i iCiCi*iRii4iixiji5cCsi}|fdd}||d=tdtdt\}}td|p@dtd|pNdttd td|D]@\}}t|d t|\}}td |pdtd |pdtqpttd tdt|D]B\}}t|d t|\}}td |pdtd |pdtqzttdWn$tdtdtdYnhXttdtd|D]F\}}t|d t|\}}td |pdtd |pdtqldS)z Test function. cSs0tD] \}}|dddkr |||<q dS)Nr#ZLC_)globalsitems) categorieskvrrr_init_categoriessz'_print_locale.._init_categoriesrz4Locale defaults as determined by getdefaultlocale():zH------------------------------------------------------------------------z Language: z (undefined)z Encoding: zLocale settings on startup:z...z Language: z Encoding: z,Locale settings after calling resetlocale():r(zNOTE:z9setlocale(LC_ALL, "") does not support the default localez&given in the OS environment variables.z4Locale settings after calling setlocale(LC_ALL, ""):N)rzrrrrrr)rrZlangencnamer=rrr _print_localesV        r LC_MESSAGES__main__zLocale aliasing:zNumber formatting:)N)F)FF)FF)FF)TFF)r)N)T)T)T)T)K__doc__rrZencodings.aliasesrer`builtinsrr functools__all__rrrrrrrrrrrrrCrr rrr r r?r@wrapsrErRrScompiler\rYrrrrvfloatr r r|rrrrrrrrrr startswithrCODESET NameErrorhasattrrsortedrrrrs setdefaultrrrrK__name__rzrrrrst          %  -  S" 5     $6 } aV :