o
    Lh                     @  s:   d dl mZ d dlmZ dddZdddZdddZdS )    )annotations)warnreturnintc                  C  s   ddl } ddlm} ddl}t||jj}|  }d}z-|rE| |}|	|s7t
|jdd }r?|	dr?|j}|d7 }nW ~|S |s	 W ~|S ~w )zFind the first place in the stack that is not inside narwhals.

    Returns:
        Stacklevel.

    Taken from:
    https://github.com/pandas-dev/pandas/blob/ab89c53f48df67709a533b6a95ce3d911871a0a8/pandas/util/_exceptions.py#L30-L51
    r   N)Pathco_qualnamezsingledispatch.   )inspectpathlibr   narwhalsstr__file__parentcurrentframegetfile
startswithgetattrf_codef_back)r	   r   nwpkg_dirframenfnamequalname r   U/var/www/html/Persson_Maskin/env/lib/python3.10/site-packages/narwhals/_exceptions.pyfind_stacklevel   s0   	


r   messager   _versionNonec                 C  s   t | tt d dS )zIssue a deprecation warning.

    Arguments:
        message: The message associated with the warning.
        _version: Narwhals version when the warning was introduced. Just used for internal
            bookkeeping.
    r   category
stacklevelN)r   DeprecationWarningr   )r   r   r   r   r   issue_deprecation_warning0   s   r%   r"   type[Warning]c                 C  s   t | |t d d S )Nr!   )r   r   )r   r"   r   r   r   issue_warning;   s   r'   N)r   r   )r   r   r   r   r   r    )r   r   r"   r&   r   r    )
__future__r   warningsr   r   r%   r'   r   r   r   r   <module>   s
    

*