
    AHj                    \    d dl mZ d dlZd dlZd dlmZ d dlmZ d dlZ	ddZ
d	dZefd
dZy)    )annotationsN)Path)Anyc                 p   t        t        t        j                        j                        } t        j                         }d}	 |rit        j                  |      }|j                  |       s*t        |j                  dd      x}r#|j                  d      r|j                  }|dz  }n	 ~|S |ri~|S # ~w xY w)z
    Find the first place in the stack that is not inside Polars.

    Taken from:
    https://github.com/pandas-dev/pandas/blob/ab89c53f48df67709a533b6a95ce3d911871a0a8/pandas/util/_exceptions.py#L30-L51
    r   co_qualnameNzsingledispatch.   )strr   pl__file__parentinspectcurrentframegetfile
startswithgetattrf_codef_back)pkg_dirframenfnamequalnames        H/root/tools/cai/cai_env/lib/python3.12/site-packages/polars/_warnings.pyfind_stacklevelr      s     $r{{#**+G   "E	AOOE*E($U\\=$GGG''(9:Q H#   H s   A$B2 ,B2 2B5c                F    t        j                  d| |t               d| y)a   
    Issue a warning.

    Parameters
    ----------
    message
        The message associated with the warning.
    category
        The warning category.
    **kwargs
        Additional arguments for `warnings.warn`. Note that the `stacklevel` is
        determined automatically.
    )messagecategory
stacklevelN warningswarnr   )r   r   kwargss      r   issue_warningr$   ,   s'     MM (7HLR    c                D    t        j                  | |t                      y )N)r   r   r    )msgr   s     r   _polars_warnr(   @   s    MM"$r%   )returnint)r   r	   r   type[Warning]r#   r   r)   None)r'   r	   r   r+   r)   r,   )
__future__r   r   r!   pathlibr   typingr   polarsr
   r   r$   UserWarningr(   r   r%   r   <module>r2      s-    "     B( 6A r%   