o
    5c                     @  s   d Z ddlmZ ddlZddlZddlZddlmZ ddl	Z
ddlmZ G dd dZG dd	 d	ZdddZG dd deZdS )zE
Utility functions and objects for implementing the interchange API.
    )annotationsN)DtypeObj)is_datetime64_dtypec                   @  sX   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S )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
    nbcCsSiIlLefgutdDtdmz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DATE32DATE64	TIMESTAMPTIME r,   r,   S/var/www/html/gps/gps/lib/python3.10/site-packages/pandas/core/interchange/utils.pyr      s(    r   c                   @  s    e Zd ZdZdZdZdZdZdS )
Endiannessz.Enum indicating the byte-order of a data-type.<>=|N)r   r   r   r   LITTLEBIGNATIVENAr,   r,   r,   r-   r.   3   s    r.   dtyper   returnstrc                 C  s   t | tjr	tjS | tdkrtjS tt| j	
 d}|dur"|S t| r@tdttj| jd dd }tjj|ddS t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`.
    ONz\[(.*)\]r       )
resolutiontzzConversion of z- to Arrow C format string is not implemented.)
isinstancepdCategoricalDtyper   r"   npr7   r'   getattrnameupperr   refindalltypingcastr9   r*   formatNotImplementedError)r7   
format_strr=   r,   r,   r-   dtype_to_arrow_c_fmt<   s   $
rM   c                   @  s   e Zd ZdZdS )NoBufferPresentz6Exception to signal that there is no requested buffer.N)r   r   r   r   r,   r,   r,   r-   rN   ^   s    rN   )r7   r   r8   r9   )r   
__future__r   rF   rH   numpyrB   pandas._typingr   pandasr@   pandas.api.typesr   r   r.   rM   	ExceptionrN   r,   r,   r,   r-   <module>   s    !
	"