
    11i                     ~    S r SSKrSSKJr  SSKJrJr  SSKJr  SSK	J
r
JrJr  SSKJrJr  / rS rS	 r\
\-   4S
 jrg)z
This modules provides a method to parse an ISO 8601:2004 time string to a
Python datetime.time instance.

It supports all basic and extended formats including time zone specifications
as described in the ISO standard.
    N)time)ROUND_FLOORDecimal)ISO8601Error)TIME_EXT_COMPLETETZ_EXTstrftime)TZ_REGEXbuild_tzinfoc                  z    [         (       d+  S n U " S5        U " S5        U " S5        U " S5        U " S5        [         $ )z
Build regular expressions to parse ISO time string.

The regular expressions are compiled and stored in TIME_REGEX_CACHE
for later reuse.
c                 p    [         R                  [        R                  " SU -   [        -   S-   5      5        g )Nz\Az\Z)TIME_REGEX_CACHEappendrecompiler
   )
regex_texts    I/home/james-whalen/.local/lib/python3.13/site-packages/isodate/isotime.pyadd_re"build_time_regexps.<locals>.add_re-   s(    ##BJJuz/AH/Lu/T$UV    zKT?(?P<hour>[0-9]{2}):(?P<minute>[0-9]{2}):(?P<second>[0-9]{2}([,.][0-9]+)?)zIT?(?P<hour>[0-9]{2})(?P<minute>[0-9]{2})(?P<second>[0-9]{2}([,.][0-9]+)?)z6T?(?P<hour>[0-9]{2}):(?P<minute>[0-9]{2}([,.][0-9]+)?)z5T?(?P<hour>[0-9]{2})(?P<minute>[0-9]{2}([,.][0-9]+)?)z!T?(?P<hour>[0-9]{2}([,.][0-9]+)?))r   )r   s    r   build_time_regexpsr      sQ     "	W
 		
 		
 	PQOP78r   c           
         [        5       nU GHh  nUR                  U 5      nU(       d  M  UR                  5       nUR                  5        H  u  pVUc  M
  UR	                  SS5      XE'   M      [        US   US   [        US   =(       d    S5      [        US   =(       d    S5      5      nSU;   a  [        US   5      R                  [        S	5      [        S
9nU[        U5      -
  [        S5      -  n	[        [        US   5      [        US   5      [        U5      [        U	R                  5       5      U5      s  $ SU;   a  [        US   5      n
[        U
[        U
5      -
  S-  5      R                  [        S	5      [        S
9nU[        U5      -
  [        S5      -  n	[        [        US   5      [        U
5      [        U5      [        U	R                  5       5      U5      s  $ Su  pn
[        US   5      nU[        U5      -
  S-  n
U
[        U
5      -
  S-  nU[        U5      -
  [        S5      -  n	[        [        U5      [        U
5      [        U5      [        U	R                  5       5      U5      s  $    [        SU -  5      e)aJ  
Parses ISO 8601 times into datetime.time objects.

Following ISO 8601 formats are supported:
  (as decimal separator a ',' or a '.' is allowed)
  hhmmss.ssTZD    basic complete time
  hh:mm:ss.ssTZD  extended complete time
  hhmm.mmTZD      basic reduced accuracy time
  hh:mm.mmTZD     extended reduced accuracy time
  hh.hhTZD        basic reduced accuracy time
TZD is the time zone designator which can be in the following format:
          no designator indicates local time zone
  Z       UTC
  +-hhmm  basic hours and minutes
  +-hh:mm extended hours and minutes
  +-hh    hours
,.tznametzsigntzhourr   tzminsecondz.000001)roundingg    .Ahourminute<   )r   r   r   z%Unrecognised ISO 8601 time format: %r)r   match	groupdictitemsreplacer   intr   quantizer   r   to_integralr   )
timestringisotimespatternr$   groupskeyvaluetzinfor   microsecondr"   r!   s               r   
parse_timer3   I   so   $ "#Hj)5__&F$lln
$"'--S"9FK - "x x F8$)*F7O(q)	F 6! !12;;I& <   &F3s3x? v'x()K//12  6! !12 &3v;"6"!<=FFI& G   &F3s3x?v'KK//12  /6+V6&>*DSY&",Fs6{*b0F!CK/3s8;KD	FFK++-. ] j >K
LLr   c                     [        X5      $ )z
Format time strings.

This method is just a wrapper around isodate.isostrf.strftime and uses
Time-Extended-Complete with extended time zone as default format.
)r	   )ttimeformats     r   time_isoformatr7      s     E""r   )__doc__r   datetimer   decimalr   r   isodate.isoerrorr   isodate.isostrfr   r   r	   isodate.isotzinfor
   r   r   r   r3   r7    r   r   <module>r?      sD    
  ( ) ? ? 4 1hHMV "3V!; #r   