
    i                        d dl mZ d dlmZmZ d dlmZ d dlZd dlm	Z	 d dl
mZmZ d dlmZ erd dlmZ 	 	 	 d	 	 	 	 	 dd	Zg d
Zd Zy)    )annotations)datetimetime)TYPE_CHECKINGN)is_list_like)ABCIndex	ABCSeries)notna)DateTimeErrorChoicesc                   dvrt        d      fd}| | S t        | t              r| S t        | t              r; || j                  |      }| j                  || j                  | j                        S t        | t              r	 || |      S t        |       r	 || |      S  |t        j                  | g      |      d   S )a  
    Parse time strings to time objects using fixed strptime formats ("%H:%M",
    "%H%M", "%I:%M%p", "%I%M%p", "%H:%M:%S", "%H%M%S", "%I:%M:%S%p",
    "%I%M%S%p")

    Use infer_time_format if all the strings are in the same format to speed
    up conversion.

    Parameters
    ----------
    arg : string in time format, datetime.time, list, tuple, 1-d array,  Series
    format : str, default None
        Format used to convert arg into a time object.  If None, fixed formats
        are used.
    infer_time_format: bool, default False
        Infer the time format based on the first non-NaN element.  If all
        strings are in the same format, this will speed up conversion.
    errors : {'raise', 'coerce'}, default 'raise'
        - If 'raise', then invalid parsing will raise an exception
        - If 'coerce', then invalid parsing will be set as None

    Returns
    -------
    datetime.time
    )raisecoercez+errors must be one of 'raise', or 'coerce'.c                   t        | t        t        f      rt        j                  | d      } nt        | dd      dkD  rt        d      t        j                  | d      } r|t        |       }g }|=| D ]6  }	 |j                  t        j                  ||      j                                8 |S t        d d  }d	}| D ]S  }d }	 t        j                  |      }||j                  |       /dk(  rt        d|  d      |j                  d        U |S # t        t        f$ r4}dk(  rd| d| }t        |      ||j                  d        Y d }~d }~ww xY w# t        t        f$ r| |D ]s  }		 t        j                  ||	      j                         }|s4|j!                  |j#                  |	            }
|j%                  d
|
       d} n# t        t        f$ r Y qw xY w Y w xY w)NO)dtypendim   zAarg must be a string, datetime, list, tuple, 1-d array, or Seriesr   zCannot convert z to a time with given format Fr   TzCannot convert arg z
 to a time)
isinstancelisttuplenparraygetattr	TypeErrorasarray_guess_time_format_for_arrayappendr   strptimer   
ValueError_time_formatsfromisoformatpopindexinsert)argformattimeselementerrmsgformatsformat_foundtime_objecttime_formatfmterrorsinfer_time_formats              T/app/cer_product_mecsu/.venv/lib/python3.12/site-packages/pandas/core/tools/times.py_convert_listlikez"to_time.<locals>._convert_listlike9   s   cD%=)((3c*CS&!$q(S  jjC(1#6F#% 
'	'LL!2!27F!C!H!H!JK
'L 5 $A&G L '"%"&"4"4W"=K *LL-w&$':3%z%JKKLL&-'0 G #I. '(-gY 7&&,X/  )o36LL&&' #I. %'. 
%	%*2*;*;G[*Q*V*V*XK#/&-kk'--2L&M 'q# 6/3! *I6 %$%
%%sO   ;3DEE&*EEG(2AGG(G 	G(G 	 G('G()r#   namer   )r   r   r   r	   _values_constructorr#   r4   r   r   r   r   )r%   r&   r1   r0   r3   valuess     ``  r2   to_timer8      s    > ((FGG6p {
	C	
	C	#"3;;7ciichhGG	C	" f--	c	 f--RXXse_f5a88    )z%H:%Mz%H%Mz%I:%M%pz%I%M%pz%H:%M:%Sz%H%M%Sz
%I:%M:%S%pz%I%M%S%pc                    t        |       j                         d   }t        |      r-| |d      }t        D ]  }	 t	        j
                  ||       |c S  y # t        $ r Y +w xY w)Nr   )r
   nonzerolenr    r   r   r   )arrnon_nan_elementsr(   r.   s       r2   r   r      sv    Sz))+A.
&q)*( 	K!!';7""	   s   A	A"!A")NFr   )r&   z
str | Noner1   boolr0   r   )
__future__r   r   r   typingr   numpyr   pandas._libs.libr   pandas.core.dtypes.genericr   r	   pandas.core.dtypes.missingr
   pandas._typingr   r8   r    r    r9   r2   <module>rH      se    " !  ) -3
 ##*	f9f9 f9 !	f9T	r9   