Sindbad~EG File Manager

Current Path : /usr/local/lib/python3.12/site-packages/pandas/compat/numpy/__pycache__/
Upload File :
Current File : //usr/local/lib/python3.12/site-packages/pandas/compat/numpy/__pycache__/function.cpython-312.pyc

�

Mٜg�3��
�UdZddlmZddlmZmZmZmZmZddl	Z
ddl	mZddlm
Z
mZddlmZddlmZmZmZerdd	lmZmZed
ed�ZGd�d�Zd
diZeeddd��Zeeddd��Zd]d�Zd^d�Zd^d�ZiZ de!d<de d<de d<de d<de d<de d<ee ddd��Z"iZ#d e!d!<de#d<de#d<de#d<ee#ddd��Z$d_d"�Z%d
diZ&d#e!d$<ee&d%dd&��Z'ed`d'��Z(edad(��Z(				dbd)�Z(iZ)d#e!d*<de)d+<de)d
<ee)dd�,�Z*ee)d-dd��Z+dcd.�Z,iZ-d/e!d0<de-d+<de-d
<d1e-d2<de-d<ee-d3dd��Z.ee-d4dd��Z/dd1d5�Z0ee0d6�7�Z1dddd1d8�Z2ee2d9dd��Z3ee2d:dd��Z4dd;iZ5d<e!d=<ee5d>dd��Z6ddiZ7d#e!d?<ee7d@dd��Z8d
diZ9d#e!dA<ee9dBdd��Z:iZ;de!dC<de;d<de;d<de;d<ee;dDd6�E�Z<iZ=dFe!dG<de=d+<de=d
<e=j}�Z?de?d<d1e?d2<de?dH<e?j}�Z@e?j}�ZAe=j}�ZBd1eBdI<d1eBd2<d1e=d2<ee=d6�7�ZCee?dJdd��ZDee@dKdd��ZEeeAdLdd��ZFeeBdMdd��ZGiZHd/e!dN<deHd+<deHd
<d1eHd2<eeHd6�7�ZIiZJdOe!dP<deJd
<dQeJdR<eeJdSd6�E�ZKdddT�ZLdUdiZMeeMdVdd��ZNdedfdW�ZOdXZPdgdY�ZQdhdidZ�ZReGeFe3e4eDeEd[�ZSdjd\�ZTy)ka�
For compatibility with numpy libraries, pandas functions or methods have to
accept '*args' and '**kwargs' parameters to accommodate numpy arguments that
are not actually used or respected in the pandas implementation.

To ensure that users do not abuse these parameters, validation is performed in
'validators.py' to make sure that any extra parameters passed correspond ONLY
to those in the numpy signature. Part of that validation includes whether or
not the user attempted to pass in non-default values for these extraneous
parameters. As we want to discourage users from relying on these parameters
when calling the pandas implementation, we want them only to pass in the
default values for these parameters.

