403Webshell
Server IP : 217.160.0.135  /  Your IP : 216.73.217.25
Web Server : Apache
System : Linux www 6.18.52-i1-ampere #1203 SMP Mon Sep 14 18:29:59 CEST 2026 aarch64
User : sws1074145052 ( 1074145052)
PHP Version : 8.3.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /lib/python3/dist-packages/numpy/lib/tests/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/numpy/lib/tests/__pycache__/test__datasource.cpython-311.pyc
�

���cK)���ddlZddlZddlmZmZmZddlmZddlm	cm
Zddlm
Z
mZmZddlmZddlmZddlmZd%d�Zdad�Zd	�Zd
ZdZdZd
Zgd�ZdZ d�Z!d�Z"d�Z#d�Z$d�Z%d�Z&d�Z'd�Z(Gd�d��Z)Gd�d��Z*Gd�d��Z+Gd�d��Z,Gd �d!��Z-Gd"�d#��Z.d$�Z/dS)&�N)�mkdtemp�mkstemp�NamedTemporaryFile)�rmtree)�assert_�assert_equal�
assert_raises)�urlparse)�URLErrorc�h�|t��krtd���}|Std���)z$Stub to replace urlopen for testing.�urltmp_)�prefixzName or service not known)�
valid_httpurlrr)�url�data�tmpfiles   �B/usr/lib/python3/dist-packages/numpy/lib/tests/test__datasource.py�urlopen_stubrs5��
�m�o�o���$�I�6�6�6�����2�3�3�3�c�@�tjatt_dS�N)�urllib_request�urlopen�old_urlopenr�rr�setup_modulers��!�(�K�)�N���rc�(�tt_dSr)rrrrrr�teardown_moduler!s��(�N���rzhttp://www.google.com/z
index.htmlzhttp://fake.abc.web/site/zfake.txt)z/etc/shadowz../../shadowz
..\system.datzc:\windows\system.datsthree is the magic numberc�Z�tdd|d���\}}tj|��|S)N�.txt�dstmp_T)�suffixr�dir�text)r�os�close��filedir�fd�paths   r�valid_textfiler+2s.���f�X�7��N�N�N�H�B���H�R�L�L�L��Krc��tdd|���\}}tj|��tj|��|S)Nr r!)r"rr#)rr%r&�remover's   r�invalid_textfiler.9s9���f�X�7�C�C�C�H�B���H�R�L�L�L��I�d�O�O�O��Krc� �ttzSr)�	http_path�	http_filerrrrrAs
���Y��rc� �ttzSr)�
http_fakepath�
http_fakefilerrr�invalid_httpurlr5Es
����&�&rc��tSr)r0rrr�
valid_baseurlr7I����rc��tSr)r3rrr�invalid_baseurlr:M����rc��tSr)r1rrr�valid_httpfiler=Qr8rc��tSr)r4rrr�invalid_httpfiler?Ur;rc�D�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
S)�TestDataSourceOpenc�h�t��|_tj|j��|_dSr�r�tmpdir�
datasource�
DataSource�ds��selfs r�setup_methodzTestDataSourceOpen.setup_methodZ�%���i�i����'���4�4����rc�2�t|j��|`dSr�rrDrGrHs r�teardown_methodz"TestDataSourceOpen.teardown_method^����t�{�����G�G�Grc��|j�t����}t|��|���dSr)rG�openrrr&)rI�fhs  r�test_ValidHTTPz!TestDataSourceOpen.test_ValidHTTPbs5��
�W�\�\�-�/�/�
*�
*�������
���
�
�
�
�
rc���t��}tt|jj|��	|j�|��dS#t$r!}t|jdu��Yd}~dSd}~wwxYwr)r5r	�OSErrorrGrQr�errno)rIr�es   r�test_InvalidHTTPz#TestDataSourceOpen.test_InvalidHTTPgs��������g�t�w�|�S�1�1�1�	%��G�L�L���������	%�	%�	%��A�G�t�O�$�$�$�$�$�$�$�$�$�����	%���s�A�
A7�A2�2A7c�^�tt|jjt	����dSr)r	rrG�_cacher5rHs r�test_InvalidHTTPCacheURLErrorz0TestDataSourceOpen.test_InvalidHTTPCacheURLErrorps$���h�����0A�0A�B�B�B�B�Brc��t|j��}|j�|��}t	|��|���dSr)r+rDrGrQrr&)rI�
local_filerRs   r�test_ValidFilez!TestDataSourceOpen.test_ValidFiless@��#�D�K�0�0�
�
�W�\�\�*�
%�
%�������
���
�
�
�
�
rc�n�t|j��}tt|jj|��dSr)r.rDr	rUrGrQ)rI�invalid_files  r�test_InvalidFilez#TestDataSourceOpen.test_InvalidFileys-��'���4�4���g�t�w�|�\�:�:�:�:�:rc���	ddl}n##t$rtj��YnwxYwtj�|jd��}|�|d��}|�	t��|���|j�|��}|�
��}|���tt|��dS)Nrz
foobar.txt.gz�w)�gzip�ImportError�pytest�skipr%r*�joinrDrQ�write�
magic_liner&rG�readliner)rIrd�filepath�fp�results     r�test_ValidGzipFilez%TestDataSourceOpen.test_ValidGzipFile}s���	��K�K�K�K���	�	�	��K�M�M�M�M�M�	�����7�<�<���_�=�=��
�Y�Y�x��
%�
%��
�������
���
�
�
�
�W�\�\�(�
#�
#��������
���
�
�
��Z��(�(�(�(�(���'�'c���	ddl}n##t$rtj��YnwxYwtj�|jd��}|�|d��}|�	t��|���|j�
|��}|���}|���tt|��dS)Nrzfoobar.txt.bz2rc)�bz2rerfrgr%r*rhrD�BZ2Filerirjr&rGrQrkr)rIrrrlrmrns     r�test_ValidBz2Filez$TestDataSourceOpen.test_ValidBz2File�s���	��J�J�J�J���	�	�	��K�M�M�M�M�M�	�����7�<�<���-=�>�>��
�[�[��3�
'�
'��
�������
���
�
�
�
�W�\�\�(�
#�
#��������
���
�
�
��Z��(�(�(�(�(rpN)�__name__�
__module__�__qualname__rJrNrSrXr[r^rarortrrrrArAYs�������5�5�5�������
%�%�%�C�C�C����;�;�;�)�)�)� )�)�)�)�)rrAc�2�eZdZd�Zd�Zd�Zd�Zd�Zd�ZdS)�TestDataSourceExistsc�h�t��|_tj|j��|_dSrrCrHs rrJz!TestDataSourceExists.setup_method�rKrc�2�t|j��|`dSrrMrHs rrNz$TestDataSourceExists.teardown_method�rOrc�l�t|j�t������dSr)rrG�existsrrHs rrSz#TestDataSourceExists.test_ValidHTTP�s(�������}���/�/�0�0�0�0�0rc�n�t|j�t����d��dS�NF)rrGr}r5rHs rrXz%TestDataSourceExists.test_InvalidHTTP�s,���T�W�^�^�O�$5�$5�6�6��>�>�>�>�>rc�"�t|j��}t|j�|����t��}t|��}t|j�|����t
|��dSr)r+rDrrGr}rr)rIr�localdirs   rr^z#TestDataSourceExists.test_ValidFile�ss�� ���-�-�������w�'�'�(�(�(��9�9�� ��*�*�������w�'�'�(�(�(��x�����rc�~�t|j��}t|j�|��d��dSr)r.rDrrGr}�rIrs  rraz%TestDataSourceExists.test_InvalidFile�s5��"�4�;�/�/���T�W�^�^�G�,�,�e�4�4�4�4�4rN)	rurvrwrJrNrSrXr^rarrrryry�sn������5�5�5����1�1�1�?�?�?����5�5�5�5�5rryc�>�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	S)
�TestDataSourceAbspathc��tj�t����|_tj|j��|_dSr)r%r*�abspathrrDrErFrGrHs rrJz"TestDataSourceAbspath.setup_method�s3���g�o�o�g�i�i�0�0����'���4�4����rc�2�t|j��|`dSrrMrHs rrNz%TestDataSourceAbspath.teardown_method�rOrc�^�tt����\}}}}}}tj�|j||�tj���d����}t||j	�
t������dS�N�/)r
rr%r*rhrD�strip�seprrGr�)rI�scheme�netloc�upath�pms�qry�frg�
local_paths        rrSz$TestDataSourceAbspath.test_ValidHTTP�s���/7�
���/H�/H�,����s�C���W�\�\�$�+�v�"'�+�+�b�f�"5�"5�";�";�C�"@�"@�B�B�
��Z��������!A�!A�B�B�B�B�Brc��t|j��}tj�|��d}t||j�|����t||j�|����dS�N���)r+rDr%r*�splitrrGr�)rIr�tmpfilenames   rr^z$TestDataSourceAbspath.test_ValidFile�sk�� ���-�-���g�m�m�G�,�,�R�0���W�d�g�o�o�k�:�:�;�;�;��W�d�g�o�o�g�6�6�7�7�7�7�7rc�d�tt����\}}}}}}tj�|j||�tj���d����}t||j	�
t����k��dSr�)r
r5r%r*rhrDr�r�rrGr�r)rIr�r�r�r�r�r��invalidhttps        rrXz&TestDataSourceAbspath.test_InvalidHTTP�s���/7��8I�8I�/J�/J�,����s�C���g�l�l�4�;��#(�;�;�r�v�#6�#6�#<�#<�S�#A�#A�C�C����t�w���}���?�?�?�@�@�@�@�@rc�L�t|j��}t|j��}tj�|��d}t||j�|��k��t||j�|��k��dSr�)r+rDr%r*r�rrGr�)rI�invalidfilerr�s    rraz&TestDataSourceAbspath.test_InvalidFile�s���$�T�[�1�1�� ���-�-���g�m�m�G�,�,�R�0����t�w���{�;�;�;�<�<�<���t�w���w�7�7�7�8�8�8�8�8rc���t�j��}tj�|��d}�fd�}t|t
������j����t|t������j����t||����j����t||����j����tD]j}t|t|z����j����t||����j�����kdS)Nr�c�r��tj��j�|����Sr)r%r*r�rG��xrIs �r�<lambda>z7TestDataSourceAbspath.test_sandboxing.<locals>.<lambda>�s#���R�W�_�_�T�W�_�_�Q�-?�-?�@�@�r)r+rDr%r*r�rr�
startswithr5�malicious_filesr0)rIrr��tmp_path�fns`    r�test_sandboxingz%TestDataSourceAbspath.test_sandboxing�sP��� ���-�-���g�m�m�G�,�,�R�0��@�@�@�@��������)�)�4�4�T�[�A�A�B�B�B�����*�*�+�+�6�6�t�{�C�C�D�D�D�����!�!�,�,�T�[�9�9�:�:�:�����%�%�0�0���=�=�>�>�>�!�	:�	:�B��H�H�Y�r�\�*�*�5�5�d�k�B�B�C�C�C��H�H�R�L�L�+�+�D�K�8�8�9�9�9�9�	:�	:rc�:�tj}	dt_|���|���|���|���|���|t_dS#|t_wxYw�N�\)r%r�rSr^rXrar��rI�orig_os_seps  r�test_windows_os_sepz)TestDataSourceAbspath.test_windows_os_sep�s����f��	!��B�F����!�!�!����!�!�!��!�!�#�#�#��!�!�#�#�#�� � �"�"�"� �B�F�F�F��[�B�F� � � � s�A0B�BN)rurvrwrJrNrSr^rXrar�r�rrrr�r��s�������5�5�5����C�C�C�8�8�8�A�A�A�9�9�9�:�:�:�
!�
!�
!�
!�
!rr�c�,�eZdZd�Zd�Zd�Zd�Zd�ZdS)�TestRepositoryAbspathc��tj�t����|_tjt��|j��|_dSr)	r%r*r�rrDrE�
Repositoryr7�reposrHs rrJz"TestRepositoryAbspath.setup_method�s9���g�o�o�g�i�i�0�0����*�=�?�?�D�K�H�H��
�
�
rc�2�t|j��|`dSr�rrDr�rHs rrNz%TestRepositoryAbspath.teardown_method����t�{�����J�J�Jrc�l�tt����\}}}}}}tj�|jj||�tj���d����}|j�	t����}t||��dSr�)r
rr%r*rhr��	_destpathr�r�r�r=r)	rIr�r�r�r�r�r�r�rls	         rrSz$TestRepositoryAbspath.test_ValidHTTPs���/7�
���/H�/H�,����s�C���W�\�\�$�*�"6��"'�+�+�b�f�"5�"5�";�";�C�"@�"@�B�B�
��:�%�%�n�&6�&6�7�7���Z��*�*�*�*�*rc�n���fd�}t|t������j����tD]j}t|t
|z����j����t||����j�����kdS)Nc�r��tj��j�|����Sr)r%r*r�r�r�s �rr�z7TestRepositoryAbspath.test_sandboxing.<locals>.<lambda>s%���R�W�_�_�T�Z�-?�-?��-B�-B�C�C�r)rr=r�rDr�r0)rIr�r�s`  rr�z%TestRepositoryAbspath.test_sandboxing
s����C�C�C�C������)�)�*�*�5�5�d�k�B�B�C�C�C�!�	:�	:�B��H�H�Y�r�\�*�*�5�5�d�k�B�B�C�C�C��H�H�R�L�L�+�+�D�K�8�8�9�9�9�9�	:�	:rc���tj}	dt_|���|���|t_dS#|t_wxYwr�)r%r�rSr�r�s  rr�z)TestRepositoryAbspath.test_windows_os_sepsW���f��	!��B�F����!�!�!�� � �"�"�"� �B�F�F�F��[�B�F� � � � s�4A�AN)rurvrwrJrNrSr�r�rrrr�r��sb������I�I�I����+�+�+�:�:�:�!�!�!�!�!rr�c�2�eZdZd�Zd�Zd�Zd�Zd�Zd�ZdS)�TestRepositoryExistsc��t��|_tjt	��|j��|_dSr)rrDrEr�r7r�rHs rrJz!TestRepositoryExists.setup_methods+���i�i����*�=�?�?�D�K�H�H��
�
�
rc�2�t|j��|`dSrr�rHs rrNz$TestRepositoryExists.teardown_method#r�rc�|�t|j��}t|j�|����dSr)r+rDrr�r}r�s  rr^z#TestRepositoryExists.test_ValidFile's5�� ���-�-����
�!�!�'�*�*�+�+�+�+�+rc�~�t|j��}t|j�|��d��dSr)r.rDrr�r}r�s  rraz%TestRepositoryExists.test_InvalidFile,s7��"�4�;�/�/���T�Z�&�&�w�/�/��7�7�7�7�7rc�l�t|j�t������dSr)rr�r}rrHs r�test_RemoveHTTPFilez(TestRepositoryExists.test_RemoveHTTPFile0s*����
�!�!�-�/�/�2�2�3�3�3�3�3rc�8�t��}t|��\}}}}}}tj�|jj|��}tj|d��t|��}	t|j�
|	����dS)Ni�)rr
r%r*rhr�r��mkdirr+rr})
rI�	localfiler�r�r�r�r�r�r�rs
          r�test_CachedHTTPFilez(TestRepositoryExists.test_CachedHTTPFile3s���!�O�O�	�08�	�/B�/B�,����s�C���W�\�\�$�*�"6��?�?�
�
���V�$�$�$� ��,�,����
�!�!�'�*�*�+�+�+�+�+rN)	rurvrwrJrNr^rar�r�rrrr�r�sq������I�I�I����,�,�,�
8�8�8�4�4�4�	,�	,�	,�	,�	,rr�c� �eZdZd�Zd�Zd�ZdS)�TestOpenFuncc�,�t��|_dSr)rrDrHs rrJzTestOpenFunc.setup_method@s���i�i����rc�.�t|j��dSr)rrDrHs rrNzTestOpenFunc.teardown_methodCs���t�{�����rc��t|j��}tj||j���}t	|��|���tj|��}t	|��|���dS)N)�destpath)r+rDrErQrr&)rIr]rms   r�test_DataSourceOpenz TestOpenFunc.test_DataSourceOpenFsj��#�D�K�0�0�
�
�_�Z�$�+�
>�
>�
>�������
���
�
�
�
�_�Z�
(�
(�������
���
�
�
�
�
rN)rurvrwrJrNr�rrrr�r�?sA������ � � ����	�	�	�	�	rr�c�X�tj��}|`|���dSr)rErF�
_istmpdest�__del__)rGs r�test_del_attr_handlingr�Qs,��
�	�	 �	 �B�	�
��J�J�L�L�L�L�Lrr)0r%rf�tempfilerrr�shutilr�numpy.lib._datasource�lib�_datasourcerE�
numpy.testingrrr	�urllib.request�requestr�urllib.parser
�urllib.errorrrrrrr0r1r3r4r�rjr+r.rr5r7r:r=r?rAryr�r�r�r�r�rrr�<module>r�s���	�	�	�	�
�
�
�
�9�9�9�9�9�9�9�9�9�9�������*�*�*�*�*�*�*�*�*�>�>�>�>�>�>�>�>�>�>�'�'�'�'�'�'�!�!�!�!�!�!�!�!�!�!�!�!�4�4�4�4���*�*�*�)�)�)�
%�	��	�+�
��
�@�@�@��*�
����������'�'�'�������������B)�B)�B)�B)�B)�B)�B)�B)�J5�5�5�5�5�5�5�5�<>!�>!�>!�>!�>!�>!�>!�>!�B!�!�!�!�!�!�!�!�B,�,�,�,�,�,�,�,�B��������$
�
�
�
�
r

Youez - 2016 - github.com/yon3zu
LinuXploit