
    d
                        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j	        dd	            Z
ddZej	        	 ddd            ZdS )    )annotationsN)	Generatorold_namestrnew_namereturnGenerator[None, None, None]c              #    K   	 dV  dS # t           $ rr}|j        s t          |j        d                   }|                    | |          }|f}t	          |j                  dk    r||j        dd         z   }||_         d}~ww xY w)z.
    Rewrite the message of an exception.
    Nr      )	Exceptionargsr   replacelen)r   r   errmsgr   s        S/var/www/html/t/fyr/venv311/lib/python3.11/site-packages/pandas/util/_exceptions.pyrewrite_exceptionr      s      
 	 	 	x 	#(1+kk(H--!$sx==1#(122,&D	s   
 
BA-BBintc                 `   ddl } t          j                            | j                  }t          j                            |d          }t          j                    }d}|rNt          j        |          }|	                    |          r"|	                    |          s|j
        }|dz  }nn|N|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     goobk**Gw||GW--H  ""E	A
 &&G$$ 	U-=-=h-G-G 	LEFAA   H    target_messagetarget_categorytype[Warning]new_messagenew_categorytype[Warning] | Nonec              #    K   ||}t          j        d          5 }dV  ddd           n# 1 swxY w Y   t          |          dk    r~t          j        |           }|D ]i}|j        |u r,t          j        |t          |j                            r|}|}n|j        |j        }}t          j	        |||j
        |j                   hdS dS )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compiler3   searchr   r2   warn_explicitr4   r5   )	r*   r+   r-   r.   r1   matchwarningr3   r2   s	            r   rewrite_warningr>   6   s:     * &		 	-	-	-               
6{{Q
>** 	 	G?22rys7?++8 82 ()4$+$4go'"! )~	     	 	s   -11)r   r   r   r   r   r	   )r   r   )N)
r*   r   r+   r,   r-   r   r.   r/   r   r	   )
__future__r   
contextlibr   r   r8   typingr   r6   contextmanagerr   r(   r>    r)   r   <module>rD      s    " " " " " "      				 				           $   0 
 *.	' ' ' ' ' ' 'r)   