U
    `»{j	  ã                   @  sh   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 ejddddœdd„ƒZ	ej
d	d
œdd„ƒZdS )é    )ÚannotationsN)ÚIteratorÚstrzIterator[None])Úold_nameÚnew_nameÚreturnc              
   c  s‚   z
dV  W nr t k
r| } zT|js$‚ t|jd ƒ}| | |¡}|f}t|jƒdkrd||jdd…  }||_‚ W 5 d}~X Y nX dS )z.
    Rewrite the message of an exception.
    Nr   é   )Ú	ExceptionÚargsr   ÚreplaceÚlen)r   r   ÚerrÚmsgr
   © r   úV/var/www/html/bwave/python/venv/lib/python3.8/site-packages/pandas/util/_exceptions.pyÚrewrite_exception
   s    
r   Úint)r   c                 C  sb   ddl }tj |j¡}tj |d¡}d}| r^t | ¡}| |¡r^| |¡s^| j	} |d7 }q(q^q(|S )a  
    Find the first place in the stack that is not inside pandas
    (tests notwithstanding).

    ``frame`` should be passed as ``inspect.currentframe()`` by the
    calling function.

    https://stackoverflow.com/questions/17407119/python-inspect-stack-is-slow
    r   NZtestsr   )
ZpandasÚosÚpathÚdirnameÚ__file__ÚjoinÚinspectÚgetfileÚ
startswithÚf_back)ÚframeÚpdZpkg_dirZtest_dirÚnÚfnamer   r   r   Úfind_stack_level   s    

r    )Ú
__future__r   Ú
contextlibÚ	functoolsr   r   Útypingr   Úcontextmanagerr   Ú	lru_cacher    r   r   r   r   Ú<module>   s   