• File: dateinterval.cpython-37.pyc
  • Full Path: /home3/farmfre2/public_html/ALFA_DATA/alfasymlink/root/opt/alt/python37/lib/python3.7/site-packages/paste/util/__pycache__/dateinterval.cpython-37.pyc
  • Date Modified: 12/01/2019 7:09 PM
  • File size: 2.35 KB
  • MIME-type: text/x-bytecode.python
  • Charset: 8 bit
B

bNn	@sdZddlZddgZdZedZedZedZedZed	Zed
Z	e	eeeeeedZ
e
Ze
dd
dddZedZddZddZedkrddlZedS)a
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.  
Ninterval_decodeinterval_encode<im)ybwdhmscCst|d|dS)Nr)cmp)ar
rH/opt/alt/python37/lib/python3.7/site-packages/paste/util/dateinterval.py<lambda>"rFcCsrd}|}t|}x6tD].\}}||krt||\}}|d||f7}qW|dkrZd|}n|sbdS|rnd|}|S)zEncodes a number of seconds (representing a time interval)
    into a form like 1h2d3s.

    >>> interval_encode(10)
    '10s'
    >>> interval_encode(493939)
    '5d17h12m19s'
    z%i%sr-0+)abstimeOrdereddivmod)secondsZinclude_signrorigcharamountirrrr$s	
z[0-9]+[a-zA-Z]cCsd}d}|}|dr,|dd}d}n|drB|dd}xRt|tD]D}|dd}t|spqN|t|dddt|7}qNW|S)zDecodes 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
    rrrNr)	strip
startswith
allMatches_timeREgrouplower
timeValuesZhas_keyint)rtimesignmatchrrrrr=s


&cCsDd}t|}g}|||}x"|r>|||||}qW|S)z1Return a list of matches for regex in source
    r)lensearchappendend)sourceregexposr1rvr-rrrr%Ys
r%__main__)F)__doc__re__all__secondminutehourdayweekmonthyearr)itemsrsortrcompiler&rr%__name__ZdoctestZtestmodrrrr<module>s2