
    .i                    <   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__     P/opt/house_gps_flutter/.venv/lib/python3.12/site-packages/narwhals/exceptions.pyr   r   	   s    1r   r   c                  ,    e Zd ZU dZded<   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.
    strmessagec                    || _         y Nr   )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   r   returnNone)r   r   )r
   r   r   r   __annotations__r   r   r   r   r   r   r      s     Lr   r   c                  h     e Zd ZU dZded<   d fdZe	 	 	 	 	 	 dd       Ze	 	 	 	 d	d       Z xZ	S )
ColumnNotFoundErrorz0Exception raised when column name isn't present.r   r   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_names2   s.    
<<@AR<S;TTUW 	 #7++r   r   )r-   zIterable[str]r.   Collection[str]r   r!   )r.   r2   r   r!   )
r
   r   r   r   r   r   classmethodr/   r1   __classcell__r&   s   @r   r!   r!      s`    :L' ,+,@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   r7   r7   =   s    Rr   r7   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   r9   r9   A       ir   r9   c                      e Zd ZdZy)MultiOutputExpressionErrorzKException raised when using multi-output expression in unsupported context.Nr	   r   r   r   r<   r<   E   s    Ur   r<   c                      e Zd ZdZy)DuplicateErrorz6Exception when duplicate column names are encountered.Nr	   r   r   r   r>   r>   I   s    @r   r>   c                      e Zd ZdZy)InvalidOperationErrorz+Exception raised during invalid operations.Nr	   r   r   r   r@   r@   M   s    5r   r@   c                  B     e Zd ZU dZded<   d fdZedd       Z xZS )InvalidIntoExprErrorz>Exception raised when object can't be converted to expression.r   r   c                F    || _         t        | 	  | j                          y r   r#   r%   s     r   r   zInvalidIntoExprError.__init__V   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`.)rB   )r,   invalid_typer   s      r   from_invalid_typez&InvalidIntoExprError.from_invalid_typeZ   s+     QQ]P^ _/ / 	 $G,,r   r   )r,   typerE   rG   r   rB   )	r
   r   r   r   r   r   r3   rF   r4   r5   s   @r   rB   rB   Q   s$    HL' - -r   rB   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   rI   rI   j   r:   r   rI   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   rK   rK   n   s    \r   rK   c                      e Zd Zy)PerformanceWarningN)r
   r   r   r   r   r   rM   rM   r   s    r   rM   N)
__future__r   typingr   collections.abcr   r   
ValueErrorr   KeyErrorr   r!   r7   r9   r<   r>   r@   	TypeErrorrB   rI   UserWarningrK   WarningrM   r   r   r   <module>rV      s    "  42J 2 $,+] ,<S= Sj jV VA] A6M 6-9m -2jM j]k ] ' &r   