
    SOg              	          S r SSKrSrSrSrSrSrSrS	rS
r	Sr
SrSrS rS rSR                  \" \5      \" \5      \" \5      \" \5      \" \5      S9SR                  \
S9SR                  \" \5      \" \5      \S9SR                  \S9SR                  \	S9/r\R"                  " S\-   S-   5      r\ V s/ s H%  n \R#                  SU -   S-   \R&                  5      PM'     sn r\" / SQ5      rS rS S jrgs  sn f )!z
timeparse.py
(c) Will Roberts <wildwilhelm@gmail.com>  1 February, 2014

Implements a single function, `timeparse`, which can parse various
kinds of time expressions.
    Nz(?P<sign>[+|-])?z%(?P<weeks>[\d.]+)\s*(?:w|wks?|weeks?)z#(?P<days>[\d.]+)\s*(?:d|dys?|days?)z%(?P<hours>[\d.]+)\s*(?:h|hrs?|hours?)z+(?P<mins>[\d.]+)\s*(?:m|(mins?)|(minutes?))z'(?P<secs>[\d.]+)\s*(?:s|secs?|seconds?)z[,/]z:(?P<secs>\d{2}(?:\.\d+)?)z+(?P<mins>\d{1,2}):(?P<secs>\d{2}(?:\.\d+)?)z8(?P<hours>\d+):(?P<mins>\d{2}):(?P<secs>\d{2}(?:\.\d+)?)zH(?P<days>\d+):(?P<hours>\d{2}):(?P<mins>\d{2}):(?P<secs>\d{2}(?:\.\d+)?)c                 *    SR                  U [        S9$ )Nz(?:{x})?x
SEPARATORSformatr   r   s    Z/Users/admin/workspace/ai/Jarvis/env/lib/python3.13/site-packages/pytimeparse/timeparse.py<lambda>r   3   s    **Q:*F    c                 *    SR                  U [        S9$ )Nz(?:{x}\s*(?:{SEPARATORS}\s*)?)?r   r   r	   s    r
   r   r   4   s    :AAJ B  r   z,{WEEKS}\s*{DAYS}\s*{HOURS}\s*{MINS}\s*{SECS})WEEKSDAYSHOURSMINSSECSz
{MINCLOCK})MINCLOCKz{WEEKS}\s*{DAYS}\s*{HOURCLOCK})r   r   	HOURCLOCKz
{DAYCLOCK})DAYCLOCKz
{SECCLOCK})SECCLOCKz\s*z\s*(?P<unsigned>.*)$z\s*$))weeksi:	 )daysiQ )hoursi  )mins<   )secs   c                     U R                  S5      S:X  aL  SU ;  aF  SU;  d  US   c:  SU;  d  US   c.  SU;  d  US   c"  US   US'   US   US'   UR                  S5         U$ )	aU  
Times like "1:22" are ambiguous; do they represent minutes and seconds
or hours and minutes?  By default, timeparse assumes the latter.  Call
this function after parsing out a dictionary to change that assumption.

>>> import pprint
>>> pprint.pprint(_interpret_as_minutes('1:24', {'secs': '24', 'mins': '1'}))
{'hours': '1', 'mins': '24'}
:r   .r   r   r   r   r   )countpop)svalmdicts     r
   _interpret_as_minutesr%   ^   s~     JJsOq tOU"g(>E!uV}'<U"g(> vgff		&Lr   c                    [         R                  U 5      nUR                  5       S   S:X  a  SOSnUR                  5       S   n [         GH  nUR                  U 5      nU(       d  M  UR	                  S5      R                  5       (       d  MD  UR                  5       nUS:X  a  [        X5      n[        S [        UR                  5       5       5       5      (       aU  U[        [        UR                  5       5       VVs/ s H   u  pgUc  M
  [        U   [        US
5      -  PM"     snn5      -  s  $ SU;  d  US   b  US   R                  5       (       a  U[        [        [        UR                  5       5       VVs/ s H'  u  pgUS:w  d  M  Uc  M  [        U   [        U5      -  PM)     snn5      5      -  US   (       a  [        US   S
5      OS-   s  $ U[        [        UR                  5       5       VVs/ s H  u  pgUc  M
  [        U   [        U5      -  PM!     snn5      -  s  $    g	s  snnf s  snnf s  snnf )a   
Parse a time expression, returning it as a number of seconds.  If
possible, the return value will be an `int`; if this is not
possible, the return will be a `float`.  Returns `None` if a time
expression cannot be parsed from the given string.

Arguments:
- `sval`: the string value to parse

>>> timeparse('1:24')
84
>>> timeparse(':22')
22
>>> timeparse('1 minute, 24 secs')
84
>>> timeparse('1m24s')
84
>>> timeparse('1.2 minutes')
72
>>> timeparse('1.2 seconds')
1.2

Time expressions can be signed.

>>> timeparse('- 1 minute')
-60
>>> timeparse('+ 1 minute')
60

If granularity is specified as ``minutes``, then ambiguous digits following
a colon will be interpreted as minutes; otherwise they are considered seconds.

>>> timeparse('1:30')
90
>>> timeparse('1:30', granularity='minutes')
5400
sign-r   unsignedr   minutesc              3   R   #    U  H  o(       d  M  UR                  5       v   M     g 7f)N)isdigit).0vs     r
   	<genexpr>timeparse.<locals>.<genexpr>   s     B(<1;199;;(<s   
''N
   r   )COMPILED_SIGNmatch	groupdictCOMPILED_TIMEFORMATSgroupstripr%   alllistvaluessumitemsMULTIPLIERSintr-   float)r#   granularityr4   r'   timefmtr$   kr/   s           r
   	timeparserD   v   s'   L %E"6*c12qD??Z(D''d#5U[[^))++OO%Ei'-d:BU\\^(<BBBc /#B/ DJA34 $?;q>C2J#>/#B C C C %-'-'')) 3s!%++-0$S0 CI145K %>DE %>KNU1X$=0$S  T U U/4V}Sv+!EF c /#B/ BH!34 $=;q>E!H#</#B C C C+ (#B$S
#Bs*   ?	H.H.=H4H4H49	H:H:)seconds)__doc__reSIGNr   r   r   r   r   r   r   r   r   r   OPTOPTSEPr   TIMEFORMATScompiler3   Ir6   dictr>   r%   rD   )rB   s   0r
   <module>rO      sw  < 
! 746<8
+<I	< G  4:: UmD\UmD\Y ;    %,,UmD\ -      #2 

6D=+BBC'24'2G 

6G#3g#=rttD'24   
 0?CK4s   7,C9