
    g	                        d dl m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
      Zy)    )annotationsc                       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     H/var/www/openai/venv/lib/python3.12/site-packages/narwhals/exceptions.py__init__zFormattedKeyError.__init__   s	        c                    | j                   S r   r   )r
   s    r   __str__zFormattedKeyError.__str__   s    ||r   Nr	   strreturnNone)r   r   )__name__
__module____qualname____doc__r   r    r   r   r   r      s    r   r   c                  B     e Zd ZdZd f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                *    d| d| d}t        |      S )Nz&The following columns were not found: z+

Hint: Did you mean one of these columns: ?)r   )clsmissing_columnsavailable_columnsr	   s       r   'from_missing_and_available_column_namesz;ColumnNotFoundError.from_missing_and_available_column_names   s/    
 5_4E;<M;NaQ 	 #7++r   r   )r$   	list[str]r%   r'   r   r   )r   r   r   r   r   classmethodr&   __classcell__r   s   @r   r   r      s7    :' ,',<E,	, ,r   r   c                      e Zd ZdZy)
ShapeErrorz_Exception raised when trying to perform operations on data structures with incompatible shapes.Nr   r   r   r   r   r   r   r,   r,   &   s    ir   r,   c                      e Zd ZdZy)InvalidOperationErrorz+Exception raised during invalid operations.Nr-   r   r   r   r/   r/   *   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__1   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`.)r1   )r#   invalid_typer	   s      r   from_invalid_typez&InvalidIntoExprError.from_invalid_type5   s+     QQ]P^ _/ / 	 $G,,r   r   )r4   typer   r1   )r   r   r   r   r   r(   r5   r)   r*   s   @r   r1   r1   .   s    H' - -r   r1   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   r8   r8   E   s    \r   r8   N)
__future__r   KeyErrorr   r   	Exceptionr,   r/   	TypeErrorr1   UserWarningr8   r   r   r   <module>r>      sU    "  ,+ ,$j j6I 6-9 -.]k ]r   