o
    5c'	                     @  sp   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	 ddl
ZddlmZ G dd de	ZG d	d
 d
eZdS )zX
Test extension array that has custom attribute information (not stored on the dtype).

    )annotationsN)type_t)ExtensionDtype)ExtensionArrayc                   @  s(   e Zd ZeZdZejZe	dddZ
dS )FloatAttrDtype
float_attrreturntype_t[FloatAttrArray]c                 C  s   t S )zq
        Return the array type associated with this dtype.

        Returns
        -------
        type
        )FloatAttrArray)cls r   b/var/www/html/gps/gps/lib/python3.10/site-packages/pandas/tests/extension/array_with_attr/array.pyconstruct_array_type   s   	z#FloatAttrDtype.construct_array_typeN)r   r	   )__name__
__module____qualname__floattypenamenpnanna_valueclassmethodr   r   r   r   r   r      s    r   c                   @  sh   e Zd Ze ZdZddddZeddd	Zd
d Z	dddZ
dd ZdddZdd Zedd ZdS )r
   i  Nr   Nonec                 C  s6   t |tjs
td|jdkstd|| _|| _d S )Nz5Need to pass a numpy array of float64 dtype as valuesfloat64)
isinstancer   ndarray	TypeErrordtypedataattr)selfvaluesr    r   r   r   __init__(   s   

zFloatAttrArray.__init__Fc                 C  s   t j|d|d}| |S )Nr   )r   copy)r   array)r   scalarsr   r$   r   r   r   r   _from_sequence0   s   zFloatAttrArray._from_sequencec                 C  s<   t |tjr| j| S tjj| |}t| | j| | j	S N)
r   numbersIntegralr   pdapiindexerscheck_array_indexerr   r    )r!   itemr   r   r   __getitem__5   s   
zFloatAttrArray.__getitem__intc                 C  s
   t | jS r(   )lenr   r!   r   r   r   __len__=   s   
zFloatAttrArray.__len__c                 C  s   t | jS r(   )r   isnanr   r3   r   r   r   isna@   s   zFloatAttrArray.isnac                 C  sF   ddl m} | j}|r|d u r| jj}|||||d}t| || jS )Nr   )take)
fill_value
allow_fill)pandas.api.extensionsr7   r   r   r   r   r    )r!   indexerr9   r8   r7   r   resultr   r   r   r7   C   s   zFloatAttrArray.takec                 C  s   t | | j | jS r(   )r   r   r$   r    r3   r   r   r   r$   M   s   zFloatAttrArray.copyc                 C  s4   t dd |D }t|r|d jnd }| ||S )Nc                 S  s   g | ]}|j qS r   )r   ).0xr   r   r   
<listcomp>R   s    z4FloatAttrArray._concat_same_type.<locals>.<listcomp>r   )r   concatenater2   r    )r   	to_concatr   r    r   r   r   _concat_same_typeP   s   
z FloatAttrArray._concat_same_typer(   )r   r   )NF)r   r1   )FN)r   r   r   r   r   __array_priority__r#   r   r'   r0   r4   r6   r7   r$   rB   r   r   r   r   r
   $   s    


r
   )__doc__
__future__r   r)   numpyr   pandas._typingr   pandas.core.dtypes.baser   pandasr+   pandas.core.arraysr   r   r
   r   r   r   r   <module>   s    