Ñò ž²Hc@s+dZddkZddklZlZddkZddkZyeWn#ej oddk l ZnXddk Z ddk Z ddk lZlZeƒZdddd d d d gZd Zd„ZeideiƒZd„Zd„Zde ifd„ƒYZdddd„Zd efd„ƒYZyeiiZWne j odd„ZnXedƒZ!defd„ƒYZ"yddk#l$Z$Wn"e%j oe"dd ƒZ$nXede i& ƒZ'e i(oede i) ƒZ*ne'Z*e*e'Z+defd „ƒYZ,e,ƒZ-dS(!s&Various utility classes and functions.iÿÿÿÿN(t timedeltattzinfo(tSet(tiziptimaptdistinctt pathmatchtrelpathtwraptexttodicttUTCtLOCALTZsrestructuredtext enccsGtƒ}x7t|ƒD])}||jo|V|i|ƒqqWdS(sßYield all items in an iterable collection that are distinct. Unlike when using sets for a similar effect, the original ordering of the items in the collection is preserved by this function. >>> print list(distinct([1, 2, 1, 3, 4, 4])) [1, 2, 3, 4] >>> print list(distinct('foobar')) ['f', 'o', 'b', 'a', 'r'] :param iterable: the iterable collection providing the data :return: the distinct items in the collection :rtype: ``iterator`` N(tsettitertadd(titerabletseentitem((s./usr/lib/python2.6/site-packages/babel/util.pyR"s    s([ \t\f]* \# .* coding[=:][ \t]*([-\w.]+)c Cs|iƒ}|idƒzê|iƒ}|itiƒ}|o|ttiƒ}nti|ƒ}|pXyddk }|i |ƒWnt t fj oqÆX|iƒ}ti|ƒ}n|o|ot dƒ‚ndS|o|i dƒSdSWd|i|ƒXdS(sDeduce the encoding of a source file from magic comment. It does this in the same way as the `Python interpreter`__ .. __: http://docs.python.org/ref/encodings.html The ``fp`` argument should be a seekable file object. (From Jeff Dairiki) iiÿÿÿÿNs\python refuses to compile code with both a UTF8 byte-order-mark and a magic encoding commenttutf_8i(ttelltseektreadlinet startswithtcodecstBOM_UTF8tlentPYTHON_MAGIC_COMMENT_retmatchtparsertsuitet ImportErrort SyntaxErrortgrouptNone(tfptpostline1thas_bomtmRtline2((s./usr/lib/python2.6/site-packages/babel/util.pytparse_encoding:s2      cCsØhdd6dd6dd6dd6d d 6d d 6}g}xgttid |ƒƒD]M\}}|do|i||ƒqO|o|iti|ƒƒqOqOWtidi|ƒd|iti dƒƒ}|dj S(s…Extended pathname pattern matching. This function is similar to what is provided by the ``fnmatch`` module in the Python standard library, but: * can match complete (relative or absolute) path names, and not just file names, and * also supports a convenience pattern ("**") to match files at any directory level. Examples: >>> pathmatch('**.py', 'bar.py') True >>> pathmatch('**.py', 'foo/bar/baz.py') True >>> pathmatch('**.py', 'templates/index.html') False >>> pathmatch('**/templates/*.html', 'templates/index.html') True >>> pathmatch('**/templates/*.html', 'templates/foo/bar.html') False :param pattern: the glob pattern :param filename: the path name of the file to match against :return: `True` if the path name matches the pattern, `False` otherwise :rtype: `bool` s[^/]t?s[^/]/s?/s[^/]+t*s[^/]+/s*/s (?:.+/)*?s**/s(?:.+/)*?[^/]+s**s ([?*]+/?)itt$t/N( t enumeratetretsplittappendtescapeRtjointreplacetostsepR!(tpatterntfilenametsymbolstbuftidxtpartR((s./usr/lib/python2.6/site-packages/babel/util.pyRis    .t TextWrappercBseZeidƒZRS(s((\s+|(?<=[\w\!\"\'\&\.\,\?])-{2,}(?=\w))(t__name__t __module__R/tcompilet wordsep_re(((s./usr/lib/python2.6/site-packages/babel/util.pyR=™siFR+c Cs.td|d|d|dtƒ}|i|ƒS(s Simple wrapper around the ``textwrap.wrap`` function in the standard library. This version does not wrap lines on hyphens in words. :param text: the text to wrap :param width: the maximum line width :param initial_indent: string that will be prepended to the first line of wrapped output :param subsequent_indent: string that will be prepended to all lines save the first of wrapped output :return: a list of lines :rtype: `list` twidthtinitial_indenttsubsequent_indenttbreak_long_words(R=tFalsetwrap(ttextRBRCRDtwrapper((s./usr/lib/python2.6/site-packages/babel/util.pyR s  cBs¤eZdZdd„Zd„Zd„Zd„ZeZd„Z d„Z d„Z d„Z d „Z ed „Zd „Zdd „Zd „Zd„Zd„ZRS(soOrdered dict implementation. :see: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/107747 cCs-ti||phƒti|ƒ|_dS(N(tdictt__init__tkeyst_keys(tselftdata((s./usr/lib/python2.6/site-packages/babel/util.pyRK¸scCs$ti||ƒ|ii|ƒdS(N(RJt __delitem__RMtremove(RNtkey((s./usr/lib/python2.6/site-packages/babel/util.pyRP¼scCs;ti|||ƒ||ijo|ii|ƒndS(N(RJt __setitem__RMR1(RNRRR((s./usr/lib/python2.6/site-packages/babel/util.pyRSÀscCs t|iƒS(N(R RM(RN((s./usr/lib/python2.6/site-packages/babel/util.pyt__iter__ÅscCsti|ƒg|_dS(N(RJtclearRM(RN((s./usr/lib/python2.6/site-packages/babel/util.pyRUÉs cCstƒ}|i|ƒ|S(N(R tupdate(RNtd((s./usr/lib/python2.6/site-packages/babel/util.pytcopyÍs  cCst|i|iƒƒS(N(tzipRMtvalues(RN((s./usr/lib/python2.6/site-packages/babel/util.pytitemsÒscCst|i|iƒƒS(N(RRMt itervalues(RN((s./usr/lib/python2.6/site-packages/babel/util.pyt iteritemsÕscCs|iS(N(RM(RN((s./usr/lib/python2.6/site-packages/babel/util.pyRLØscCsS|tjoti||ƒS||jo|S|ii|ƒti|||ƒS(N(tmissingRJtpopRMRQ(RNRRtdefault((s./usr/lib/python2.6/site-packages/babel/util.pyR_Ûs   cCs|ii|ƒti|ƒS(N(RMRQRJtpopitem(RNRR((s./usr/lib/python2.6/site-packages/babel/util.pyRaãscCs;ti|||ƒ||ijo|ii|ƒndS(N(RJt setdefaultRMR1(RNRRtfailobj((s./usr/lib/python2.6/site-packages/babel/util.pyRbçscCs+x$|iƒD]\}}|||R?t__doc__R!RKRPRSRTtiterkeysRURXR[R]RLR^R_RaRbRVRZR\(((s./usr/lib/python2.6/site-packages/babel/util.pyR ³s"              t.cCstii|ƒitiƒ}tii|ƒitiƒ}ttii||gƒƒ}tiigt|ƒ|||}tii|ŒS(s‰Compute the relative path to one path from another. >>> relpath('foo/bar.txt', '').replace(os.sep, '/') 'foo/bar.txt' >>> relpath('foo/bar.txt', 'foo').replace(os.sep, '/') 'bar.txt' >>> relpath('foo/bar.txt', 'baz').replace(os.sep, '/') '../foo/bar.txt' :return: the relative path :rtype: `basestring` ( R5tpathtabspathR0R6Rt commonprefixtpardirR3(Rjtstartt start_listt path_listtitrel_list((s./usr/lib/python2.6/site-packages/babel/util.pyRús %itFixedOffsetTimezonecBsGeZdZdd„Zd„Zd„Zd„Zd„Zd„Z RS(s&Fixed offset in minutes east from UTC.cCs:td|ƒ|_|djod|}n||_dS(Ntminutess Etc/GMT+%d(Rt_offsetR!tzone(RNtoffsettname((s./usr/lib/python2.6/site-packages/babel/util.pyRKs cCs|iS(N(Rv(RN((s./usr/lib/python2.6/site-packages/babel/util.pyt__str__scCsd|i|ifS(Ns(RvRu(RN((s./usr/lib/python2.6/site-packages/babel/util.pyt__repr__scCs|iS(N(Ru(RNtdt((s./usr/lib/python2.6/site-packages/babel/util.pyt utcoffset"scCs|iS(N(Rv(RNR{((s./usr/lib/python2.6/site-packages/babel/util.pyttzname%scCstS(N(tZERO(RNR{((s./usr/lib/python2.6/site-packages/babel/util.pytdst(sN( R>R?RgR!RKRyRzR|R}R(((s./usr/lib/python2.6/site-packages/babel/util.pyRss     (R tsecondst LocalTimezonecBs,eZd„Zd„Zd„Zd„ZRS(cCs|i|ƒotStSdS(N(t_isdstt DSTOFFSETt STDOFFSET(RNR{((s./usr/lib/python2.6/site-packages/babel/util.pyR|@scCs|i|ƒotStSdS(N(R‚tDSTDIFFR~(RNR{((s./usr/lib/python2.6/site-packages/babel/util.pyRFscCsti|i|ƒS(N(ttimeR}R‚(RNR{((s./usr/lib/python2.6/site-packages/babel/util.pyR}Lsc Csd|i|i|i|i|i|i|iƒddf }ti|ƒ}ti |ƒ}|i djS(Niiÿÿÿÿ( tyeartmonthtdaythourtminutetsecondtweekdayR†tmktimet localtimettm_isdst(RNR{ttttstamp((s./usr/lib/python2.6/site-packages/babel/util.pyR‚Os (R>R?R|RR}R‚(((s./usr/lib/python2.6/site-packages/babel/util.pyR>s   (.RgRtdatetimeRRR5R/R t NameErrortsetsRttextwrapR†t itertoolsRRtobjectR^t__all__t __docformat__RR@tVERBOSERR(RR=RRJR RjRtAttributeErrorR~RstpytzR RttimezoneR„tdaylighttaltzoneRƒR…RR (((s./usr/lib/python2.6/site-packages/babel/util.pytsT         / 0D