Ë
    ¤ehå  ã                  ó2  — d Z ddlmZ ddlZddlZddlmZ ddlm	Z	m
Z
mZ ddlZej                  rddlmZ i dd“d	d
“dd“dd“dd“dd“dd“dd“dd“dd“dd“dd“dd“d d!“d"d#“d$d%“d&d'“d(d)d*d+d,d-d.d/d0d1d2d3d4d5œ¥Z G d6„ d7«      Z G d8„ d9«      Zd<d:„Zd=d;„Zy)>zE
Utility functions and objects for implementing the interchange API.
é    )ÚannotationsN)Úlib)Ú
ArrowDtypeÚCategoricalDtypeÚDatetimeTZDtype)ÚDtypeObjÚnullÚnÚboolÚbÚuint8ÚCÚuint16ÚSÚuint32ÚIÚuint64ÚLÚint8ÚcÚint16Úint32ÚiÚint64ÚlÚ	halffloatÚeÚfloatÚfÚdoubleÚgÚstringÚuÚlarge_stringÚUÚbinaryÚzz	time32[s]ÚttsÚttmÚttuÚttnÚtdDÚtdmztss:ztsm:ztsu:ztsn:ÚtDsÚtDmÚtDuÚtDn)z
time32[ms]z
time64[us]z
time64[ns]zdate32[day]z
date64[ms]ztimestamp[s]ztimestamp[ms]ztimestamp[us]ztimestamp[ns]zduration[s]zduration[ms]zduration[us]zduration[ns]c                  ó\   — e Zd ZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZdZdZdZdZdZdZdZdZdZy)ÚArrowCTypesz¹
    Enum for Apache Arrow C type format strings.

    The Arrow C data interface:
    https://arrow.apache.org/docs/format/CDataInterface.html#data-type-description-format-strings
    r
   r   r   r   Úsr   r   r   r   r   r   r   r!   r#   r%   r,   r-   zts{resolution}:{tz}ztt{resolution}N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__ÚNULLÚBOOLÚINT8ÚUINT8ÚINT16ÚUINT16ÚINT32ÚUINT32ÚINT64ÚUINT64ÚFLOAT16ÚFLOAT32ÚFLOAT64ÚSTRINGÚLARGE_STRINGÚDATE32ÚDATE64Ú	TIMESTAMPÚTIME© ó    ú[/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/pandas/core/interchange/utils.pyr3   r3   =   sj   „ ñð €DØ€DØ€DØ€EØ€EØ€FØ€EØ€FØ€EØ€FØ€GØ€GØ€GØ€FØ€LØ€FØ€Fð &€IØ�DrM   r3   c                  ó    — e Zd ZdZdZdZdZdZy)Ú
Endiannessz.Enum indicating the byte-order of a data-type.ú<ú>ú=ú|N)r5   r6   r7   r8   ÚLITTLEÚBIGÚNATIVEÚNArL   rM   rN   rP   rP   _   s   „ Ù8à€FØ
€CØ€FØ	�BrM   rP   c                ó  — t        | t        «      rt        j                  S | t	        j
                  d«      k(  rt        j                  S t        | t        «      r°ddl}| j                  }|j                  j                  |«      rd|j                  › d|j                  › �S |j                  j                  |«      r+|j                  �d|j                   d   › d|j                  › �S t"        j%                  t'        |«      d«      }|�|S t)        t        | j*                  j-                  «       d«      }|�|S t/        j0                  | d«      r<t	        j2                  | «      d   d   }t        j4                  j7                  |d	¬
«      S t        | t8        «      r8t        j4                  j7                  | j                   d   | j                  ¬
«      S t        | t:        j<                  «      rt        j>                  S tA        d| › d�«      ‚)a   
    Represent pandas `dtype` as a format string in Apache Arrow C notation.

    Parameters
    ----------
    dtype : np.dtype
        Datatype of pandas DataFrame to represent.

    Returns
    -------
    str
        Format string in Apache Arrow C notation of the given `dtype`.
    ÚOr   Nzd:ú,Útsú:ÚMÚ )Ú
