
    aVg	                        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y)    )annotationsN)Iteratorc              #    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        X/var/www/html/hubwallet-dev/venv/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_warningr9   6   s     * &		 	 	- 
6{Q

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