
    Whx                    <   d dl mZ d dlmZ erd dlmZmZ  G d de      Z G d de	      Z
 G d d	e
e      Z G d
 de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d dee      Z G d de      Z G d de      Z G d de      Zy)    )annotations)TYPE_CHECKING)
CollectionIterablec                      e Zd ZdZy)NarwhalsErrorz'Base class for all Narwhals exceptions.N__name__
__module____qualname____doc__     M/var/www/html/jupyter_env/lib/python3.12/site-packages/narwhals/exceptions.pyr   r   	   s    1r   r   c                       e Zd ZdZddZddZy)FormattedKeyErrora7  KeyError with formatted error message.

    Python's `KeyError` has special casing around formatting
    (see https://bugs.python.org/issue2651). Use this class when the error
    message has newlines and other special format characters.
    Needed by https://github.com/tensorflow/tensorflow/issues/36857.
    c                    || _         y Nmessage)selfr   s     r   __init__zFormattedKeyError.__init__   s	    r   c                    | j                   S r   r   )r   s    r   __str__zFormattedKeyError.__str__   s    ||r   Nr   strreturnNone)r   r   )r
   r   r   r   r   r   r   r   r   r   r      s    r   r   c                  \     e Zd ZdZd fdZe	 	 	 	 	 	 dd       Ze	 	 	 	 dd       Z xZS )ColumnNotFoundErrorz0Exception raised when column name isn't present.c                F    || _         t        | 	  | j                          y r   r   superr   r   r   	__class__s     r   r   zColumnNotFoundError.__init__        &r   c               N    dt        |       dt        |       d}t        |      S )Nz&The following columns were not found: z+

Hint: Did you mean one of these columns: ?)sortedlistr    )clsmissing_columnsavailable_columnsr   s       r   'from_missing_and_available_column_namesz;ColumnNotFoundError.from_missing_and_available_column_names$   s:    
 5VO5L4M;DAR<S;TTUW 	 #7++r   c                6    dt        |       d}t        |      S )NzOThe selected columns were not found.

Hint: Did you mean one of these columns: r(   )r*   r    )r+   r-   r   s      r   from_available_column_namesz/ColumnNotFoundError.from_available_column_names.   s.    
<<@AR<S;TTUW 	 #7++r   r   )r,   zIterable[str]r-   Collection[str]r   r    )r-   r1   r   r    )	r
   r   r   r   r   classmethodr.   r0   __classcell__r%   s   @r   r    r       s[    :' ,+,@O,	, , , /,	, ,r   r    c                      e Zd ZdZy)ComputeErrorzHException raised when the underlying computation could not be evaluated.Nr	   r   r   r   r6   r6   9   s    Rr   r6   c                      e Zd ZdZy)
ShapeErrorz_Exception raised when trying to perform operations on data structures with incompatible shapes.Nr	   r   r   r   r8   r8   =       ir   r8   c                      e Zd ZdZy)MultiOutputExpressionErrorzKException raised when using multi-output expression in unsupported context.Nr	   r   r   r   r;   r;   A   s    Ur   r;   c                      e Zd ZdZy)DuplicateErrorz6Exception when duplicate column names are encountered.Nr	   r   r   r   r=   r=   E   s    @r   r=   c                      e Zd ZdZy)InvalidOperationErrorz+Exception raised during invalid operations.Nr	   r   r   r   r?   r?   I   s    5r   r?   c                  6     e Zd ZdZd fdZedd       Z xZS )InvalidIntoExprErrorz>Exception raised when object can't be converted to expression.c                F    || _         t        | 	  | j                          y r   r"   r$   s     r   r   zInvalidIntoExprError.__init__P   r&   r   c                $    d| d}t        |      S )NzBExpected an object which can be converted into an expression, got a  

Hint:
- if you were trying to select a column which does not have a string
  column name, then you should explicitly use `nw.col`.
  For example, `df.select(nw.col(0))` if you have a column named `0`.
- if you were trying to create a new literal column, then you 
  should explicitly use `nw.lit`.
  For example, `df.select(nw.lit(0))` if you want to create a new
  column with literal value `0`.)rA   )r+   invalid_typer   s      r   from_invalid_typez&InvalidIntoExprError.from_invalid_typeT   s+     QQ]P^ _/ / 	 $G,,r   r   )r+   typerD   rF   r   rA   )r
   r   r   r   r   r2   rE   r3   r4   s   @r   rA   rA   M   s    H' - -r   rA   c                      e Zd ZdZy)UnsupportedDTypeErrorz_Exception raised when trying to convert to a DType which is not supported by the given backend.Nr	   r   r   r   rH   rH   d   r9   r   rH   c                      e Zd ZdZy)NarwhalsUnstableWarningzRWarning issued when a method or function is considered unstable in the stable api.Nr	   r   r   r   rJ   rJ   h   s    \r   rJ   c                      e Zd Zy)PerformanceWarningN)r
   r   r   r   r   r   rL   rL   l   s    r   rL   N)
__future__r   typingr   collections.abcr   r   
ValueErrorr   KeyErrorr   r    r6   r8   r;   r=   r?   	TypeErrorrA   rH   UserWarningrJ   WarningrL   r   r   r   <module>rU      s    "  42J 2  ,+] ,8S= Sj jV VA] A6M 6-9m -.jM j]k ] ' &r   