
    'h#                    :   % S SK Jr  S SKJr  S SKJrJrJrJrJ	r	J
r
  S SKJr  \(       a5  S SKrS SKJrJr  S SKJr  S SKJr  \R*                  S	:  a  S S
KJr  OS S
KJr   " S S\5      r " S S\5      r\\\\\4   rS\S'    " S S\5      r " S S\
5      r  " S S\
5      r! " S S\	5      r" " S S\	5      r# " S S\	5      r$ " S S\	5      r% " S S 5      r& " S! S"\'5      r( " S# S$5      r)\)RU                  S 5      \)l+        \)RU                  S%5      \)l,        g)&    )annotations)IntEnum)TYPE_CHECKINGAnyClassVarLiteralProtocol	TypedDict)issue_unstable_warningN)IterableSequence)PolarsBuffer)PolarsColumn)   
   )	TypeAliasc                  8    \ rS rSrSrSrSrSrSrSr	Sr
S	rS
rSrg)DlpackDeviceType   z3Integer enum for device type codes matching DLPack.      r            	   r    N)__name__
__module____qualname____firstlineno____doc__CPUCUDA
CPU_PINNEDOPENCLVULKANMETALVPIROCM__static_attributes__r       nC:\Users\julio\OneDrive\Documentos\Trabajo\Ideas Frescas\venv\Lib\site-packages\polars/interchange/protocol.pyr   r      s-    =
CDJFFE
CDr+   r   c                  4    \ rS rSrSrSrSrSrSrSr	Sr
S	rS
rg)	DtypeKind)   a  
Integer enum for data types.

Attributes
----------
INT : int
    Matches to signed integer data type.
UINT : int
    Matches to unsigned integer data type.
FLOAT : int
    Matches to floating point data type.
BOOL : int
    Matches to boolean data type.
STRING : int
    Matches to string data type (UTF-8 encoded).
DATETIME : int
    Matches to datetime data type.
CATEGORICAL : int
    Matches to categorical data type.
r   r   r               r   N)r   r   r   r    r!   INTUINTFLOATBOOLSTRINGDATETIMECATEGORICALr*   r   r+   r,   r.   r.   )   s,    * CDEDFHKr+   r.   r   Dtypec                  ,    \ rS rSrSrSrSrSrSrSr	Sr
g	)
ColumnNullTypeK   a  
Integer enum for null type representation.

Attributes
----------
NON_NULLABLE : int
    Non-nullable column.
USE_NAN : int
    Use explicit float NaN value.
USE_SENTINEL : int
    Sentinel value besides NaN.
USE_BITMASK : int
    The bit is set/unset representing a null on a certain position.
USE_BYTEMASK : int
    The byte is set/unset representing a null on a certain position.
