Sindbad~EG File Manager

Current Path : /usr/local/lib/python3.12/site-packages/pandas/util/__pycache__/
Upload File :
Current File : //usr/local/lib/python3.12/site-packages/pandas/util/__pycache__/_exceptions.cpython-312.pyc

�

Mٜg<����ddlmZddlZddlZddlZddlZddlmZddlZerddl	m
Z
ddlmZejd	d��Zd
d�Zej	d									dd��Zy)
�)�annotationsN)�
TYPE_CHECKING)�	Generator)�	FrameTypec#�K�	d��y#t$rq}|js�t|jd�}|j||�}|f}t	|j�dkDr||jddz}||_�d}~wwxYw�w)z.
    Rewrite the message of an exception.
    Nr�)�	Exception�args�str�replace�len)�old_name�new_name�err�msgr
s     �B/usr/local/lib/python3.12/site-packages/pandas/util/_exceptions.py�rewrite_exceptionrs~����
�
���	��x�x���#�(�(�1�+����k�k�(�H�-��!$����s�x�x�=�1���#�(�(�1�2�,�&�D����
��	�s%�B�	�B�	B�A,A>�>B�Bc��ddl}tjj|j�}tjj|d�}t
j�}	d}|rPt
j|�}|j|�r#|j|�s|j}|dz
}n	~|S|r�P~|S#~wxYw)zb
    Find the first place in the stack that is not inside pandas
    (tests notwithstanding).
    rN�testsr)�pandas�os�path�dirname�__file__�join�inspect�currentframe�getfile�
startswith�f_back)�pd�pkg_dir�test_dir�frame�n�filenames      r�find_stack_levelr'"s�����g�g�o�o�b�k�k�*�G��w�w�|�|�G�W�-�H�&�2�2�4�E��
������u�-�H��"�"�7�+�H�4G�4G��4Q������Q����
��H��
��H��
�s�#A
B:�4B:�:B=c#��K�|�|}tjd��5}d��ddd�t�dkDr�tj|�}|D]�}|j
|ur.tj|t|j��r|}|}n|j
|j}}tj|||j|j����yy#1swY��xYw�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�categoryr&�lineno)�warnings�catch_warningsr
�re�compiler+�searchrr*�
warn_explicitr&r,)	�target_message�target_category�new_message�new_categoryr)�match�warningr+r*s	         r�rewrite_warningr9?s�����*��&��	�	 �	 ��	-��
�
.�
�6�{�Q���
�
�>�*���G����?�2�r�y�y��s�7�?�?�+�8�(��)4��$+�$4�$4�g�o�o�'���"�"��!� �)�)��~�~�	
���
.�	-�s�C#�C�B5C#�C �C#)rrrr�return�Generator[None, None, None])r:�int)N)
r3rr4z
type[Warning]r5rr6ztype[Warning] | Noner:r;)�
__future__r�
contextlibrrr/�typingrr-�collections.abcr�typesr�contextmanagerrr'r9��r�<module>rEs���"���	�	� ���)��������$
�:���
*.�	'��'�"�'��'�'�	'�
!�'��'rD

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists