
    AHj                    |    d dl mZ d dlmZ d dlmZ d dlmZ d dlm	Z	 erd dl
mZ d dlmZ d dlmZ  G d	 d
      Zy)    )annotations)TYPE_CHECKING)unstable)	wrap_expr)parse_into_datatype_exprN)Expr)PolarsDataTypec                  \    e Zd ZdZdZddZ e       	 	 	 	 dd       Z e       d	d       Zy)
ExprExtensionNameSpacez1Namespace for extension type related expressions.extc                &    |j                   | _         y )N)_pyexpr)selfexprs     G/root/tools/cai/cai_env/lib/python3.12/site-packages/polars/expr/ext.py__init__zExprExtensionNameSpace.__init__   s    ||    c                t    t        |      j                  }t        | j                  j	                  |            S )a.  
        Convert to an extension `dtype`.

        The input must be of the storage type of the extension dtype.

        .. warning::
            This functionality is currently considered **unstable**. It may be
            changed at any point without it being considered a breaking change.
        )r   _pydatatype_exprr   r   ext_to)r   dtypepy_dtypes      r   tozExprExtensionNameSpace.to   s.     ,E2CC,,X677r   c                H    t        | j                  j                               S )aJ  
        Get the storage values of an extension data type.

        If the input does not have an extension data type, it is returned as-is.

        .. warning::
            This functionality is currently considered **unstable**. It may be
            changed at any point without it being considered a breaking change.
        )r   r   ext_storage)r   s    r   storagezExprExtensionNameSpace.storage*   s     11344r   N)r   r   returnNone)r   z PolarsDataType | pl.DataTypeExprr   r   )r   r   )	__name__
__module____qualname____doc__	_accessorr   r   r   r    r   r   r   r      sM    ;I$ Z8/8 
8 8  Z
5 
5r   r   )
__future__r   typingr   polars._utils.unstabler   polars._utils.wrapr   polars.datatypesr   polars._reexport	_reexportplpolarsr   polars._typingr	   r   r$   r   r   <module>r/      s,    "   + ( 5!
$5 $5r   