r   r   r   r   r   r   N)r   r   r   r    r!   NON_NULLABLEUSE_NANUSE_SENTINELUSE_BITMASKUSE_BYTEMASKr*   r   r+   r,   r=   r=   K   s"    " LGLKLr+   r=   c                  8    \ rS rSr% SrS\S'   S\S'   S\S'   Srg	)
ColumnBuffersd   zBuffers backing a column.ztuple[PolarsBuffer, Dtype]dataz!tuple[PolarsBuffer, Dtype] | Nonevalidityoffsetsr   Nr   r   r   r    r!   __annotations__r*   r   r+   r,   rE   rE   d   s    # %$
 0/ /.r+   rE   c                  8    \ rS rSr% SrS\S'   S\S'   S\S'   S	rg
)CategoricalDescriptionw   z$Description of a categorical column.bool
is_orderedzLiteral[True]is_dictionaryr   
categoriesr   NrJ   r   r+   r,   rM   rM   w   s    .    r+   rM   c                  T    \ rS rSrSr\S	S j5       r\S	S j5       rS
S jrSS jr	Sr
g)Buffer   zInterchange buffer object.c                    g)zBuffer size in bytes.Nr   selfs    r,   bufsizeBuffer.bufsize       r+   c                    g)z-Pointer to start of the buffer as an integer.Nr   rW   s    r,   ptr
Buffer.ptr   r[   r+   c                    g)z-Represent this structure as DLPack interface.Nr   rW   s    r,   
__dlpack__Buffer.__dlpack__   r[   r+   c                    g)zCDevice type and device ID for where the data in the buffer resides.Nr   rW   s    r,   __dlpack_device__Buffer.__dlpack_device__   r[   r+   r   Nreturnint)rf   r   )rf   z#tuple[DlpackDeviceType, int | None])r   r   r   r    r!   propertyrY   r]   r`   rc   r*   r   r+   r,   rT   rT      s6    $$ $ < <<Rr+   rT   c                      \ rS rSrSrSS jr\SS j5       r\SS j5       r\SS j5       r	\SS j5       r
\SS j5       r\SS	 j5       rSS
 jrSSS jjrSS jrSrg)Column   zInterchange column object.c                    g)zSize of the column in elements.Nr   rW   s    r,   sizeColumn.size   r[   r+   c                    g)zOOffset of the first element with respect to the start of the underlying buffer.Nr   rW   s    r,   offsetColumn.offset   r[   r+   c                    g)zData type of the column.Nr   rW   s    r,   dtypeColumn.dtype   r[   r+   c                    g)z7Description of the categorical data type of the column.Nr   rW   s    r,   describe_categoricalColumn.describe_categorical   r[   r+   c                    g)z7Description of the null representation the column uses.Nr   rW   s    r,   describe_nullColumn.describe_null   r[   r+   c                    g)z"Number of null elements, if known.Nr   rW   s    r,   
null_countColumn.null_count   r[   r+   c                    g)zThe metadata for the column.Nr   rW   s    r,   metadataColumn.metadata   r[   r+   c                    g)z3Return the number of chunks the column consists of.Nr   rW   s    r,   
num_chunksColumn.num_chunks   r[   r+   Nc                    g)z.Return an iterator yielding the column chunks.Nr   rX   n_chunkss     r,   
get_chunksColumn.get_chunks   r[   r+   c                    g)z6Return a dictionary containing the underlying buffers.Nr   rW   s    r,   get_buffersColumn.get_buffers   r[   r+   r   re   )rf   r;   )rf   rM   )rf   ztuple[ColumnNullType, Any]rf   
int | Nonerf   zdict[str, Any]N)r   r   rf   Iterable[Column])rf   rE   )r   r   r   r    r!   rm   rh   rp   rs   rv   ry   r|   r   r   r   r   r*   r   r+   r,   rj   rj      s    $. ^ ^ ' ' F F F F 1 1 + +B=Er+   rj   c                      \ rS rSr% SrS\S'     S     SS jjr\SS j5       rSS jr	SS jr
SS	 jrSS
 jrSS jrSS jrSS jrSS jrSS jrSSS jjrSrg) 	DataFrame   zInterchange dataframe object.zClassVar[int]versionc                    gzNConvert to a dataframe object implementing the dataframe interchange protocol.Nr   rX   nan_as_null
