
    LVfX
                        d dl mZ d dlZd dlZd dlZd dlZd dlmZ d dlZerd dl	m
Z
 ej                  dd       Zd	dZej                  	 d
	 	 	 	 	 	 	 	 	 dd       Zy)    )annotationsN)TYPE_CHECKING)	Generatorc              #    K   	 d y# t         $ rq}|j                  s t        |j                  d         }|j                  | |      }|f}t	        |j                        dkD  r||j                  dd z   }||_         d}~ww xY ww)z.
    Rewrite the message of an exception.
    Nr      )	Exceptionargsstrreplacelen)old_namenew_nameerrmsgr	   s        `/var/www/html/software/conda/envs/catlas/lib/python3.12/site-packages/pandas/util/_exceptions.pyrewrite_exceptionr      s~     
 	xx#((1+kk(H-!$sxx=1#((12,&D	s%   B	 B	BA,A>>BBc                 n   ddl } t        j                  j                  | j                        }t        j                  j                  |d      }t        j                         }d}|rOt        j                  |      }|j                  |      r#|j                  |      s|j                  }|dz  }n	 |S |rO|S )zb
    Find the first place in the stack that is not inside pandas
    (tests notwithstanding).
    r   Ntestsr   )pandasospathdirname__file__joininspectcurrentframegetfile
startswithf_back)pdpkg_dirtest_dirframenfnames         r   find_stack_levelr&   !   s     ggoobkk*Gww||GW-H   "E	A
&G$U-=-=h-GLLEFAH  H    c              #    K   ||}t        j                  d      5 }d ddd       t              dkD  rt        j                  |       }|D ]  }|j
                  |u r.t        j                  |t        |j                              r|}|}n|j
                  |j                  }}t        j                  |||j                  |j                          yy# 1 sw Y   xY ww)a  
    Rewrite the message of a warning.

    Parameters
    ----------
    target_message : str
        Warning message to match.
    target_category : Warning
        Warning type to match.
    new_message : str
        New warning message to emit.
    new_category : Warning or None, default None
        New warning type to emit. When None, will be the same as target_category.
    NT)recordr   )messagecategoryfilenamelineno)warningscatch_warningsr   recompiler+   searchr
   r*   warn_explicitr,   r-   )	target_messagetarget_categorynew_messagenew_categoryr)   matchwarningr+   r*   s	            r   rewrite_warningr:   9   s     * &		 	 	- 
6{Q

>* 	G?2ryys7??+8 ()4$+$4$4goo'""! ))~~		  s   C#CB5C#C C#)r   r
   r   r
   returnGenerator[None, None, None])r;   int)N)
r4   r
   r5   ztype[Warning]r6   r
   r7   ztype[Warning] | Noner;   r<   )
__future__r   
contextlibr   r   r0   typingr   r.   collections.abcr   contextmanagerr   r&   r:    r'   r   <module>rD      s    "   	 	   )  $0 
 *.	''"' ' '	'
 !' 'r'   