resolutionÚtzzConversion of z- to Arrow C format string is not implemented.)!Ú
isinstancer   r3   rA   ÚnpÚdtyperF   r   ÚpyarrowÚpyarrow_dtypeÚtypesÚ
is_decimalÚ	precisionÚscaleÚis_timestampra   ÚunitÚPYARROW_CTYPESÚgetÚstrÚgetattrÚnameÚupperr   Úis_np_dtypeÚdatetime_datarJ   Úformatr   ÚpdÚBooleanDtyper:   ÚNotImplementedError)rd   ÚpaÚpa_typeÚ
format_strr`   s        rN   Údtype_to_arrow_c_fmtr|   h   s¯  € ô �%Ô)Ô*Ü× Ñ Ð Ø	”"—(‘(˜3“-Ò	Ü×!Ñ!Ð!Ü	�Eœ:Ô	&Ûà×%Ñ%ˆØ�8‰8×Ñ˜wÔ'Ø˜×)Ñ)Ð*¨!¨G¯M©M¨?Ð;Ð;Ø�X‰X×"Ñ" 7Ô+°·
±
Ð0FØ˜Ÿ™ Q™Ð(¨¨'¯*©*¨Ð6Ð6Ü#×'Ñ'¬¨G«°dÓ;ˆ
ØÐ!ØÐäœ e§j¡j×&6Ñ&6Ó&8¸$Ó?€JØÐØÐä
‡��u˜cÔ"ô ×%Ñ% eÓ,¨QÑ/°Ñ2ˆ
Ü×$Ñ$×+Ñ+°zÀbÐ+ÓIÐIä	�Eœ?Ô	+Ü×$Ñ$×+Ñ+°u·z±zÀ!±}ÈÏÉÐ+ÓRÐRä	�Eœ2Ÿ?™?Ô	+Ü×ÑÐä
Ø
˜˜ÐLÐMóð rM   c               óR  — t        | j                  t        j                  «      sy| j                  j
                  }t        |j                  «      dk(  ry|st        d«      ‚|j                  «       }t        j                  || j                  | j                  | j                  ¬«      S )aË  
    Rechunk a multi-chunk pyarrow array into a single-chunk array, if necessary.

    - Returns `None` if the input series is not backed by a multi-chunk pyarrow array
      (and so doesn't need rechunking)
    - Returns a single-chunk-backed-Series if the input is backed by a multi-chunk
      pyarrow array and `allow_copy` is `True`.
    - Raises a `RuntimeError` if `allow_copy` is `False` and input is a
      based by a multi-chunk pyarrow array.
    Né   zŒFound multi-chunk pyarrow array, but `allow_copy` is False. Please rechunk the array before calling this function, or set `allow_copy=True`.)rd   rq   Úindex)rb   rd   rv   r   ÚarrayÚ	_pa_arrayÚlenÚchunksÚRuntimeErrorÚcombine_chunksÚSeriesrq   r   )ÚseriesÚ
allow_copyÚchunked_arrayÚarrs       rN   Úmaybe_rechunkr‹   ›   s„   € ô �f—l‘l¤B§M¡MÔ2ØØ—L‘L×*Ñ*€MÜ
ˆ=×ÑÓ  AÒ%ØÙÜð!ó
ð 	
ð
 ×
&Ñ
&Ó
(€CÜ�9‰9�S §¡°6·;±;ÀfÇlÁlÔSÐSrM   )rd   r   Úreturnro   )r‡   z	pd.Seriesrˆ   r   rŒ   zpd.Series | None)r8   Ú
__future__r   ÚtypingÚnumpyrc   Úpandas._libsr   Úpandas.core.dtypes.dtypesr   r   r   Úpandasrv   ÚTYPE_CHECKINGÚpandas._typingr   rm   r3   rP   r|   r‹   rL   rM   rN   ú<module>r•      sR  ðñõ #ã ã å ÷ñ ó à	×ÒÝ'ð
Ø
ˆCðà
ˆCðð ˆSðð ˆcð	ð
 ˆcðð ˆcðð ˆCðð ˆSðð ˆSðð ˆSðð �ðð ˆSðð ˆcðð ˆcðð �Cðð  ˆcð!ð" �ð#ð$ ØØØØØØØØØØØØò=€÷Dñ ÷Dñ ó0ôfTrM   