allow_copys      r,   __dataframe__DataFrame.__dataframe__   r[   r+   c                    g)zThe metadata for the dataframe.Nr   rW   s    r,   r   DataFrame.metadata   r[   r+   c                    g)z.Return the number of columns in the dataframe.Nr   rW   s    r,   num_columnsDataFrame.num_columns   r[   r+   c                    g)z9Return the number of rows in the dataframe, if available.Nr   rW   s    r,   num_rowsDataFrame.num_rows   r[   r+   c                    g)z7Return the number of chunks the dataframe consists of..Nr   rW   s    r,   r   DataFrame.num_chunks   r[   r+   c                    g)zReturn the column names.Nr   rW   s    r,   column_namesDataFrame.column_names   r[   r+   c                    g)z,Return the column at the indicated position.Nr   )rX   is     r,   
get_columnDataFrame.get_column   r[   r+   c                    g)z&Return the column with the given name.Nr   )rX   names     r,   get_column_by_nameDataFrame.get_column_by_name   r[   r+   c                    g)z(Return an iterator yielding the columns.Nr   rW   s    r,   get_columnsDataFrame.get_columns   r[   r+   c                    g)zACreate a new dataframe by selecting a subset of columns by index.Nr   )rX   indicess     r,   select_columnsDataFrame.select_columns   r[   r+   c                    g)z@Create a new dataframe by selecting a subset of columns by name.Nr   )rX   namess     r,   select_columns_by_name DataFrame.select_columns_by_name   r[   r+   Nc                    g)z8Return an iterator yielding the chunks of the dataframe.Nr   r   s     r,   r   DataFrame.get_chunks   r[   r+   r   FT)r   rO   r   rO   rf   r   r   re   r   )rf   zIterable[str])r   rg   rf   rj   )r   strrf   rj   )rf   r   )r   zSequence[int]rf   r   )r   zSequence[str]rf   r   r   )r   r   rf   zIterable[DataFrame])r   r   r   r    r!   rK   r   rh   r   r   r   r   r   r   r   r   r   r   r   r*   r   r+   r,   r   r      s    ' "]] ] 
	] . .=HF';57POG Gr+   r   c                  4    \ rS rSrSr  S     SS jjrSrg)SupportsInterchange   zHDataframe that supports conversion into an interchange dataframe object.c                    gr   r   r   s      r,   r   !SupportsInterchange.__dataframe__   r[   r+   r   Nr   )r   rO   r   rO   rf   r   )r   r   r   r    r!   r   r*   r   r+   r,   r   r      s8    R "]] ] 
	] ]r+   r   c                  (    \ rS rSrSrSrSrSrSrSr	g)	
Endianness   z.Enum indicating the byte-order of a data type.<>=|r   N)
r   r   r   r    r!   LITTLEBIGNATIVENAr*   r   r+   r,   r   r      s    8F
CF	Br+   r   c                      \ rS rSrSrSrg)CopyNotAllowedError   zMException raised when a copy is required, but `allow_copy` is set to `False`.r   N)r   r   r   r    r!   r*   r   r+   r,   r   r      s    Wr+   r   c                      \ rS rSr% SrS\S'   SS jr\SS j5       r\SS j5       r	\SS j5       r
\SS	 j5       rSS
 jrSrg)CompatLeveli  z#Data structure compatibility level.rg   _versionc                    Sn[        U5      e)Nz0it is not allowed to create a CompatLevel object)	TypeError)rX   msgs     r,   __init__CompatLevel.__init__	  s    @nr+   c                D    [         R                  [         5      nXl        U$ r   )r   __new__r   )r   compat_levels     r,   _with_versionCompatLevel._with_version  s    "**;7 'r+   c                 "    [         R                  $ r   )r   _future1r   r+   r,   _newestCompatLevel._newest  s    ###r+   c                 @    [        S5        [        R                  5       $ )z
Get the highest supported compatibility level.

.. warning::
    Highest compatibility level is considered **unstable**. It may be changed
    at any point without it being considered a breaking change.
z=using the highest compatibility level is considered unstable.)r   r   r   r   r+   r,   newestCompatLevel.newest  s      	K	
 ""$$r+   c                 "    [         R                  $ )zGet the most compatible level.)r   _compatibler   r+   r,   oldestCompatLevel.oldest%  s     &&&r+   c                ~    SU R                   R                   SU R                   R                   SU R                   S3$ )Nr   .z: r   )	__class__r   r   r   rW   s    r,   __repr__CompatLevel.__repr__*  s8    4>>,,-Qt~~/J/J.K2dmm_\]^^r+   r   N)rf   None)r   rg   rf   r   )rf   r   )rf   r   )r   r   r   r    r!   rK   r   staticmethodr   r   r   r   r   r*   r   r+   r,   r   r     se    -M  
 $ $ % % ' '_r+   r   r   )-
__future__r   enumr   typingr   r   r   r   r	   r
   polars._utils.unstabler   syscollections.abcr   r   polars.interchange.bufferr   polars.interchange.columnr   version_infor   typing_extensionsr   r.   tuplerg   r   r;   rK   r=   rE   rM   rT   rj   r   r   r   RuntimeErrorr   r   r   r   r   r   r+   r,   <module>r      s   "   :266
7"$/
w 
 > Cc12y 2W 2/I /&	Y 	RX R$%EX %EP,G ,G^]( ] X, X'_ '_T &33A6 "003 r+   