This module provides a set of commonly used default arguments for functions and
methods that are spread throughout the codebase. This module will make it
easier to adjust to future upstream changes in the analogous numpy signatures.
�)�annotations)�
TYPE_CHECKING�Any�TypeVar�cast�overloadN)�ndarray)�is_bool�
is_integer)�UnsupportedFunctionCall)�
validate_args�validate_args_and_kwargs�validate_kwargs)�Axis�AxisInt�	AxisNoneTc�8�eZdZ			d			dd�Z			d			dd�Zy)�CompatValidatorNc�<�||_||_||_||_y�N)�fname�method�defaults�max_fname_arg_count)�selfrrrrs     �G/usr/local/lib/python3.12/site-packages/pandas/compat/numpy/function.py�__init__zCompatValidator.__init__4s!����
���� ��
�#6�� �c�>�|s|sy|�|jn|}|�|jn|}|�|jn|}|dk(rt||||j�y|dk(rt|||j�y|dk(rt
|||||j�ytd|�d���)N�args�kwargs�bothzinvalid validation method '�')rrrr
rrr�
ValueError)rr r!rrrs      r�__call__zCompatValidator.__call__@s����F��#�m��
�
���#�*�
�$�$�$�	�
!'�����F���V���%��':�D�M�M�J�
�x�
��E�6�4�=�=�9�
�v�
�$��t�V�%8�$�-�-�
��:�6�(�!�D�E�Er)NNN)rz
str | None�return�None)�__name__�
__module__�__qualname__rr%�rrrr3sM���!� �
7��	
7�
�
7� � �!�
F��
F�
�Frr�out�argminr"�)rrr�argmaxc�>�t|t�s|�|f|z}d}||fS)NT)�
isinstancer	)�skipnar s  r�process_skipnar3hs+���&�'�"�f�n��y�4������4�<�rc�<�t||�\}}t||�|S)a
    If 'Series.argmin' is called via the 'numpy' library, the third parameter
    in its signature is 'out', which takes either an ndarray or 'None', so
    check if the 'skipna' parameter is either an instance of ndarray or is
    None, since 'skipna' itself should be a boolean
    )r3�validate_argmin�r2r r!s   r�validate_argmin_with_skipnar7p�#��"�&�$�/�L�F�D��D�&�!��Mrc�<�t||�\}}t||�|S)a
    If 'Series.argmax' is called via the 'numpy' library, the third parameter
    in its signature is 'out', which takes either an ndarray or 'None', so
    check if the 'skipna' parameter is either an instance of ndarray or is
    None, since 'skipna' itself should be a boolean
    )r3�validate_argmaxr6s   r�validate_argmax_with_skipnar;|r8rzdict[str, int | str | None]�ARGSORT_DEFAULTS����axis�	quicksort�kind�order�stable�argsort)rrrzdict[str, int | None]�ARGSORT_DEFAULTS_KINDc�l�t|�s|�|f|z}d}t||d��tt|�}|S)a!
    If 'Categorical.argsort' is called via the 'numpy' library, the first
    parameter in its signature is 'axis', which takes either an integer or
    'None', so check if the 'ascending' parameter has either integer type or is
    None, since 'ascending' itself should be a boolean
    T�)r)r�validate_argsort_kindr�bool)�	ascendingr r!s   r�validate_argsort_with_ascendingrJ�s@���)��	� 1��|�d�"���	��$��A�>��T�9�%�I��rzdict[str, Any]�
CLIP_DEFAULTS�cliprFc��yrr+�r>r r!s   r�validate_clip_with_axisrO����rc��yrr+rNs   rrOrO�rPrc�N�t|t�r|f|z}d}t||�|S)a
    If 'NDFrame.clip' is called via the numpy library, the third parameter in
    its signature is 'out', which can takes an ndarray, so check if the 'axis'
    parameter is an instance of ndarray, since 'axis' itself should either be
    an integer or None
    N)r1r	�
validate_cliprNs   rrOrO�s1���$�� ��w��~�����$����Kr�CUM_FUNC_DEFAULTS�dtype)rr�cumsumc��t|�s	|f|z}d}n%t|tj�rt	|�}t|||��|S)z�
    If this function is called via the 'numpy' library, the third parameter in
    its signature is 'dtype', which takes either a 'numpy' dtype or 'None', so
    check if the 'skipna' parameter is a boolean or not
    T�r)r
r1�np�bool_rH�validate_cum_func)r2r r!�names    r�validate_cum_func_with_skipnar]�sD���6�?��y�4�����	�F�B�H�H�	%��f����d�F�$�/��Mrzdict[str, bool | None]�ALLANY_DEFAULTSF�keepdims�all�any)r,r_r!)r)r>rUr,r_�min�max�Czdict[str, str]�RESHAPE_DEFAULTS�reshape�REPEAT_DEFAULTS�repeat�ROUND_DEFAULTS�round�
SORT_DEFAULTS�sort)rrzdict[str, Any | None]�STAT_FUNC_DEFAULTS�initial�overwrite_input�sum�prod�mean�median�STAT_DDOF_FUNC_DEFAULTSzdict[str, str | None]�
TAKE_DEFAULTS�raise�mode�takec�X�t|t�s|�|f|z}d}t||dd��|S)z�
    If this function is called via the 'numpy' library, the third parameter in
    its signature is 'axis', which takes either an ndarray or 'None', so check
    if the 'convert' parameter is either an instance of ndarray or is None
    TrFr")rr)r1r	�
validate_take)�convertr r!s   r�validate_take_with_convertr|Hs6���'�7�#�w���z�D� �����$��A�f�E��Nr�axes�	transposec��|�g}t|�t|�z
}t|�t|�zdkDrtd|�d���y)z�
    'args' and 'kwargs' should be empty, except for allowed kwargs because all
    of their necessary parameters are explicitly listed in the function
    signature
    Nrz?numpy operations are not valid with groupby. Use .groupby(...).�
