m %UIc@sdZdkZdddddddd d d d d ddddgZy dkTWnpej oddZdZdZdZdZ dZ dZ dZ e ZdZedZdZdZnXdZdd Zd!Zed"Zd#Zd$ZeZd%Zd&Zd'Zdd d(d)fd*Zed+Z ed,Zed-Z!ei"d.d/d0fjoe#d1Z$n7ye%Wne&j oe#d2Z$nXe#d3Z$hd4d5<d6d5<d7d8<d9d8<d:d8<d;d8<d<d8<d=d8<d>d8<d?d@<dAd@<dBd@<dCdD<dEdD<dFdD<dGdH<dIdJ<dKdL<dMdN<dOdP<dQdR<dSdR<dTdR<dUdV<dWdX<dYdZ<d[dZ<d\dZ<d]d^<d_d^<d`d^d?<d@d?<dAdB<dCdB<dDdE<dFd?<dGdB<dHdI<dJdI<dKd<dLd<dMdN<dOdP<dQdP<dRdP<dSdT<dUdV<dWdV<dXdV<dYdZ<d[dZ<d\dr<d]dr<d^dt<d_dr<d`dt<dadtd?<d@dA<dBdC<dDdE<dFdG<dHdI<dJdK<dLdM<dNdO<dPdQ<dRdS<dTdU<dVdW<dXdY<dZd[<d\d]<d^d_<d`da<dbdc<ddde<dfdg<dhdi<djdk<dldm<dndo<dpdm<dqdo<drds<dtdu<dvdw<dxdy<dzd{<d|d}<d~d{<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd<dd dict. Returns numeric and monetary locale-specific parameters. tgroupingitcurrency_symboltt n_sign_posnt p_cs_precedest n_cs_precedest mon_groupingtn_sep_by_spacet decimal_pointt.t negative_signt positive_signtp_sep_by_spacetint_curr_symbolt p_sign_posnt thousands_septmon_thousands_sept frac_digitstmon_decimal_pointtint_frac_digitsN((((t#/data/zmath/lib/python2.4/locale.pyR,scCs|djo tdndS(sd setlocale(integer,string=None) -> string. Activates/queries locale processing. RtCs*_locale emulation only supports "C" localeN(NRR&(tvaluetNoneR(tcategoryR'((R%RDs  cCs t||S(sb strcoll(string,string) -> int. Compares two strings according to the locale. N(tcmptatb(R+R,((R%RLscCs|S(sd strxfrm(string) -> string. Returns a string that behaves for cmp locale-aware. N(ts(R-((R%RRscCst}|d}|p|dfSnd}d}d}|ddjo'|id}||}|| }nx|o|o|dt joPn*|ddjo|d}|d}n|o%|| |d|}|d7}n || }|| }|o'|ddjo||||fSququW|p|||fSn|o ||d|}|d7}n|||fS( NRiRit iR t 0123456789( RtconvRR-tresulttsepstspacestfindtspRtgroup(R-R6R0R5R3R1R2R((R%t_group]s>      cCs||}|id}d}|ot|d\|d<}nt|djo!|dt d|d}n+t|djo|d}n t dxM|oE|i d}|djoPn|| ||d}|d8}qW|S( sFormats a value 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.RiiRis(Too many decimal points in result stringR.iN( tftvalR1tsplittfieldsR2RR7tlenRRR4R5(R8R9RR;R5R1R2((R%Rs& !  cCs td|S(s9Convert float to integer, taking the locale into account.s%.12gN(RR9(R9((R%RscCs^td}|o|i|d}ntd}|o|i|d}n||S(s<Parses a string as a float according to the locale settings.R RRRN(Rttststringtreplacetddtfunc(R>RAR@R=((R%Rs  cCs t|tS(sAConverts a string to an integer according to the locale settings.N(RRtint(R((R%RscCsUttdtddd}|GdGt|GHtd}|GdGt|GHdS(NRs%di[itisf3.1400000000000001(RRRts1RRR(RD((R%t_tests   cCs5|i}d|jo|idd}nd|jo+|idd \}}|d|}n |}d}ti|d}|dj o|Snti|d}|dj otd|jo|id\}}n |}d}|ot i||}n|}|o|d|Sq1|Sn|SdS(s Returns a normalized locale code for the given locale name. The returned locale code is formatted for use with setlocale(). If normalization fails, the original name is returned unchanged. If the given encoding is not known, the function defaults to the default encoding for the locale code just like setlocale() does. t:RiRN( t localenametlowertfullnameR?R:tlangnametencodingt locale_aliastgetR(tcodetdefenctencoding_alias(RGRNRJRKRORI((R%t normalizes2      cCst|}d|joA|id\}}|djod|jo|dfSqZnd|jot|idd Sn|djod Sntd|dS( s Parses the locale code for localename and returns the result as tuple (language code, encoding). The localename is normalized and passed through the locale alias engine. A ValueError is raised in case the locale name cannot be parsed. The language code corresponds to RFC 1766. code and encoding can be None in case the values cannot be determined or are unknown to this implementation. t@teuroRs iso-8859-15iR&sunknown locale: %sN(NN(RQRGRNR:tmodifierttupleR(t ValueError(RGRNRT((R%t_parse_localenames     cCsH|\}}|djo d}n|djo|Sn |d|SdS(s Builds a locale code from the given tuple (language code, encoding). No aliasing or normalizing takes place. R&RN(t localetupletlanguageRKR((RXRKRY((R%t_build_localenames    tLANGtLANGUAGEcCsydk}|i\}}Wnttfj onPXtidjo4|o-|d djoti t |d}n||fSdk }|i i }xS|D]E}||d}|o)|djo|idd}nPqqWd}t|S( s Tries to determine the default locale settings and returns them as tuple (language code, encoding). According to POSIX, a program which has not called setlocale(LC_ALL, "") runs using the portable 'C' locale. Calling setlocale(LC_ALL, "") lets it use the default locale as defined by the LANG variable. Since we don't want to interfere with the current locale setting we thus emulate the behavior in the way described above. To maintain compatibility with other platforms, not only the LANG variable is tested, but a list of variables given as envvars parameter. The first found to be defined will be used. envvars defaults to the search path used in GNU gettext; it must always contain the variable name 'LANG'. Except for the code 'C', the language code corresponds to RFC 1766. code and encoding can be None in case the values cannot be determined. Ntwin32it0xiR\RFR&(t_localet_getdefaultlocaleRNRKt ImportErrortAttributeErrortsystplatformtwindows_localeRMRBtostenvirontlookuptenvvarstvariableR(RGR:RW(RiR_RNRKRfRhRjRG((R%tgetdefaultlocale(s( (     cCs=t|}|tjod|jo tdnt|S(sp Returns the current setting for the given locale category as tuple (language code, encoding). category may be one of the LC_* value except LC_ALL. It defaults to LC_CTYPE. Except for the code 'C', the language code corresponds to RFC 1766. code and encoding can be None in case the values cannot be determined. t;s category LC_ALL is not supportedN(t _setlocaleR)RGRt TypeErrorRW(R)RG((R%t getlocale]s   cCsC|o/t|tdj ott|}nt||S(sE Set the locale for the given category. The locale can be a string, a locale tuple (language code, encoding), or None. Locale tuples are converted to strings the locale aliasing engine. Locale strings are passed directly to the C lib. category may be given as one of the LC_* values. RN(tlocalettypeRQRZRmR)(R)Rp((R%Ros  cCst|ttdS(s Sets the locale for category to the default setting. The default setting is determined by calling getdefaultlocale(). category defaults to LC_ALL. N(RmR)RZRk(R)((R%t resetlocalesR]tdarwintmaccCsdk}|idS(s1Return the charset that the user is likely using.Ni(R_R`(t do_setlocaleR_((R%tgetpreferredencodings cCs tdS(sbReturn the charset that the user is likely using, by looking at environment variables.iN(Rk(Ru((R%RvscCsO|o:tt}ttdtt}tt||Sn ttSdS(sdReturn the charset that the user is likely using, according to the system configuration.RN(RuRR toldloct nl_langinfotCODESETR1(RuRwR1((R%Rvs    t437R&tctiso8859s ISO8859-1t8859t88591tasciitentiso88591s iso_8859-1t885915s ISO8859-15t iso885915s iso_8859-15s iso8859-2s ISO8859-2tiso88592s iso_8859-2tiso88595s ISO8859-5tiso88596s ISO8859-6tiso88597s ISO8859-7tiso88598s ISO8859-8tiso88599s ISO8859-9s iso-2022-jptJIS7tjistjis7tsjistSJISttis620tTACTIStajecteucJPteucjptujissutf-8tutftutf8s utf8@ucs4tamericansen_US.ISO8859-1tarsar_AA.ISO8859-6tar_aatar_sasar_SA.ISO8859-6tarabictbgsbg_BG.ISO8859-5tbg_bgt bulgariansc-frenchsfr_CA.ISO8859-1tc_ctcextends chinese-ss zh_CN.eucCNs chinese-ts zh_TW.eucTWtcroatianshr_HR.ISO8859-2tcsscs_CZ.ISO8859-2tcs_cstcs_cztczscz_CZ.ISO8859-2tcz_cztczechscs_CS.ISO8859-2tdasda_DK.ISO8859-1tda_dktdanishtdesde_DE.ISO8859-1tde_atsde_AT.ISO8859-1tde_chsde_CH.ISO8859-1tde_detdutchsnl_BE.ISO8859-1teesee_EE.ISO8859-4telsel_GR.ISO8859-7tel_grten_ausen_AU.ISO8859-1ten_casen_CA.ISO8859-1ten_gbsen_GB.ISO8859-1ten_iesen_IE.ISO8859-1ten_nzsen_NZ.ISO8859-1ten_ukten_usteng_gbtenglishsen_EN.ISO8859-1t english_uksenglish_united-statest english_ustesses_ES.ISO8859-1tes_arses_AR.ISO8859-1tes_boses_BO.ISO8859-1tes_clses_CL.ISO8859-1tes_coses_CO.ISO8859-1tes_crses_CR.ISO8859-1tes_ecses_EC.ISO8859-1tes_estes_gtses_GT.ISO8859-1tes_mxses_MX.ISO8859-1tes_nises_NI.ISO8859-1tes_pases_PA.ISO8859-1tes_peses_PE.ISO8859-1tes_pyses_PY.ISO8859-1tes_svses_SV.ISO8859-1tes_uyses_UY.ISO8859-1tes_veses_VE.ISO8859-1tetset_EE.ISO8859-4tet_eetfisfi_FI.ISO8859-1tfi_fitfinnishtfrsfr_FR.ISO8859-1tfr_besfr_BE.ISO8859-1tfr_catfr_chsfr_CH.ISO8859-1tfr_frtfre_frtfrencht french_francetger_detgermantgerman_germanytgreekthebrewsiw_IL.ISO8859-8thrthr_hrthushu_HU.ISO8859-2thu_hut hungariant icelandicsis_IS.ISO8859-1tidsid_ID.ISO8859-1tid_idRCtis_iss iso-8859-1s iso-8859-15sen_US.ISO8859-15s iso8859-1s iso8859-15t iso_8859_1t iso_8859_15titsit_IT.ISO8859-1tit_chsit_CH.ISO8859-1tit_ittitaliantiwtiw_iltjas ja_JP.eucJPsja.jiss ja_JP.JIS7sja.sjiss ja_JP.SJIStja_jps ja_jp.ajecs ja_jp.eucs ja_jp.eucjpsja_jp.iso-2022-jps ja_jp.jiss ja_jp.jis7s ja_jp.mscodes ja_jp.sjiss ja_jp.ujistjapantjapaneses japanese-eucs japanese.euctjp_jptkos ko_KR.eucKRtko_krs ko_kr.euctkoreantltslt_LT.ISO8859-4tlvslv_LV.ISO8859-4tmksmk_MK.ISO8859-5tmk_mktnlsnl_NL.ISO8859-1tnl_betnl_nltnosno_NO.ISO8859-1tno_not norwegiantplspl_PL.ISO8859-2tpl_pltpolisht portuguesespt_PT.ISO8859-1tportuguese_brazilspt_BR.ISO8859-1tposixs posix-utf2tpttpt_brtpt_pttrosro_RO.ISO8859-2tro_rotrusru_RU.ISO8859-5tru_rutrumaniantrussiant serbocroatianssh_YU.ISO8859-2tshtsh_hrssh_HR.ISO8859-2tsh_sptsh_yutskssk_SK.ISO8859-2tsk_sktslssl_CS.ISO8859-2tsl_cstsl_sissl_SI.ISO8859-2tslovaktsloveneR5ssp_YU.ISO8859-5tsp_yutspanisht spanish_spaintsr_spssr_SP.ISO8859-2tsvssv_SE.ISO8859-1tsv_setswedishtth_ths th_TH.TACTISttrstr_TR.ISO8859-9ttr_trtturkishtunivs en_US.utft universaltzhtzh_cns zh_cn.big5s zh_cn.euctzh_tws zh_tw.euci6taf_ZAitsq_ALitar_SAitar_IQi tar_EGitar_LYitar_DZitar_MAitar_TNi tar_OMi$tar_YEi(tar_SYi,tar_JOi0tar_LBi4tar_KWi8tar_AEi<tar_BHi@tar_QAi+thy_AMi,taz_AZi,i-teu_ESi#tbe_BYiEtbn_INi tbs_BAii~tbr_FRitbg_BGitca_EStzh_CHSitzh_TWitzh_CNi tzh_HKitzh_SGitzh_MOi|tzh_CHTithr_HRithr_BAitcs_CZitda_DKitgbz_AFietdiv_MVitnl_NLitnl_BEi ten_USi ten_GBi ten_AUi ten_CAi ten_NZi ten_IEi ten_ZAi ten_JAi $ten_CBi (ten_BZi ,ten_TTi 0ten_ZWi 4ten_PHi%tet_EEi8tfo_FOidtfil_PHi tfi_FIi tfr_FRi tfr_BEi tfr_CAi tfr_CHi tfr_LUi tfr_MCibtfy_NLiVtgl_ESi7tka_GEitde_DEitde_CHi tde_ATitde_LUitde_LIitel_GRiGtgu_INi the_ILi9thi_INithu_HUitis_ISi!tid_IDi]tiu_CAi]i<tga_IEi4txh_ZAi5tzu_ZAitit_ITitit_CHitja_JPiKtkn_INi?tkk_KZiWtkok_INitko_KRi@tky_KGi&tlv_LVi'tlt_LTintlb_LUi/tmk_MKi>tms_MYi>tms_BNiLtml_INi:tmt_MTitmi_NZiztarn_CLiNtmr_INi|tmoh_CAiPtmn_MNiatne_NPitnb_NOitnn_NOitoc_FRiHtor_INictps_AFi)tfa_IRitpl_PLitpt_BRitpt_PTiFtpa_INiktquz_BOiktquz_ECik tquz_PEitro_ROitrm_CHitru_RUi;$tsmn_FIi;tsmj_NOi;tsmj_SEi;tse_NOi;tse_SEi; tse_FIi; tsms_FIi;tsma_NOi;tsma_SEiOtsa_INi tsr_SPitsr_BAiiiltns_ZAi2ttn_ZAitsk_SKi$tsl_SIi tes_ESi tes_MXi i tes_GTi tes_CRi tes_PAi tes_DOi tes_VEi $tes_COi (tes_PEi ,tes_ARi 0tes_ECi 4tes_CLi 8tes_URi <tes_PYi @tes_BOi Dtes_SVi Htes_HNi Ltes_NIi Ptes_PRiAtsw_KEitsv_SEitsv_FIiZtsyr_SYiItta_INiDttt_RUiJtte_INitth_THittr_TRi"tuk_UAi tur_PKi tur_INiCtuz_UZiCi*tvi_VNiRtcy_GBcCsh}|d}||d=dGHddGHt\}}dG|pdGHdG|pdGHHd GHddGHxV|iD]H\}}|Gd GHt|\}}d G|pdGHd G|pdGHHqyWHd GHddGHt xV|iD]H\}}|Gd GHt|\}}d G|pdGHd G|pdGHHqWyt t dWndGHdGHdGHniXHdGHddGHxV|iD]H\}}|Gd GHt|\}}d G|pdGHd G|pdGHHqzWdS(s Test function. cCsCx<tiD]+\}}|d djo|||