
    5je	              	           S SK JrJrJr  S SKrSSKJrJr  \(       a  SSK	J
r
  S\S\4S	 jrS
\S\R                  4S jrS\S\4S jrS
\S\\/S4   S\S\S   4S jrg)    )CallableListTYPE_CHECKINGN   )convert_dtypesconvert_str_to_timestamp   )Headlinesreturnc                     [        U [        5      (       aR  U R                  S5      (       a  U S S n OU R                  S5      (       a  U S S n U R                  S5      (       a  U S S n U $ )NZz-0000z.000)
isinstancestrendswith)r   s    \/root/lseg-credit/backend/venv/lib/python3.13/site-packages/lseg/data/content/news/_tools.pytz_replacerr      s`    !S::c??#2AZZ  #2A::f#2AH    rawc           	      n   / SQn[        U [        5      (       a   / nU  H  nUR                  US   5        M     OU S   nU Vs/ s H#  n[        [	        US   S   S   S   5      5      PM%     nn/ nU Hj  nUR                  S[        5       5      n	U	R                  S0 5      n
U	S   S   n[        S	 U 5       S 5      nUR                  U
S
   S   S   US   U/5        Ml     U(       a"  [        R                  " UUUS9n[        U5      nO[        R                  " / US9nSUR                  l        U$ s  snf )N)headlinestoryId
sourceCodedatanewsItemitemMetaversionCreated$contentMeta
infoSourcec              3   @   #    U  H  oS    S:X  d  M  US   v   M     g7f)_rolezsRole:source_qcodeN ).0items     r   	<genexpr> news_build_df.<locals>.<genexpr>-   s     XW8W^T(^s   titler   r   )r   indexcolumns)r.   )r   listextendr   r   getdictnextappendpd	DataFramer   r-   name)r   _r.   content_datair   r-   r   headline_data	news_item	item_metainfo_sourcesinfo_sourcedfs                 r   news_build_dfrA      s[   3G#tA&	*  6{ %$H 	!Xj-A*-MN^-_`c-d!ef$ 
 
 D%!%%j$&9	MM*b1	 /=XX
 	'"1%c*i(	
 & \\

 B \\"g.$BHHMICs   *D2storyc                     U R                  S[        5       5      nUR                  S[        5       5      nUR                  S[        5       /5      nUS   R                  S5      $ )Nr   r"   r   r   r!   )r1   r2   )rB   r<   content_metar   s       r   _get_headline_from_storyrE   E   sO    		*df-I==7L
TVH5HA;??3r   build_headliner
   limitc           
      @   / n[        U [        5      (       a=  / nU  H4  nUR                  UR                  SUR                  S/ 5      5      5        M6     O"U R                  SU R                  S/ 5      5      nU H  nU" U5      nUR	                  U5        M     US U nU$ )Nr   	headlines)r   r/   r0   r1   r4   )r   rF   rG   rI   r   r:   datumr   s           r   get_headlinesrK   L   s    I#tAKKfaeeK&<=>  wwvsww{B78!%("  &5!Ir   )typingr   r   r   pandasr5   _toolsr   r   headlines._datar
   r   r   r2   r6   rA   rE   intrK   r'   r   r   <module>rQ      s    0 0  >)3 3 ,t ,R\\ ,^ D  S  t Xtfj6H-I RU Z^_iZj r   