() instead)�set�lenr)r\r r!�alloweds    r�validate_groupby_funcr�\sX������
��[�3�w�<�
'�F�
�4�y�3�v�;���"�%�
!�!%��j�
2�
�	
�#r)rbrcrprqrr�std�varc�|�t|�t|�zdkDr"|tvrtd|�d���td��y)z�
    'args' and 'kwargs' should be empty because all of their necessary
    parameters are explicitly listed in the function signature
    rzAnumpy operations are not valid with resample. Use .resample(...).r�ztoo many arguments passed inN)r��RESAMPLER_NUMPY_OPSr�	TypeError)rr r!s   r�validate_resampler_funcr�qsS��
�4�y�3�v�;���"��(�(�)�&�&,�X�Z�9��
��6�7�7�
#rc�N�|�y||k\s
|dkr||zdkrtd|�d���yy)a
    Ensure that the axis argument passed to min, max, argmin, or argmax is zero
    or None, as otherwise it will be incorrectly ignored.

    Parameters
    ----------
    axis : int or None
    ndim : int, default 1

    Raises
    ------
    ValueError
    Nrz4`axis` must be fewer than the number of dimensions (�))r$)r>�ndims  r�validate_minmax_axisr�sA���|���t�|��q��T�D�[�1�_��O�PT�v�UV�W�X�X�&5�r)rsrrrbrcrprqc�R�|tvrt|||��St|}|||�S)NrX)�_validation_funcs�validate_stat_func)rr r!�validation_funcs    r�
validate_funcr��s1���%�%�!�$��e�<�<�'��.�O��4��(�(r)r2�bool | ndarray | Noner&ztuple[bool, Any])r2r�r&rH)rIzbool | int | Noner&rH)r>r	r&r')r>rr&r)r>zndarray | AxisNoneTr&zAxisNoneT | None)r2rHr&rH)r{zndarray | bool | Noner&rHr)r\�strr&r')rr�r&r')r.)r>zAxisInt | Noner��intr&r')r&r')U�__doc__�
__future__r�typingrrrrr�numpyrYr	�pandas._libs.libr
r�
pandas.errorsr�pandas.util._validatorsr
rr�pandas._typingrrrr�ARGMINMAX_DEFAULTSr5r:r3r7r;r<�__annotations__�validate_argsortrDrGrJrKrSrOrTr[�validate_cumsumr]r^�validate_all�validate_any�LOGICAL_FUNC_DEFAULTS�validate_logical_func�MINMAX_DEFAULTS�validate_min�validate_maxre�validate_reshaperg�validate_repeatri�validate_roundrk�
validate_sortrm�copy�SUM_DEFAULTS�
PROD_DEFAULTS�
MEAN_DEFAULTS�MEDIAN_DEFAULTSr��validate_sum�
validate_prod�
validate_mean�validate_medianrt�validate_stat_ddof_funcrurzr|�TRANSPOSE_DEFAULTS�validate_transposer�r�r�r�r�r�r+rr�<module>r�s���"#������2�����
��T�4�0�I�)F�)F�X�T�]��!��h�v�1���"��h�v�1���
�	�	�13��-�2�����&���� ��������!����#��I�1�V���02��,�1� "��f��!%��g��"&��h��'����&���

� "'��
�
�~�-�����A��
�

��
��
��
���
����*%'��>�&�!��'����%��#��f�!���"��X�f�!���

� +-��'�,���������#��
��������5��Q�����5��Q���!%�%�8��'�(=�h�O���$�t��O����5��Q�����5��Q���%,�S�>��.�1�"��I�f�!���$*�4�.���0�!��8�F����#(�����.� ��'�&�a���.0�
�*�/��
�f��#�
�f���
�g���
�V�H�M�
�,.��)�.�"��7�� ��5��!�&�&�(����V�� ��Z����Y���!�!�#�
��!�!�#�
�$�)�)�+��%*��!�"�#��
��!&��:��$�%7��I�����f�!��� ����A��
� ����A��
�"��8�F����35��/�4�#'��� �!%����&+��
�#�)�*A�(�S��')�
�$�)��
�e���
�f���
�V�H�M�
���d�^��$��k�&�a���

�$J��8�Y�*������
��)r

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists