Spade
Mini Shell
| Directory:~$ /proc/self/root/usr/lib/python2.7/site-packages/babel/ |
| [Home] [System Details] [Kill Me] |
�
��Mc@s�dZddlZddlmZmZddlZddlZy
eZWn!ek
rmddl m
ZnXddlZddlZddl
mZmZe�Zdddd d
ddgZd
Zd�Zejdej�Zd�Zd�Zdejfd��YZdddd�Zd
efd��YZyejjZWne k
rfdd�ZnXyddl!m"Z"m#Z#Wne$k
r�d�Z#nXydj%ddd�Z%Wn e k
r�ddd�Z%nXed�Z'defd ��YZ(ydd!l)m*Z*Wn e$k
r3e(dd�Z*nXed"ej+�Z,ej-rfed"ej.�Z/ne,Z/e/e,Z0d#efd$��YZ1e1�Z2dS(%s&Various
utility classes and
functions.i����N(t timedeltattzinfo(tSet(tiziptimaptdistinctt pathmatchtrelpathtwraptexttodicttUTCtLOCALTZsrestructuredtext
enccsEt�}x5t|�D]'}||kr|V|j|�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.7/site-packages/babel/util.pyR"s
s([ \t\f]* \# .* coding[=:][
\t]*([-\w.]+)cCs|j�}|jd�z�|j�}|jtj�}|rV|ttj�}ntj|�}|s�yddl }|j
|�Wnttfk
r�q�X|j�}tj|�}n|r�|r�td��ndS|r�|j
d�SdSWd|j|�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_retmatchtparsertsuitetImportErrortSyntaxErrortgrouptNone(tfptpostline1thas_bomtmRtline2((s./usr/lib/python2.7/site-packages/babel/util.pytparse_encoding:s2
cCs�idd6dd6dd6dd6d d
6dd6}g}xcttjd
|��D]I\}}|dry|j||�qO|rO|jtj|��qOqOWtjdj|�d|jtj d��}|dk 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.7/site-packages/babel/util.pyRis
%
.tTextWrappercBseZejd�ZRS(s((\s+|(?<=[\w\!\"\'\&\.\,\?])-{2,}(?=\w))(t__name__t
__module__R/tcompilet
wordsep_re(((s./usr/lib/python2.7/site-packages/babel/util.pyR=�siFR+c Cs.td|d|d|dt�}|j|�S(sSimple
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.7/site-packages/babel/util.pyR�s
cBs�eZdZdd�Zd�Zd�Zd�ZeZd�Z d�Z
d�Zd�Zd �Z
ed
�Zd�Zdd�Zd
�Zd�Zd�ZRS(soOrdered dict
implementation.
:see: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/107747
cCs,tj||pi�tj|�|_dS(N(tdictt__init__tkeyst_keys(tselftdata((s./usr/lib/python2.7/site-packages/babel/util.pyRK�scCs$tj||�|jj|�dS(N(RJt__delitem__RMtremove(RNtkey((s./usr/lib/python2.7/site-packages/babel/util.pyRP�scCs9tj|||�||jkr5|jj|�ndS(N(RJt__setitem__RMR1(RNRRR((s./usr/lib/python2.7/site-packages/babel/util.pyRS�scCs
t|j�S(N(R
RM(RN((s./usr/lib/python2.7/site-packages/babel/util.pyt__iter__�scCstj|�g|_dS(N(RJtclearRM(RN((s./usr/lib/python2.7/site-packages/babel/util.pyRU�s
cCst�}|j|�|S(N(R tupdate(RNtd((s./usr/lib/python2.7/site-packages/babel/util.pytcopy�s
cCst|j|j��S(N(tzipRMtvalues(RN((s./usr/lib/python2.7/site-packages/babel/util.pytitems�scCst|j|j��S(N(RRMt
itervalues(RN((s./usr/lib/python2.7/site-packages/babel/util.pyt iteritems�scCs|jS(N(RM(RN((s./usr/lib/python2.7/site-packages/babel/util.pyRL�scCsO|tkrtj||�S||kr,|S|jj|�tj|||�S(N(tmissingRJtpopRMRQ(RNRRtdefault((s./usr/lib/python2.7/site-packages/babel/util.pyR_�scCs|jj|�tj|�S(N(RMRQRJtpopitem(RNRR((s./usr/lib/python2.7/site-packages/babel/util.pyRa�scCs9tj|||�||jkr5|jj|�ndS(N(RJt
setdefaultRMR1(RNRRtfailobj((s./usr/lib/python2.7/site-packages/babel/util.pyRb�scCs+x$|j�D]\}}|||<q
WdS(N(R[(RNRJRRtval((s./usr/lib/python2.7/site-packages/babel/util.pyRV�scCst|j|j�S(N(tmaptgetRM(RN((s./usr/lib/python2.7/site-packages/babel/util.pyRZ�scCst|j|j�S(N(RRfRM(RN((s./usr/lib/python2.7/site-packages/babel/util.pyR\�sN(R>R?t__doc__R!RKRPRSRTtiterkeysRURXR[R]RLR^R_RaRbRVRZR\(((s./usr/lib/python2.7/site-packages/babel/util.pyR �s" t.cCs�tjj|�jtj�}tjj|�jtj�}ttjj||g��}tjjgt|�|||}tjj|�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`
( R5tpathtabspathR0R6RtcommonprefixtpardirR3(Rjtstartt
start_listt path_listtitrel_list((s./usr/lib/python2.7/site-packages/babel/util.pyR�s
%(t
attrgettert
itemgettercs�fd�}|S(Ncs|�S(N((tobj(tname(s./usr/lib/python2.7/site-packages/babel/util.pyt_getitems((RvRw((Rvs./usr/lib/python2.7/site-packages/babel/util.pyRtscCs|j||�S(N(trsplit(ta_stringR6tmaxsplit((s./usr/lib/python2.7/site-packages/babel/util.pyRxscCsi|j|�}|dks-t|�|kr1|St|�|}|j||
�}||}|g|S(N(R0R!RR3(RyR6Rztpartstmaxsplit_indextnon_splitted_parttsplitted((s./usr/lib/python2.7/site-packages/babel/util.pyRxs
itFixedOffsetTimezonecBsGeZdZdd�Zd�Zd�Zd�Zd�Zd�Z RS(s&Fixed
offset in minutes east from
UTC.cCs8td|�|_|dkr+d|}n||_dS(Ntminutess
Etc/GMT+%d(Rt_offsetR!tzone(RNtoffsetRv((s./usr/lib/python2.7/site-packages/babel/util.pyRK,s
cCs|jS(N(R�(RN((s./usr/lib/python2.7/site-packages/babel/util.pyt__str__2scCsd|j|jfS(Ns<FixedOffset
"%s"
%s>(R�R�(RN((s./usr/lib/python2.7/site-packages/babel/util.pyt__repr__5scCs|jS(N(R�(RNtdt((s./usr/lib/python2.7/site-packages/babel/util.pyt utcoffset8scCs|jS(N(R�(RNR�((s./usr/lib/python2.7/site-packages/babel/util.pyttzname;scCstS(N(tZERO(RNR�((s./usr/lib/python2.7/site-packages/babel/util.pytdst>sN(
R>R?RgR!RKR�R�R�R�R�(((s./usr/lib/python2.7/site-packages/babel/util.pyR)s (R
tsecondst
LocalTimezonecBs,eZd�Zd�Zd�Zd�ZRS(cCs|j|�rtStSdS(N(t_isdstt DSTOFFSETt STDOFFSET(RNR�((s./usr/lib/python2.7/site-packages/babel/util.pyR�VscCs|j|�rtStSdS(N(R�tDSTDIFFR�(RNR�((s./usr/lib/python2.7/site-packages/babel/util.pyR�\scCstj|j|�S(N(ttimeR�R�(RNR�((s./usr/lib/python2.7/site-packages/babel/util.pyR�bsc Csd|j|j|j|j|j|j|j�ddf }tj|�}tj |�}|j
dkS(Nii����(tyeartmonthtdaythourtminutetsecondtweekdayR�tmktimet localtimettm_isdst(RNR�ttttstamp((s./usr/lib/python2.7/site-packages/babel/util.pyR�es(R>R?R�R�R�R�(((s./usr/lib/python2.7/site-packages/babel/util.pyR�Ts (3RgRtdatetimeRRR5R/Rt NameErrortsetsRttextwrapR�t itertoolsRRtobjectR^t__all__t
__docformat__RR@tVERBOSERR(RR=RRJR RjRtAttributeErrortoperatorRsRtRRxR!R�RtpytzR
ttimezoneR�tdaylighttaltzoneR�R�R�R(((s./usr/lib/python2.7/site-packages/babel/util.pyt<module>sf
/ 0D