
    EgF                       U d dl mZ d dlmZ d dlZd dlmZ d dlm	Z	 d dl
mZmZ  G d de          Z G d	 d
e          ZdZe G d de                      Ze G d de                      Ze G d de                      Ze G d de                      Ze G d de                      Ze G d de                      Ze G d de                      Ze G d de                      Z ej        ej                   e             ej        ej                   e             ej        ej                   e             ej        ej                   e             ej        ej                   e             ej        ej                   e             ej        ej                   e             ej        ej                    e            iZ!de"d<   dS )    )annotations)ClassVarN)register_extension_dtype)is_integer_dtype)NumericArrayNumericDtypec                      e Zd ZdZ ej        ej                  ZeZ	e
dd            Ze
dd            Ze
dd            ZdS )IntegerDtypea'  
    An ExtensionDtype to hold a single size & kind of integer dtype.

    These specific implementations are subclasses of the non-public
    IntegerDtype. For example, we have Int8Dtype to represent signed int 8s.

    The attributes name & type are set when these subclasses are created.
    returntype[IntegerArray]c                    t           S )zq
        Return the array type associated with this dtype.

        Returns
        -------
        type
        )IntegerArrayclss    O/var/www/sysmax/venv/lib/python3.11/site-packages/pandas/core/arrays/integer.pyconstruct_array_typez!IntegerDtype.construct_array_type   s
         dict[np.dtype, IntegerDtype]c                    t           S )N)NUMPY_INT_TO_DTYPEr   s    r   _get_dtype_mappingzIntegerDtype._get_dtype_mapping(   s    !!r   values
np.ndarraydtypenp.dtypecopyboolc           	        	 |                     |d|          S # t          $ rh}|                     ||          }||k                                    r|cY d}~S t          d|j         dt	          j        |                     |d}~ww xY w)z
        Safely cast the values to the given dtype.

        "safe" in this context means the casting is lossless. e.g. if 'values'
        has a floating dtype, each value must be an integer.
        safe)castingr   )r   Nz"cannot safely cast non-equivalent z to )astype	TypeErrorallr   np)r   r   r   r   errcasteds         r   
