
    Owg	                        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y)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
y)FloatAttrDtype
float_attrc                    t         S )zq
        Return the array type associated with this dtype.

        Returns
        -------
        type
        )FloatAttrArray)clss    c/var/www/horilla/myenv/lib/python3.12/site-packages/pandas/tests/extension/array_with_attr/array.pyconstruct_array_typez#FloatAttrDtype.construct_array_type   s
         N)returnztype_t[FloatAttrArray])__name__
__module____qualname__floattypenamenpnanna_valueclassmethodr    r   r   r	   r	      s'    DDvvH r   r	   c                  r    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y)r   i  Nc                    t        |t        j                        st        d      |j                  dk(  st        d      || _        || _        y )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__*   sB    &"**-STT||y(STT		r   Fr#   copyc               v    |st        j                  |d      }nt        j                  |d|      } | |      S )Nr   )r#   r)   )r   asarrayarray)r   scalarsr#   r*   r$   s        r   _from_sequencezFloatAttrArray._from_sequence2   s1    ::gY7D88G94@D4yr   c                    t        |t        j                        r| j                  |   S t        j
                  j                  j                  | |      } t        |       | j                  |   | j                        S N)
r    numbersIntegralr$   pdapiindexerscheck_array_indexerr   r%   )r&   items     r   __getitem__zFloatAttrArray.__getitem__:   s[    dG,,-99T?" 66??66tTBD4:diiotyy99r   c                ,    t        | j                        S r1   )lenr$   r&   s    r   __len__zFloatAttrArray.__len__B   s    499~r   c                @    t        j                  | j                        S r1   )r   isnanr$   r<   s    r   isnazFloatAttrArray.isnaE   s    xx		""r   c                    ddl m} | j                  }|r|| j                  j                  } |||||      } t        |       || j                        S )Nr   )take)
fill_value
allow_fill)pandas.api.extensionsrB   r$   r#   r   r   r%   )r&   indexerrD   rC   rB   r$   results          r   rB   zFloatAttrArray.takeH   sL    .yy*,,,JdG
zRtDz&$)),,r   c                j     t        |       | j                  j                         | j                        S r1   )r   r$   r*   r%   r<   s    r   r*   zFloatAttrArray.copyR   s$    tDz$))..*DII66r   c                    t        j                  |D cg c]  }|j                   c}      }t        |      r|d   j                  nd } | ||      S c c}w )Nr   )r   concatenater$   r;   r%   )r   	to_concatxr$   r%   s        r   _concat_same_typez FloatAttrArray._concat_same_typeU   sG    ~~y9!qvv9:$'	Ny|  4 :s   Ar1   )r   None)r   int)FN)r   r   r   r	   r#   __array_priority__r(   r   r/   r9   r=   r@   rB   r*   rM   r   r   r   r   r   &   s[    E .2  :#-7  r   r   )__doc__
__future__r   r2   typingr   numpyr   pandas.core.dtypes.baser   pandasr4   pandas.core.arraysr   pandas._typingr   r	   r   r   r   r   <module>rY      s?    #     2  -%^ "3^ 3r   