
    hhx                       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dS )    )annotations)TYPE_CHECKING)
CollectionIterablec                      e Zd ZdZdS )NarwhalsErrorz'Base class for all Narwhals exceptions.N__name__
__module____qualname____doc__     J/var/www/histauto/venv/lib/python3.11/site-packages/narwhals/exceptions.pyr   r   	   s        1111r   r   c                  "    e Zd ZdZd	dZ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                    || _         d S 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   r   r   )r   r   )r
   r   r   r   r   r   r   r   r   r   r      sF                 r   r   c                  T     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.r   r   r   r   c                b    || _         t                                          | j                    d S r   r   superr   r   r   	__class__s     r   r   zColumnNotFoundError.__init__    *    &&&&&r   missing_columnsIterable[str]available_columnsCollection[str]c               f    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    )clsr'   r)   r   s       r   'from_missing_and_available_column_namesz;ColumnNotFoundError.from_missing_and_available_column_names$   sQ    
WVO5L5L W W<@AR<S<SW W W 	 #7+++r   c                F    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;    
W<@AR<S<SW W W 	 #7+++r   r   )r'   r(   r)   r*   r   r    )r)   r*   r   r    )	r
   r   r   r   r   classmethodr0   r2   __classcell__r%   s   @r   r    r       s        ::' ' ' ' ' ' , , , [, , , , [, , , , ,r   r    c                      e Zd ZdZdS )ComputeErrorzHException raised when the underlying computation could not be evaluated.Nr	   r   r   r   r7   r7   9   s        RRRRr   r7   c                      e Zd ZdZdS )
ShapeErrorz_Exception raised when trying to perform operations on data structures with incompatible shapes.Nr	   r   r   r   r9   r9   =           iiiir   r9   c                      e Zd ZdZdS )MultiOutputExpressionErrorzKException raised when using multi-output expression in unsupported context.Nr	   r   r   r   r<   r<   A   s        UUUUr   r<   c                      e Zd ZdZdS )DuplicateErrorz6Exception when duplicate column names are encountered.Nr	   r   r   r   r>   r>   E   s        @@@@r   r>   c                      e Zd ZdZdS )InvalidOperationErrorz+Exception raised during invalid operations.Nr	   r   r   r   r@   r@   I   s        5555r   r@   c                  <     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.r   r   r   r   c                b    || _         t                                          | j                    d S r   r"   r$   s     r   r   zInvalidIntoExprError.__init__P   r&   r   r/   typeinvalid_typec                ,    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/   rE   r   s      r   from_invalid_typez&InvalidIntoExprError.from_invalid_typeT   s.    /Q] / / / 	 $G,,,r   r   )r/   rD   rE   rD   r   rB   )r
   r   r   r   r   r3   rG   r4   r5   s   @r   rB   rB   M   sc        HH' ' ' ' ' ' - - - [- - - - -r   rB   c                      e Zd ZdZdS )UnsupportedDTypeErrorz_Exception raised when trying to convert to a DType which is not supported by the given backend.Nr	   r   r   r   rI   rI   d   r:   r   rI   c                      e Zd ZdZdS )NarwhalsUnstableWarningzRWarning issued when a method or function is considered unstable in the stable api.Nr	   r   r   r   rK   rK   h   s        \\\\r   rK   c                      e Zd ZdS )PerformanceWarningN)r
   r   r   r   r   r   rM   rM   l   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      sn   " " " " " "             5444444442 2 2 2 2J 2 2 2        , , , , ,+] , , ,8S S S S S= S S Sj j j j j j j jV V V V V V V VA A A A A] A A A6 6 6 6 6M 6 6 6- - - - -9m - - -.j j j j jM j j j] ] ] ] ]k ] ] ] ' & & & & & & & & &r   