o
    h                     @  s   d dl mZ G dd deZG dd deZG dd deeZG dd	 d	eZG d
d deZG dd deZ	G dd deZ
G dd deZG dd deeZG dd deZG dd deZG dd deZG dd deZG dd deZdS )    )annotationsc                   @     e Zd ZdZdS )NarwhalsErrorz'Base class for all Narwhals exceptions.N__name__
__module____qualname____doc__ r
   r
   G/var/www/vscode/kcb/lib/python3.10/site-packages/narwhals/exceptions.pyr          r   c                   @  s$   e Zd ZdZdddZddd	Zd
S )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.
    messagestrreturnNonec                 C  s
   || _ d S Nr   selfr   r
   r
   r   __init__   s   
zFormattedKeyError.__init__c                 C  s   | j S r   r   )r   r
   r
   r   __str__   s   zFormattedKeyError.__str__Nr   r   r   r   )r   r   )r   r   r   r	   r   r   r
   r
   r
   r   r      s    
r   c                      s0   e Zd ZdZd fddZedddZ  ZS )ColumnNotFoundErrorz0Exception raised when column name isn't present.r   r   r   r   c                      || _ t | j  d S r   r   superr   r   	__class__r
   r   r         zColumnNotFoundError.__init__clstypemissing_columns	list[str]available_columnsc                 C  s   d| d| d}t |S )Nz&The following columns were not found: z+

Hint: Did you mean one of these columns: ?)r   )r    r"   r$   r   r
   r
   r   'from_missing_and_available_column_names   s
   z;ColumnNotFoundError.from_missing_and_available_column_namesr   )r    r!   r"   r#   r$   r#   r   r   )r   r   r   r	   r   classmethodr&   __classcell__r
   r
   r   r   r      
    r   c                   @  r   )ComputeErrorzHException raised when the underlying computation could not be evaluated.Nr   r
   r
   r
   r   r*   *   r   r*   c                   @  r   )
ShapeErrorz_Exception raised when trying to perform operations on data structures with incompatible shapes.Nr   r
   r
   r
   r   r+   .   r   r+   c                   @  r   )MultiOutputExpressionErrorzKException raised when using multi-output expression in unsupported context.Nr   r
   r
   r
   r   r,   2   r   r,   c                   @  r   )DuplicateErrorz6Exception when duplicate column names are encountered.Nr   r
   r
   r
   r   r-   6   r   r-   c                   @  r   )InvalidOperationErrorz+Exception raised during invalid operations.Nr   r
   r
   r
   r   r.   :   r   r.   c                      0   e Zd ZdZd fddZedddZ  ZS )InvalidIntoExprErrorz>Exception raised when object can't be converted to expression.r   r   r   r   c                   r   r   r   r   r   r
   r   r   A   r   zInvalidIntoExprError.__init__r    r!   invalid_typec                 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`.)r0   )r    r1   r   r
   r
   r   from_invalid_typeE   s   
z&InvalidIntoExprError.from_invalid_typer   )r    r!   r1   r!   r   r0   )r   r   r   r	   r   r'   r3   r(   r
   r
   r   r   r0   >   r)   r0   c                      r/   )AnonymousExprErrorzLException raised when trying to perform operations on anonymous expressions.r   r   r   r   c                   r   r   r   r   r   r
   r   r   X   r   zAnonymousExprError.__init__r    r!   	expr_namec                 C  r2   )Nz,Anonymous expressions are not supported in `zR`.
Instead of `nw.all()`, try using a named expression, such as `nw.col('a', 'b')`)r4   )r    r5   r   r
   r
   r   from_expr_name\   s   
z!AnonymousExprError.from_expr_namer   )r    r!   r5   r   r   r4   )r   r   r   r	   r   r'   r6   r(   r
   r
   r   r   r4   U   r)   r4   c                      "   e Zd ZdZd fddZ  ZS )	OrderDependentExprErrorzSException raised when trying to use an order-dependent expressions with LazyFrames.r   r   r   r   c                   r   r   r   r   r   r
   r   r   i   r   z OrderDependentExprError.__init__r   r   r   r   r	   r   r(   r
   r
   r   r   r8   f       r8   c                      r7   )	LengthChangingExprErrorzWException raised when trying to use an expression which changes length with LazyFrames.r   r   r   r   c                   r   r   r   r   r   r
   r   r   q   r   z LengthChangingExprError.__init__r   r9   r
   r
   r   r   r;   n   r:   r;   c                   @  r   )UnsupportedDTypeErrorz_Exception raised when trying to convert to a DType which is not supported by the given backend.Nr   r
   r
   r
   r   r<   v   r   r<   c                   @  r   )NarwhalsUnstableWarningzRWarning issued when a method or function is considered unstable in the stable api.Nr   r
   r
   r
   r   r=   z   r   r=   N)
__future__r   
ValueErrorr   KeyErrorr   r   r*   r+   r,   r-   r.   	TypeErrorr0   r4   r8   r;   r<   UserWarningr=   r
   r
   r
   r   <module>   s    