403Webshell
Server IP : 209.209.40.120  /  Your IP : 216.73.217.112
Web Server : Microsoft-IIS/10.0
System : Windows NT NEWWWW 10.0 build 17763 (Windows Server 2019) i586
User : NEWWWW$ ( 0)
PHP Version : 8.3.30
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /Python312/Lib/site-packages/pandas/tests/arrays/sparse/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /Python312/Lib/site-packages/pandas/tests/arrays/sparse/__pycache__/test_libsparse.cpython-312.pyc
�

.	�g]K�
���ddlZddlZddlZddlmcmZddlm	cm
Zddlm
Z
ddlmZddlmZmZmZej*d��Zej*gd�gd�gd�gd�gd	�gd
�gddgddgd
gdgd
gdggdgdgddgddgddgddggdgdgddgddgdgdggddgddgddgddggggdgdggggggggd���d��ZGd�d�ZGd�d�ZGd�d�ZGd�d�ZGd �d!�ZGd"�d#�Zy)$�N)�Series)�
BlockIndex�IntIndex�make_sparse_indexc��y)N��r	��KC:\Python312\Lib\site-packages\pandas/tests/arrays/sparse/test_libsparse.py�test_lengthrs��
r
)r��)��r)��	�)rrr)rrr)�r�rrrr�
r
���r)�
plain_case�
delete_blocks�split_blocks�
skip_block�no_intersect�	one_empty)�params�idsc��|jS�N)�param)�requests r�casesr&s��z�=�=�r
c�R�eZdZejjddgdgdgdgdgdggddgddgddgddggd	�gd
�gdgdgdgdgdgd
ggddgddgdgdgdgdggddgddgdgd
gdgdggddgddgddgddgdgdggdgdggd�gd�dgdggddgddgddgddggd�gd�gg�d��Zd�Zy)�TestSparseIndexUnionz"xloc, xlen, yloc, ylen, eloc, elenrrrrrrr)rrr)r
rrrrr
�r�
r)rrr)rrr)rrrr)rrrrc��t|||�}t|||�}	|j|	�}
t|
t�sJ�tj|
j
t
j|tj���tj|
jt
j|tj���|j�}|	j�}|j|�}
t|
t�sJ�tj|
j|
j�j�y)N��dtype)
r�
make_union�
isinstance�tm�assert_numpy_array_equal�blocs�np�array�int32�blengths�to_int_indexr�indices)�self�xloc�xlen�yloc�ylen�eloc�elenr�xindex�yindex�bresult�ixindex�iyindex�iresults              r�test_index_make_unionz*TestSparseIndexUnion.test_index_make_unionXs���X�K��t�4���K��t�4���#�#�F�+���'�:�.�.�.�
�#�#�G�M�M�2�8�8�D����3Q�R�
�#�#�G�$4�$4�b�h�h�t�2�8�8�6T�U��%�%�'���%�%�'���$�$�W�-���'�8�,�,�,�
�#�#�G�O�O�W�5I�5I�5K�5S�5S�Tr
c���tdtjgd�tj���}tdtjddgtj���}|j	|�}tdtjgd�tj��}|j|�sJ�tdtjgtj���}tdtjddgtj���}|j	|�}tdtjddgtj��}|j|�sJ�tdtjgtj���}tdtjgtj���}|j	|�}tdtjgtj��}|j|�sJ�tdtjgd�tj���}tdtjgd�tj���}|j	|�}tdtjgd�tj��}|j|�sJ�tdtjddgtj���}td	tjddgtj���}d
}t
jt|��5|j	|�ddd�y#1swYyxYw)Nr)rrrr,rr)rrrr�rrrrrrr�-Indices must reference same underlying length��match)	rr3r4r5r.�equals�pytest�raises�
ValueError)r9�a�b�res�exp�msgs      r�test_int_index_make_unionz.TestSparseIndexUnion.test_int_index_make_union�s7���Q�����"�(�(�;�<���Q����!�Q��r�x�x�8�9���l�l�1�o���q�"�(�(�<����:�;���z�z�#�����Q�����2�8�8�4�5���Q����!�Q��r�x�x�8�9���l�l�1�o���q�"�(�(�A�q�6�2�8�8�4�5���z�z�#�����Q�����2�8�8�4�5���Q�����2�8�8�4�5���l�l�1�o���q�"�(�(�2�r�x�x�0�1���z�z�#�����Q��������A�B���Q��������A�B���l�l�1�o���q�"�(�(�?�B�H�H�=�>���z�z�#�����Q����!�Q��r�x�x�8�9���Q����!�Q��r�x�x�8�9��=��
�]�]�:�S�
1�	�
�L�L��O�	�	�	�s�M+�+M4N)�__name__�
__module__�__qualname__rM�mark�parametrizerFrUr	r
rr(r(Ws'���[�[���,��S�1�#��s�Q�C�!��q�c�*���W�q�!�f�q�"�g��1�v�{�I�F��S�1�#��s�Q�C�!��q�c�*���W�q�!�f�q�c�A�3���b�T�2���V�a��V�a�S�1�#��s�R�D�1���W�q�!�f�q�"�g��1�v��s�R�D�9��S�2�$�
�I��s�R�D�9���W�q�!�f�q�"�g��1�v�~�|�L�		
��*U��*U�Xr
r(c
��eZdZejd��Zd�Zejjde
dejddgej���e
dejgd�ej���e
d	ejgej���e
dejgej���g�d
��Zy)�TestSparseIndexIntersectc��|\}}}}}}t|||�}	t|||�}
t|||�}t|dz||�}|	j|
�}
|
j|�sJ�|	j�j|
j��}
|
j|j��sJ�d}t	j
t|��5|	j|�ddd�t	j
t|��5|	j�j|j��ddd�y#1swY�[xYw#1swYyxYw)NrrIrJ)r�	intersectrLr7rMrN�	Exception)r9r&rr:r;r<r=r>r?r@rA�expected�longer_index�resultrTs               r�test_intersectz'TestSparseIndexIntersect.test_intersect�s2��-2�*��d�D�$��d��K��t�4���K��t�4���k�4��6��!�+��/�4��>���!�!�&�)���}�}�X�&�&�&��$�$�&�0�0��1D�1D�1F�G���}�}�X�2�2�4�5�5�5�=��
�]�]�9�C�
0�	+����\�*�	+�
�]�]�9�C�
0�	I����!�+�+�L�,E�,E�,G�H�	I�	I�	+�	+��	I�	I�s�D<�.E�<E�Ec��tdtjgtj���}tdtjddgtj���}|j	|�j|�sJ�|j	|�j|�sJ�|j
�}|j
�}|j	|�j|�sJ�|j	|�j|�sJ�y)Nrr,rr)rr3r4r5r^rL�to_block_index)r9r@rAs   r�test_intersect_emptyz-TestSparseIndexIntersect.test_intersect_empty�s����!�R�X�X�b����9�:���!�R�X�X�q�!�f�B�H�H�=�>������'�.�.�v�6�6�6�����'�.�.�v�6�6�6��&�&�(���&�&�(������'�.�.�v�6�6�6�����'�.�.�v�6�6�6r
�caserrrr,)rrrrc��|j|�j|�sJ�|j�}|j|�j|�sJ�yr#)r^rLre)r9rgs  r�test_intersect_identicalz1TestSparseIndexIntersect.test_intersect_identical�sL���~�~�d�#�*�*�4�0�0�0��"�"�$���~�~�d�#�*�*�4�0�0�0r
N)rVrWrX�td�skip_if_windowsrcrfrMrYrZrr3r4r5rir	r
rr\r\�s������I��I�$	7��[�[����
�Q�����!�Q��r�x�x�8�9��Q������"�(�(�;�<��Q������2�8�8�4�5��Q������2�8�8�4�5�
	
�
�1�
�1r
r\c�(�eZdZd�Zd�Zejjdddg�d��Zejjdddg�d��Z	ejjdd	d
gdd	gdd
gdd
gdd
gdd
gdd
gddgddgdd
gg
�d��Z
y)�TestSparseIndexCommonc��tdtjddgtj��d��}t	|t
�sJ�|jdk(sJ�tj|jtjddgtj���tdtjgtj��d��}t	|t
�sJ�|jdk(sJ�tj|jtjgtj���tdtjgd�tj��d��}t	|t
�sJ�|jdk(sJ�tj|jtjgd�tj���y�	Nrrrr,�integer��kindr�rrrr�
rr3r4r5r/r�npointsr0r1r8�r9�idxs  r�test_int_internalz'TestSparseIndexCommon.test_int_internal��5����2�8�8�Q��F�"�(�(�#C�)�T���#�x�(�(�(��{�{�a����
�#�#�C�K�K����1�a�&����1Q�R���2�8�8�B�b�h�h�#?�i�P���#�x�(�(�(��{�{�a����
�#�#�C�K�K����"�B�H�H�1M�N��
�r�x�x��B�H�H�5�I�
���#�x�(�(�(��{�{�a����
�#�#�C�K�K����,�b�h�h�1W�Xr
c���tdtjddgtj��d��}t	|t
�sJ�|jdk(sJ�tj|jtjdgtj���tj|jtjdgtj���tdtjgtj��d��}t	|t
�sJ�|jdk(sJ�tj|jtjgtj���tj|jtjgtj���tdtjgd�tj��d��}t	|t
�sJ�|jdk(sJ�tj|jtjdgtj���tj|jtjdgtj���tdtjgd	�tj��d��}t	|t
�sJ�|jdk(sJ�tj|jtjddgtj���tj|jtjd
dgtj���y�Nrrrr,�blockrqrrs�rrrr�rr3r4r5r/rrur0r1r2r6rvs  r�test_block_internalz)TestSparseIndexCommon.test_block_internal��+����2�8�8�Q��F�"�(�(�#C�'�R���#�z�*�*�*��{�{�a����
�#�#�C�I�I�r�x�x���2�8�8�/L�M�
�#�#�C�L�L�"�(�(�A�3�b�h�h�2O�P���2�8�8�B�b�h�h�#?�g�N���#�z�*�*�*��{�{�a����
�#�#�C�I�I�r�x�x��"�(�(�/K�L�
�#�#�C�L�L�"�(�(�2�R�X�X�2N�O���2�8�8�L����#I�PW�X���#�z�*�*�*��{�{�a����
�#�#�C�I�I�r�x�x���2�8�8�/L�M�
�#�#�C�L�L�"�(�(�A�3�b�h�h�2O�P���2�8�8�I�R�X�X�#F�W�U���#�z�*�*�*��{�{�a����
�#�#�C�I�I�r�x�x��A��b�h�h�/O�P�
�#�#�C�L�L�"�(�(�A�q�6����2R�Sr
rrrpr|c��tdtjddgtj��|��}|j	d�dk(sJ�|j	d�dk(sJ�|j	d�dk(sJ�|j	d�dk(sJ�|j	d�dk(sJ�|j	d�dk(sJ�tdtjgtj��|��}tdd	�D]}|j	|�dk(r�J�tdtjgd
�tj��|��}|j	d�dk(sJ�|j	d�dk(sJ�|j	d�dk(sJ�|j	d�dk(sJ�|j	d�dk(sJ�|j	d�dk(sJ�tdtjgd�tj��|��}|j	d�dk(sJ�|j	d�dk(sJ�|j	d�dk(sJ�|j	d�dk(sJ�|j	d�dk(sJ�|j	d�dk(sJ�y)Nrrrr,rq���rrrrsr})rr3r4r5�lookup�range)r9rrrw�is    r�test_lookupz!TestSparseIndexCommon.test_lookups4����2�8�8�Q��F�"�(�(�#C�$�O���z�z�"�~��#�#�#��z�z�!�}��"�"�"��z�z�!�}��"�"�"��z�z�!�}��!�!�!��z�z�!�}��!�!�!��z�z�!�}��"�"�"���2�8�8�B�b�h�h�#?�d�K���r�1��	'�A��:�:�a�=�B�&�&�&�	'� ��2�8�8�L����#I�PT�U���z�z�"�~��#�#�#��z�z�!�}��!�!�!��z�z�!�}��!�!�!��z�z�!�}��!�!�!��z�z�!�}��!�!�!��z�z�!�}��"�"�"���2�8�8�I�R�X�X�#F�T�R���z�z�"�~��#�#�#��z�z�!�}��!�!�!��z�z�!�}��"�"�"��z�z�!�}��!�!�!��z�z�!�}��!�!�!��z�z�!�}��"�"�"r
c���tdtjddgtj��|��}|j	tjgd�tj���}tjgd�tj��}tj||�|j	tjgd�tj���}tjgd	�tj��}tj||�tdtjgtj��|��}|j	tjgd
�tj���}tjgd�tj��}tj||�tdtjgd�tj��|��}|j	tjgd�tj���}tjgd�tj��}tj||�|j	tjgd�tj���}tjgd
�tj��}tj||�tdtjgd�tj��|��}|j	tjgd�tj���}tjgd�tj��}tj||�|j	tjgd�tj���}tjgd�tj��}tj||�y)Nrrrr,rq)r�rr)r�r�r)rrrr)r�rr�r)r�rrr)r�r�r�r�rs)r�rrrr})rrrr)rr�rr)rrrr)r�r�rr�)rr3r4r5�lookup_arrayr0r1)r9rrrwrRrSs     r�test_lookup_arrayz'TestSparseIndexCommon.test_lookup_array-sQ����2�8�8�Q��F�"�(�(�#C�$�O�����r�x�x�
�"�(�(�C�D���h�h�{�"�(�(�3��
�#�#�C��-����r�x�x��B�H�H�E�F���h�h�~�R�X�X�6��
�#�#�C��-���2�8�8�B�b�h�h�#?�d�K�����r�x�x�
�R�X�X�F�G���h�h�'�r�x�x�8��
�#�#�C��-���2�8�8�L����#I�PT�U�����r�x�x�
�"�(�(�C�D���h�h�z����2��
�#�#�C��-����r�x�x��B�H�H�E�F���h�h�}�B�H�H�5��
�#�#�C��-���2�8�8�I�R�X�X�#F�T�R�����r�x�x��B�H�H�E�F���h�h�}�B�H�H�5��
�#�#�C��-����r�x�x��B�H�H�E�F���h�h��b�h�h�7��
�#�#�C��-r
z
idx, expectedrr�rr
rr)rr�rrr�c��tdddgddg�}|j|�|k(sJ�|j�}|j|�|k(sJ�y)Nrrrrr)rr�r7)r9rwr`�bindex�iindexs     r�test_lookup_basicsz(TestSparseIndexCommon.test_lookup_basicsPsV�� �B��B��!�Q��0���}�}�S�!�X�-�-�-��$�$�&���}�}�S�!�X�-�-�-r
N)rVrWrXrxrrMrYrZr�r�r�r	r
rrmrm�s���Y�$T�2�[�[���V�i��%9�:�#�;�#�<�[�[���V�i��%9�:� .�;� .�D�[�[����
��G�
��F�
��F�
��G�
��G�
��H�
��H�
��G�
��G�
��H�	
��.��.r
rmc�r�eZdZd�Zej
j
dgd��d��Zd�Zd�Z	d�Z
d�Zy	)
�TestBlockIndexc���tdtjddgtj��d��}t	|t
�sJ�|jdk(sJ�tj|jtjdgtj���tj|jtjdgtj���tdtjgtj��d��}t	|t
�sJ�|jdk(sJ�tj|jtjgtj���tj|jtjgtj���tdtjgd�tj��d��}t	|t
�sJ�|jdk(sJ�tj|jtjdgtj���tj|jtjdgtj���tdtjgd	�tj��d��}t	|t
�sJ�|jdk(sJ�tj|jtjddgtj���tj|jtjd
dgtj���yr{r~rvs  rrz"TestBlockIndex.test_block_internalhr�r
r�)rr�d�ec	��t|tjd|dtj��d��}tjd|dtj��}t	j
|j|�t	j
|jtjt|�tj���y)Nrrr,r|rq)
rr3�aranger5r0r1r2r6�ones�len)r9r�rwrSs    r�test_make_block_boundaryz'TestBlockIndex.test_make_block_boundary�sv����2�9�9�Q��1�B�H�H�#E�G�T���i�i��1�a�r�x�x�0��
�#�#�C�I�I�s�3�
�#�#�C�L�L�"�'�'�#�c�(�"�(�(�2S�Tr
c��tdddgddg�}|j|�sJ�|jtdddgddg��rJ�y)Nrrrrrr)rrL�r9�indexs  r�test_equalszTestBlockIndex.test_equals�sP���2��1�v��1�v�.���|�|�E�"�"�"��<�<�
�2��1�v��1�v� >�?�?�?�?r
c�H�g}g}td||�td||�d}tjt|��5tddgdg�ddd�d}tjt|��5tdddgdd	g�ddd�y#1swY�AxYw#1swYyxYw)
NrrzBlock 0 extends beyond endrJrrzBlock 0 overlapsrr)rrMrNrO)r9�locs�lengthsrTs    r�test_check_integrityz#TestBlockIndex.test_check_integrity�s�������	�1�d�G�$�	�1�d�G�$�*��
�]�]�:�S�
1�	&��r�A�3���%�	&�!��
�]�]�:�S�
1�	+��r�A�q�6�A�q�6�*�	+�	+�		&�	&��	+�	+�s�B�1B�B�B!c���ddg}ddg}gd�}td||�}|j�}tj|jtj|t
j���y)Nrrrr)
rrrrrr�rr*rrrr,)rr7r0r1r8r3r4r5)r9r�r��exp_indsr|�denses      r�test_to_int_indexz TestBlockIndex.test_to_int_index�sX���2�w���a�&��7���2�t�W�-���"�"�$��
�#�#�E�M�M�2�8�8�H�B�H�H�3U�Vr
c�N�tdddgddg�}|j�|usJ�y)Nrrrr)rrer�s  r�test_to_block_indexz"TestBlockIndex.test_to_block_index�s/���2��1�v��1�v�.���#�#�%��.�.�.r
N)rVrWrXrrMrYrZr�r�r�r�r�r	r
rr�r�gsF��T�2�[�[���S�"3�4�U�5�U�@�+�$W�/r
r�c�*�eZdZd�Zd�Zd�Zd�Zd�Zy)�TestIntIndexc��d}tjt|��5tdgd���ddd�d}tjt|��5tdgd���ddd�d}tjt|��5tdgd���ddd�d	}tjt|��5tdgd
���ddd�tjt|��5tdgd���ddd�d}tjt|��5tdgd
���ddd�tjt|��5tdgd���ddd�y#1swY��ExYw#1swY��xYw#1swY��xYw#1swY��xYw#1swY��xYw#1swY�{xYw#1swYyxYw)NzToo many indicesrJr)rrr)�lengthr8zNo index can be less than zeror)r���rz(All indices must be less than the length)rrr)rrrz#Indices must be strictly increasing)rrr)rrr)rMrNrOr)r9rTs  rr�z!TestIntIndex.test_check_integrity�sg�� ��
�]�]�:�S�
1�	2��A�y�1�	2�/��
�]�]�:�S�
1�	3��A�z�2�	3�/��
�]�]�:�S�
1�	3��A�z�2�	3�9��
�]�]�:�S�
1�	2��A�y�1�	2��]�]�:�S�
1�	2��A�y�1�	2�4��
�]�]�:�S�
1�	2��A�y�1�	2��]�]�:�S�
1�	2��A�y�1�	2�	2�=	2�	2��	3�	3��	3�	3��	2�	2��	2�	2��	2�	2��	2�	2�sS�E1�E>�F�=F�0F#�%F/�F;�1E;�>F�F�F �#F,�/F8�;Gc��tdtjddgtj��d��}t	|t
�sJ�|jdk(sJ�tj|jtjddgtj���tdtjgtj��d��}t	|t
�sJ�|jdk(sJ�tj|jtjgtj���tdtjgd�tj��d��}t	|t
�sJ�|jdk(sJ�tj|jtjgd�tj���yrortrvs  rrxzTestIntIndex.test_int_internal�ryr
c��tdgd��}|j|�sJ�|jtdgd���rJ�y)NrrHrs)rrLr�s  rr�zTestIntIndex.test_equals�s<����_�-���|�|�E�"�"�"��<�<���\� :�;�;�;�;r
c�2�|\}}}}}}t|||�}t|||�}	|j�j�}
|	j�j�}t|
t�sJ�|
j	|�sJ�|j	|	�sJ�yr#)rr7rer/rL)r9r&rr:r;r<r=�_r@rA�xbindex�ybindexs            rr�z TestIntIndex.test_to_block_index�s���',�$��d�D�$��1��K��t�4���K��t�4���%�%�'�6�6�8���%�%�'�6�6�8���'�:�.�.�.��~�~�f�%�%�%��~�~�f�%�%�%r
c�H�tdgd��}|j�|usJ�y)Nr)rrrrr)rr7r�s  rr�zTestIntIndex.test_to_int_index�s%����_�-���!�!�#�u�,�,�,r
N)rVrWrXr�rxr�r�r�r	r
rr�r��s��#2�JY�$<�

&�-r
r�c�T�eZdZejjdgd��d��Zy)�TestSparseOperators�opname)�add�sub�mul�truediv�floordivc��|\}}}}}}ttd|�d��}	tt|�}
t|||�}t|||�}|j	�}
|j	�}tj|j�dzdz}tj|j�dzdz}d}d}|	||||||�\}}}|	||
||||�\}}}|j	�j|�sJ�tj||�||k(sJ�t||
j�}|jtj|��j|�}t||j�}|jtj|��j|�}|
||�}|j|j�}tj||j�tj||j�y)N�sparse_�_float64g$@rgY@rr)�getattr�splib�operatorrr7r3r�rurLr0r1rr8�reindex�fillna�values)r9r�r&rr:r;r<r=r��	sparse_op�	python_opr@rA�xdindex�ydindex�x�y�xfill�yfill�result_block_vals�rb_index�bfill�result_int_vals�ri_index�ifill�xseries�yseries�
series_results                            r�test_opzTestSparseOperators.test_op�s���',�$��d�D�$��1��E�W�V�H�H�#=�>�	��H�f�-�	��K��t�4���K��t�4���%�%�'���%�%�'���I�I�f�n�n�%��,�q�0���I�I�f�n�n�%��-��1������-6�
�v�u�a���.
�*��8�U�,5�
�w��q�'�5�,
�(���5��$�$�&�-�-�h�7�7�7�
�#�#�$5��G���~��~���G�O�O�,���/�/�"�)�)�K�"8�9�@�@��G����G�O�O�,���/�/�"�)�)�K�"8�9�@�@��G��!�'�7�3�
�%�-�-�h�.>�.>�?�
�
�#�#�$5�}�7K�7K�L�
�#�#�O�]�5I�5I�Jr
N)rVrWrXrMrYrZr�r	r
rr�r��s)���[�[���X�'S�T�'K�U�'Kr
r�)r��numpyr3rM�pandas._libs.sparse�_libs�sparser��pandas.util._test_decorators�util�_test_decoratorsrj�pandasr�pandas._testing�_testingr0�pandas.core.arrays.sparserrr�fixturerr&r(r\rmr�r�r�r	r
r�<module>r�s�����
�#�#�)�)���������������
������
	
���F�
��F�
�C�
�C�
�C�
�C�
	
��C�
�D�
��F�
��F�
��F�
��F�
	
��D�
�C�
��G�
��F�
�D�
�C�
	
���G�
��F�
��G�
��F���
	
��C�
�C�����
	
�S1�d	�g;�x�y;�x�X�X�v-1�-1�`B.�B.�JF/�F/�RK-�K-�\)K�)Kr

Youez - 2016 - github.com/yon3zu
LinuXploit