
    Ega	                        d Z ddlmZ ddlZddlmZ ddlZddlm	Z	 ddl
ZddlmZ erddlmZ  G d d	e	          Z G d
 de          ZdS )zX
Test extension array that has custom attribute information (not stored on the dtype).

    )annotationsN)TYPE_CHECKING)ExtensionDtype)ExtensionArray)type_tc                  <    e Zd ZeZdZej        Ze	dd            Z
dS )FloatAttrDtype
float_attrreturntype_t[FloatAttrArray]c                    t           S )zq
        Return the array type associated with this dtype.

        Returns
        -------
        type
        )FloatAttrArray)clss    a/var/www/sysmax/venv/lib/python3.11/site-packages/pandas/tests/extension/array_with_attr/array.pyconstruct_array_typez#FloatAttrDtype.construct_array_type   s
         N)r   r   )__name__
__module____qualname__floattypenamenpnanna_valueclassmethodr    r   r   r	   r	      sC        DDvH   [  r   r	   c                      e Zd Z e            ZdZdddZedddd            Zd	 Z	ddZ
d ZddZd Zed             ZdS )r   i  Nr   Nonec                    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'   s      r   __init__zFloatAttrArray.__init__*   sT    &"*-- 	USTTT|y((STTT				r   Fr%   copyc               F    t          j        |d|          } | |          S )Nr!   r+   )r   array)r   scalarsr%   r,   r&   s        r   _from_sequencezFloatAttrArray._from_sequence2   s&    xyt<<<s4yyr   c                    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(   items     r   __getitem__zFloatAttrArray.__getitem__7   s^    dG,-- 	:9T?" 6?66tTBBD4::dioty999r   intc                *    t          | j                  S r2   )lenr&   r(   s    r   __len__zFloatAttrArray.__len__?   s    49~~r   c                4    t          j        | j                  S r2   )r   isnanr&   r>   s    r   isnazFloatAttrArray.isnaB   s    x	"""r   c                    ddl m} | j        }|r|| j        j        } |||||          } t          |           || j                  S )Nr   )take)
fill_value
allow_fill)pandas.api.extensionsrD   r&   r%   r   r   r'   )r(   indexerrF   rE   rD   r&   results          r   rD   zFloatAttrArray.takeE   sd    ......y 	-*,,JdG
zRRRtDzz&$),,,r   c                l     t          |           | j                                        | j                  S r2   )r   r&   r,   r'   r>   s    r   r,   zFloatAttrArray.copyO   s(    tDzz$)..**DI666r   c                    t          j        d |D                       }t          |          r|d         j        nd } | ||          S )Nc                    g | ]	}|j         
S r   )r&   ).0xs     r   
<listcomp>z4FloatAttrArray._concat_same_type.<locals>.<listcomp>T   s    999!qv999r   r   )r   concatenater=   r'   )r   	to_concatr&   r'   s       r   _concat_same_typez FloatAttrArray._concat_same_typeR   sL    ~99y999::$'	NN<y|  s4r   r2   )r   r   )r   r;   )FN)r   r   r   r	   r%   __array_priority__r*   r   r0   r:   r?   rB   rD   r,   rR   r   r   r   r   r   &   s        NE     .2     [: : :   # # #- - - -7 7 7   [  r   r   )__doc__
__future__r   r3   typingr   numpyr   pandas.core.dtypes.baser   pandasr5   pandas.core.arraysr   pandas._typingr   r	   r   r   r   r   <module>r\      s     # " " " " "                  2 2 2 2 2 2     - - - - - - &%%%%%%    ^   "0 0 0 0 0^ 0 0 0 0 0r   