_safe_castzIntegerDtype._safe_cast,   s    		==T=BBB 	 	 	]]5t]44F& %%'' XV\XXrxPUXX 	s     
B0BB-BBN)r   r   )r   r   )r   r   r   r   r   r   r   r   )__name__
__module____qualname____doc__r$   r   int64_default_np_dtyper   _checkerclassmethodr   r   r'    r   r   r
   r
      s          !**H   [ " " " ["    [  r   r
   c                  "    e Zd ZdZeZdZdZdZdS )r   a  
    Array of integer (optional missing) values.

    Uses :attr:`pandas.NA` as the missing value.

    .. warning::

       IntegerArray is currently experimental, and its API or internal
       implementation may change without warning.

    We represent an IntegerArray with 2 numpy arrays:

    - data: contains a numpy integer array of the appropriate dtype
    - mask: a boolean array holding a mask on the data, True is missing

    To construct an IntegerArray from generic array-like input, use
    :func:`pandas.array` with one of the integer dtypes (see examples).

    See :ref:`integer_na` for more.

    Parameters
    ----------
    values : numpy.ndarray
        A 1-d integer-dtype array.
    mask : numpy.ndarray
        A 1-d boolean-dtype array indicating missing values.
    copy : bool, default False
        Whether to copy the `values` and `mask`.

    Attributes
    ----------
    None

    Methods
    -------
    None

    Returns
    -------
    IntegerArray

    Examples
    --------
    Create an IntegerArray with :func:`pandas.array`.

    >>> int_array = pd.array([1, None, 3], dtype=pd.Int32Dtype())
    >>> int_array
    <IntegerArray>
    [1, <NA>, 3]
    Length: 3, dtype: Int32

    String aliases for the dtypes are also available. They are capitalized.

    >>> pd.array([1, None, 3], dtype='Int32')
    <IntegerArray>
    [1, <NA>, 3]
    Length: 3, dtype: Int32

    >>> pd.array([1, None, 3], dtype='UInt16')
    <IntegerArray>
    [1, <NA>, 3]
    Length: 3, dtype: UInt16
       r   N)	r(   r)   r*   r+   r
   
_dtype_cls_internal_fill_value_truthy_value_falsey_valuer0   r   r   r   r   @   s4        > >@ J  MMMMr   r   a  
An ExtensionDtype for {dtype} integer data.

Uses :attr:`pandas.NA` as its missing value, rather than :attr:`numpy.nan`.

Attributes
----------
None

Methods
-------
None

Examples
--------
For Int8Dtype:

>>> ser = pd.Series([2, pd.NA], dtype=pd.Int8Dtype())
>>> ser.dtype
Int8Dtype()

For Int16Dtype:

>>> ser = pd.Series([2, pd.NA], dtype=pd.Int16Dtype())
>>> ser.dtype
Int16Dtype()

For Int32Dtype:

>>> ser = pd.Series([2, pd.NA], dtype=pd.Int32Dtype())
>>> ser.dtype
Int32Dtype()

For Int64Dtype:

>>> ser = pd.Series([2, pd.NA], dtype=pd.Int64Dtype())
>>> ser.dtype
Int64Dtype()

For UInt8Dtype:

>>> ser = pd.Series([2, pd.NA], dtype=pd.UInt8Dtype())
>>> ser.dtype
UInt8Dtype()

For UInt16Dtype:

>>> ser = pd.Series([2, pd.NA], dtype=pd.UInt16Dtype())
>>> ser.dtype
UInt16Dtype()

For UInt32Dtype:

>>> ser = pd.Series([2, pd.NA], dtype=pd.UInt32Dtype())
>>> ser.dtype
UInt32Dtype()

For UInt64Dtype:

>>> ser = pd.Series([2, pd.NA], dtype=pd.UInt64Dtype())
>>> ser.dtype
UInt64Dtype()
c                  X    e Zd ZU ej        ZdZded<   e	                    d          Z
dS )	Int8DtypeInt8ClassVar[str]nameint8r   N)r(   r)   r*   r$   r<   typer;   __annotations___dtype_docstringformatr+   r0   r   r   r8   r8      s>         7D D    %%F%33GGGr   r8   c                  X    e Zd ZU ej        ZdZded<   e	                    d          Z
dS )
Int16DtypeInt16r:   r;   int16r=   N)r(   r)   r*   r$   rE   r>   r;   r?   r@   rA   r+   r0   r   r   rC   rC      >         8D!D!!!!%%G%44GGGr   rC   c                  X    e Zd ZU ej        ZdZded<   e	                    d          Z
dS )
Int32DtypeInt32r:   r;   int32r=   N)r(   r)   r*   r$   rJ   r>   r;   r?   r@   rA   r+   r0   r   r   rH   rH      rF   r   rH   c                  X    e Zd ZU ej        ZdZded<   e	                    d          Z
dS )
Int64DtypeInt64r:   r;   r,   r=   N)r(   r)   r*   r$   r,   r>   r;   r?   r@   rA   r+   r0   r   r   rL   rL      rF   r   rL   c                  X    e Zd ZU ej        ZdZded<   e	                    d          Z
dS )
UInt8DtypeUInt8r:   r;   uint8r=   N)r(   r)   r*   r$   rQ   r>   r;   r?   r@   rA   r+   r0   r   r   rO   rO      rF   r   rO   c                  X    e Zd ZU ej        ZdZded<   e	                    d          Z
dS )UInt16DtypeUInt16r:   r;   uint16r=   N)r(   r)   r*   r$   rU   r>   r;   r?   r@   rA   r+   r0   r   r   rS   rS      >         9D"D""""%%H%55GGGr   rS   c                  X    e Zd ZU ej        ZdZded<   e	                    d          Z
dS )UInt32DtypeUInt32r:   r;   uint32r=   N)r(   r)   r*   r$   rZ   r>   r;   r?   r@   rA   r+   r0   r   r   rX   rX      rV   r   rX   c                  X    e Zd ZU ej        ZdZded<   e	                    d          Z
dS )UInt64DtypeUInt64r:   r;   uint64r=   N)r(   r)   r*   r$   r^   r>   r;   r?   r@   rA   r+   r0   r   r   r\   r\      rV   r   r\   r   r   )#
__future__r   typingr   numpyr$   pandas.core.dtypes.baser   pandas.core.dtypes.commonr   pandas.core.arrays.numericr   r   r
   r   r@   r8   rC   rH   rL   rO   rS   rX   r\   r   r<   rE   rJ   r,   rQ   rU   rZ   r^   r   r?   r0   r   r   <module>re      s   " " " " " " "           < < < < < < 6 6 6 6 6 6       - - - - -< - - -`I I I I I< I I IX> F 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6, 6 6 6 6 6 6 6 6, 6 6 6 6 6 6 6 6, 6 6 6 BHRWyy{{BHRX

BHRX

BHRX

BHRX

BHRYBHRYBHRY	4  	 	 	 	 	 	r   