403Webshell
Server IP : 35.80.110.71  /  Your IP : 216.73.216.52
Web Server : Apache/2.4.58 (Ubuntu)
System : Linux ip-172-31-21-44 6.17.0-1019-aws #19~24.04.1-Ubuntu SMP Tue Jun 23 18:53:06 UTC 2026 x86_64
User : ubuntu ( 1000)
PHP Version : 8.3.31
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /lib/python3/dist-packages/IPython/utils/tests/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/IPython/utils/tests/__pycache__/test_path.cpython-312.pyc
�

}�e�>��L�dZddlZddlZddlZddlZddlZddlmZddlm	Z	ddl
mZmZddl
mZddlZddlmZddlZddlmZdd	lmZdd
lmZmZmZddlmZddlmZ	ddlZejPZ)ejT�Z+ee+d�Z,d�Z-d�Z.d�Z/d�Z0ejbd��Z2ejfjid�Z5ee5d���Z6ee5d���Z7ee5d���Z8e5d��Z9ee5d���Z:ee5d���Z;e5d��Z<e5d��Z=e5d��Z>e5d��Z?d �Z@ej0d!��ZAej2d"��ZBGd#�d$ej��ZDe5d%��ZEed&��ZFGd'�d(ej��ZGejfj�d)gd*��d+��ZIed,��ZJGd-�d.ej��ZKy#e $rMddl!Z!d
Z"e!jFe"�ejHe"<	ddlZn#e $rddl%Zd\e_&e_'YnwxYwY���wxYw)/zTests for IPython.utils.path.py�N)�contextmanager)�reload)�abspath�join)�patch)�TemporaryDirectory)�paths)�
decorators)�onlyif_unicode_paths�skip_if_not_win32�
skip_win32)�
make_tempfile��path�winreg)NN�
home_test_dirc�r�tjtjjtd��y)zJSetup testenvironment for the module:

    - Adds dummy home dir tree
    �ipythonN)�os�makedirsrr�
HOME_TEST_DIR���?/usr/lib/python3/dist-packages/IPython/utils/tests/test_path.py�setup_moduler9s���K�K������]�I�6�7rc�6�tjt�y)zOTeardown testenvironment for the module:

    - Remove dummy home dir tree
    N)�shutil�rmtree�TMP_TEST_DIRrrr�teardown_moduler Cs���M�M�,�rc���tj�tjtj
tjtjtj�fay)aASetup testenvironment for some functions that are tested
    in this module. In particular this functions stores attributes
    and other things that we need to stub in some test functions.
    This needs to be done on a function level and not module level because
    each testfunction needs a pristine environment.
    N)�env�copyr�name�sys�platformr�get_home_dir�IPython�__file__�getcwd�oldstuffrrr�setup_environmentr,Ns:�����
�B�G�G�S�\�\�4�3D�3D�g�FV�FV�XZ�Xa�Xa�Xc�d�Hrc�F�t\}t_t_t
_t_}tj|�tt
�tt�D]}||vs�t|=�tj|�ttd�rt`yy)zJRestore things that were remembered by the setup_environment function
    �frozenN)r+rr$r%r&rr'r(r)�chdirr�listr"�update�hasattrr.)�oldenv�old_wd�keys   r�teardown_environmentr6Xsy��T\�P�V�R�W�c�l�D�$5�w�7G���H�H�V��
�4�L��C�y����f���C����J�J�v���s�H���J�rc#�<K�t�d��t�y�w�N)r,r6rrr�environmentr9hs������	���s�r9c��tj�}dt_t	ttd��t_tj�}||k(sJ�y)z1Testcase for py2exe logic, un-compressed lib
    TzLib/IPython/__init__.pyN)	rr'r%r.rrrr(r)��unfrozen�home_dirs  r�test_get_home_dir_1r>rsL��
� � �"�H��C�J��t�M�3L�M�N�G��� � �"�H��x���rc���tj�}dt_t	ttd��j�t_	tjd�}||k(sJ�y)z.Testcase for py2exe logic, compressed lib
    TzLibrary.zip/IPython/__init__.pyN)
rr'r%r.rrr�lowerr(r)r;s  r�test_get_home_dir_2rA�sU��
� � �"�H��C�J��t�M�3T�U�V�\�\�^�G��� � ��&�H��x���rc��ttd<tjd�}|tjjtd�k(sJ�y)z get_home_dir() uses $HOME if set�HOMETN)rr"rr'r�realpath)r=s r�test_get_home_dir_3rE�s>�� �C��K�� � ��&�H��r�w�w�'�'��F��4�4�4�4rc�L�dtvrtd=tjd�}y)z.get_home_dir() still works if $HOME is not setrCFN)r"rr')�homes r�test_get_home_dir_4rH�s!����}�#�f�+����U�#�Drc��ttdz�td<dt_tjtjtjd�y)z@raise HomeDirError if $HOME is specified, but not a writable dir�garbagerC�posixTN)
rrr"rr$�pytest�raisesr�HomeDirErrorr'rrr�test_get_home_dir_5rO�s:���-�	�1�2�C��K��B�G�
�M�M�$�#�#�T�%6�%6��=rc��dt_dD]}tj|d��Gd�d�}t	j
td|���5t	j
tdtt�g��5tj�}ddd�ddd�tt�k(sJ�y#1swY�&xYw#1swY�*xYw)	z~Using registry hack for 'My Documents', os=='nt'

    HOMESHARE, HOMEDRIVE, HOMEPATH, USERPROFILE and others are missing.
    �nt)rC�	HOMESHARE�	HOMEDRIVE�HOMEPATH�USERPROFILENc��eZdZd�Zd�Zd�Zy)� test_get_home_dir_8.<locals>.keyc��yr8r��selfs r�	__enter__z*test_get_home_dir_8.<locals>.key.__enter__����rc��yr8rrYs r�Closez&test_get_home_dir_8.<locals>.key.Close�r\rc��yr8r)�args�kwargss  r�__exit__z)test_get_home_dir_8.<locals>.key.__exit__�r\rN)�__name__�
__module__�__qualname__r[r^rbrrrr5rW�s��	�	�	rr5�OpenKey)�return_value�QueryValueEx)rr$r"�popr�object�wregrrrr')r5r=s  r�test_get_home_dir_8rl�s����B�G�L�������T�����
���d�I�C�E�	:�'�	���d�N�'�-�:P�9Q�	R�'��$�$�&��'�'��w�}�-�-�-�-�'�'��'�'�s$�+C�?B9�C�9C	�>C�Cc�p�tt�d�t_d�t_dt_dt_tjdd�tjdd�tjdd�tj�tjjd	d
�k(sJ�y)z!test_get_xdg_dir_0, check xdg_dirc��y)NTrrs r�<lambda>z$test_get_xdg_dir_0.<locals>.<lambda>���rc��y)N�	somewhererrrrroz$test_get_xdg_dir_0.<locals>.<lambda>�rprrK�linux2�IPYTHON_DIRN�
IPYTHONDIR�XDG_CONFIG_HOMErr�.config)rr�
_writable_dirr'rr$r%r&r"ri�get_xdg_dirrrrr�test_get_xdg_dir_0rz�sz���4�L�*�D��,�D���B�G��C�L��G�G�M�4� ��G�G�L�$���G�G��t�$����������k�9�!E�E�E�Erc��tt�d�t_dt_dt
_tjdd�tjdd�tjdd�tj��J�y)z-test_get_xdg_dir_1, check nonexistent xdg_dirc��tSr8�rrrrroz$test_get_xdg_dir_1.<locals>.<lambda>�����rrKrsrtNrurv)
rrr'rr$r%r&r"riryrrr�test_get_xdg_dir_1r�sa���4�L�.�D���B�G��C�L��G�G�M�4� ��G�G�L�$���G�G��t�$�����%�%�%rc���tt�d�t_dt_dt
_tjdd�tjdd�tjdd�tjjtj�d�}tjj|�stj|�tj�|k(sJ�y)	z6test_get_xdg_dir_2, check xdg_dir default to ~/.configc��tSr8r}rrrroz$test_get_xdg_dir_2.<locals>.<lambda>�r~rrKrsrtNrurvrw)
rrr'rr$r%r&r"rir�existsrry��cfgdirs r�test_get_xdg_dir_2r��s����4�L�.�D���B�G��C�L��G�G�M�4� ��G�G�L�$���G�G��t�$�
�7�7�<�<��)�)�+�Y�7�F�
�7�7�>�>�&�!�
���F�������'�'�'rc��tt�d�t_dt_dt
_tjdd�tjdd�tjdd�tjjtj�d�}tj|d	�
�tj��J�y)z?test_get_xdg_dir_3, check xdg_dir not used on non-posix systemsc��tSr8r}rrrroz$test_get_xdg_dir_3.<locals>.<lambda>�r~rrQ�win32rtNrurvrwT)�exist_ok)rrr'rr$r%r&r"rirrryr�s r�test_get_xdg_dir_3r��s����4�L�.�D���B�G��C�L��G�G�M�4� ��G�G�L�$���G�G��t�$�
�7�7�<�<��)�)�+�Y�7�F��K�K���&�����%�%�%rc��tj�}tj�}t	j
|j|�}y)zVarious tests for filefindN)�tempfile�NamedTemporaryFiler	�get_ipython_dirr�filefindr$)�f�alt_dirs�ts   r�
test_filefindr��s2���#�#�%�A��$�$�&�H��
�
�a�f�f�h�'�Arc��t�5}tjjtj|�d�}tj
|�tjj|d�}tj|�}|j
�|j
�k(sJ�	ddd�y#1swYyxYw)Nzthis is my long path namezTHISIS~1)rrrr�get_long_path_namerr@)�tmpdir�	long_path�
short_path�evaluated_paths    r�test_get_long_path_name_win32r�s���	�	�
;���G�G�L�L��!8�!8��!@�B]�^�	�
���I���W�W�\�\�&�*�5�
��0�0��<���#�#�%����):�:�:�:�
;�
;�
;�s�B!B6�6B?c�<�tjd�}|dk(sJ�y)Nz
/usr/local)rr�)�ps r�test_get_long_path_namer�s ������-�A�����rc�:�eZdZejed���Zy)�TestRaiseDeprecationc��tj�}dt_tjdd�tjdd�tjdd�|td<tjj|d�}tj|d�	ttjj|d�d	d
��j�tjd�|jtd
�5t!j"�}ddd�tjdd�y#t$rY�UwxYw#1swY�/xYw)NrKrtrurvrCz.ipythonim�_foo_�w�utf-8��encodingz0I can't create directories that I can't write tozis not a writable location)r��mkdtemprr$r"rirr�mkdir�open�closerL�skip�IOError�assertWarnsRegex�UserWarningr	r�)rZr��ipdirs   r�test_not_writable_ipdirz,TestRaiseDeprecation.test_not_writable_ipdirs����!�!�#��������
�t�$�����d�#����!�4�(���F�������V�Z�0��
������	L�������e�W�-�s�W�E�K�K�M�
�K�K�J�K�
�
"�
"�;�0L�
M�	,��)�)�+�E�	,����
�t�$���	��	��	,�	,�s�":D;�E
�;	E�E�
EN)rcrdre�decr
�with_environmentr�rrrr�r�s ���^�^��%���%rr�c��tjt�td�5t	j
d�dk(sJ�t	j
d�dk(sJ�	ddd�td�5t	j
d�dk(sJ�t
jttj
d�ddd�t
jttj
d�t
jttj
d�d}t|�5t	j
d�|k(sJ�t	j
d�|k(sJ�t
jttj
d�t
jttj
d�ddd�y#1swY��PxYw#1swY��xYw#1swYyxYw)Nzfoo.py�foozfoo with spaces.pyzfoo with spacesz"foo with spaces.py"z'foo with spaces.py')	rr/rrr�get_py_filenamerLrMr�)�true_fns r�test_get_py_filenamer�6sg���H�H�\��	�x�	 �7��#�#�H�-��9�9�9��#�#�E�*�h�6�6�6�7�
�u�	�?��#�#�E�*�e�3�3�3��
�
�g�t�3�3�X�>�?��M�M�'�4�/�/��7�
�M�M�'�4�/�/��:�"�G�	�w�	�M��#�#�$5�6�'�A�A�A��#�#�$8�9�W�D�D�D��
�
�g�t�3�3�5K�L��
�
�g�t�3�3�5K�L�	M�M�7�7��?�?��M�M�s%�5F)�.AF6�BG�)F3�6G�Gc�r�	tjd�y#t$r}t|�Yd}~yd}~wwxYw)z�When a file doesn't exist, the exception raised should be safe to call
    str() on - i.e. in Python 2 it must only have ASCII characters.

    https://github.com/ipython/ipython/issues/875
    u
fooéè.pyN)rr�r��str)�exs r�test_unicode_in_filenamer�Hs.������\�*�����B�����s��	6�1�6c�r�eZdZed��Zed��Zeed���Zd�Zd�Z	e
d��Zed��Z
y)	�
TestShellGlobc��gd�|_gd�|_|j|jz|_t�|_|jj
}|j
�5|jD]<}ttjj||�dd��j��>	ddd�y#1swYyxYw)N)�a0�a1�a2)�0b�1b�2br�r�r�)�filenames_start_with_a�filenames_end_with_b�	filenamesr�tempdirr$�
in_tempdirr�rrrr�)�cls�td�fnames   r�
setUpClasszTestShellGlob.setUpClassXs���%7��"�#5�� ��2�2�S�5M�5M�M��
�(�*���
�[�[�
�
��
�^�^�
�	M����
M���R�W�W�\�\�"�e�,�c�G�D�J�J�L�
M�	M�	M�	M�s
�&AB<�<Cc�8�|jj�yr8�r��cleanup)r�s r�
tearDownClasszTestShellGlob.tearDownClasses�������rc#��K�tj�}	tj|jj�d��tj|�y#tj|�wxYw�wr8)rr*r/r�r$)r��saves  rr�zTestShellGlob.in_tempdirisG�����y�y�{��	��H�H�S�[�[�%�%�&���H�H�T�N��B�H�H�T�N�s�A5�-A�A5�A2�2A5c��|j�5ttj|��t|�k(sJ�	ddd�y#1swYyxYwr8)r��sortedr�	shellglob�rZ�patterns�matchess   r�check_matchzTestShellGlob.check_matchssE��
�_�_�
�	G��$�.�.��2�3�v�g��F�F�F�	G�	G�	G�s�-A�Ac��dg|jfdg|jfdgdgfgd�|j|jz|jzdgzfdg|jfgS)N�*�a*�*c)r�r�z*br��a[012])r�r�r�rYs r�common_caseszTestShellGlob.common_casesxs����U�D�N�N�#��V�T�0�0�1��V�d�V��
$�d�n�n�(,�(C�(C�'D�(,�(A�(A�'B�*.��'/�
0��Z��4�4�5�	
�		
rc��|j�dgdgfddgdg|jzfdgdgfgzD]\}}|j||��y)N�\*r��a\*r��a\[012]r��r�r�r�r�s   r�test_match_posixzTestShellGlob.test_match_posix�sl��#'�#4�#4�#6���3�%� ��$��$��$�*E�*E�!E�F����z�*�:�$�	0��X�w�

���X�w�/�	0rc��|j�ddgdg|jzfdgdgfgzD]\}}|j||��y)Nr�r�r�r�r�s   r�test_match_windowsz TestShellGlob.test_match_windows�sb��#'�#4�#4�#6��$��&��D�,G�,G�!G�H���
�|�,�:�$�	0��X�w�
���X�w�/�	0rN)rcrdre�classmethodr�r�rr�r�r�r
r�rr�rrrr�r�Vsy���
M��
M�����������G�


��0��0��0��0rr�zglobstr, unescaped_globstr))z
\*\[\!\]\?z*[!]?)z\\*r�)z\\\*r�)z\\a�\a)r�r�c�8�tj|�|k(sJ�yr8)r�
unescape_glob)�globstr�unescaped_globstrs  r�test_unescape_globr��s�����g�&�*;�;�;�;rc��t�5}tjj|d�}tj|�tjj|�sJ�tj|�tjj|d�}t
|dd��j�tjt�5tj|�ddd�ddd�y#1swY�xYw#1swYyxYw)Nu∂iruƒiler�r�r�)rrrr�ensure_dir_exists�isdirr�r�rLrMr�)r��dr�s   r�test_ensure_dir_existsr��s���	�	�&���G�G�L�L��W�%�����q�!��w�w�}�}�Q�������q�!��G�G�L�L��W�%���Q��g�&�,�,�.�
�]�]�7�
#�	&��"�"�1�%�	&�&�&�	&�	&��&�&�s$�CC?�C3�"C?�3C<	�8C?�?Dc��eZdZd�Zd�Zd�Zd�Zd�Zd�Ze	d��Z
e	d��Ze	d	��Ze	d
��Z
ed��Zd�Zy
)�TestLinkOrCopyc���t�|_|jd�|_t	|jdd��5}|jd�ddd�y#1swYyxYw)N�srcr�r�r�z
Hello, world!)rr��dstr�r��write)rZr�s  r�setUpzTestLinkOrCopy.setUp�sN��)�+����8�8�E�?���
�$�(�(�C�'�
2�	%�a�
�G�G�O�$�	%�	%�	%�s�A�A"c�8�|jj�yr8r�rYs r�tearDownzTestLinkOrCopy.tearDown�s�������rc�j�tjj|jjg|���Sr8)rrrr�r$)rZr`s  rr�zTestLinkOrCopy.dst�s$���w�w�|�|�D�L�L�-�-�5��5�5rc��tj|�jtj|�jk7s
J|�d|�d���y)N� and z do reference the same indoes�r�stat�st_ino�rZ�a�bs   r�assert_inode_not_equalz%TestLinkOrCopy.assert_inode_not_equal�s;���G�G�A�J��������!2�!2�2�	=�78�!�<�	=�2rc��tj|�jtj|�jk(s
J|�d|�d���y)Nr�z! do not reference the same indoesrrs   r�assert_inode_equalz!TestLinkOrCopy.assert_inode_equal�s=���G�G�A�J��������!2�!2�2�	A�;<�a�@�	A�2rc���t|d�5}t|d�5}|j�|j�k(sJ�	ddd�ddd�y#1swY�xYw#1swYyxYw)N�rb)r��read)rZrr�a_f�b_fs     r�assert_content_equalz#TestLinkOrCopy.assert_content_equal�sa��
�!�T�]�	0�c��a���
0�#��x�x�z�S�X�X�Z�/�/�/�
0�	0�	0�
0�
0��	0�	0�s!�
A�$A�A�A	�A�A%c��|jd�}tj|j|�|j	|j|�y�N�target)r�r�link_or_copyr�r�rZr�s  r�test_link_successfulz#TestLinkOrCopy.test_link_successful�s8���h�h�x� �����$�(�(�C�(�������#�.rc�:�|jd�}tj|�tj|j
|�|jdtjj
|j
��}|j|j
|�y)N�some_dir)r�rr�rrr��basenamer)rZr��expected_dsts   r�test_link_into_dirz!TestLinkOrCopy.test_link_into_dir�sf���h�h�z�"��
����
����$�(�(�C�(��x�x�
�B�G�G�,<�,<�T�X�X�,F�G��������,�7rc���|jd�}t|dd��j�tj|j
|�|j
|j
|�y)Nrr�r�r�)r�r�r�rrr�rrs  r�test_target_existsz!TestLinkOrCopy.test_target_exists�sM���h�h�x� ���S�#��(�.�.�0����$�(�(�C�(�������#�.rc�:�tj}	t`|jd�}tj|j
|�|j
|j
|�|j|j
|�|t_y#|t_wxYwr)r�linkr�rrr�rr)rZ�	real_linkr�s   r�test_no_linkzTestLinkOrCopy.test_no_link�sn���G�G�	�	 ����(�(�8�$�C����d�h�h��,��%�%�d�h�h��4��'�'����#�6��B�G��i�B�G�s�A/B
�

Bc��|jd�}tj|j|�|j	|j|�yr)r�rrr�rrs  r�test_windowszTestLinkOrCopy.test_windows�s8���h�h�x� �����$�(�(�C�(��!�!�$�(�(�C�0rc�P�|jd�}tj|j|�tj|j|�|j	|j|�tt
j|jj��ddgk(sJ�y)Nrr�)
r�rrr�rr�r�listdirr�r$rs  r�test_link_twicezTestLinkOrCopy.test_link_twice�sy���h�h�x� �����$�(�(�C�(����$�(�(�C�(�������#�.��b�j�j����!2�!2�3�4���8I�I�I�IrN)rcrdrer�r�r�rrrr
rrrrrr!r$rrrr�r��s���%��6�=�
A�
0�
�/��/�
�8��8��/��/��	 ��	 ��1��1�
Jrr�)L�__doc__rrr%r��unittest�
contextlibr�	importlibr�os.pathrr�
unittest.mockrrLrr(r	�IPython.testingr
r��IPython.testing.decoratorsrrr
�IPython.testing.toolsr�
IPython.utilsrrrk�ImportError�types�wr_name�
ModuleType�modules�_winregrfrh�environr"r�rrrr r,r6�fixturer9�mark�usefixturesr�r>rArErHrOrlrzrr�r�r�r�r��TestCaser�r�r�r��parametrizer�r�r�rrr�<module>r;s���%�

�
�
���%��!��
�'���-���
0��
:��"	�j�j���x���!���\�?�3�
�
8� �e�� �������;�;�*�*�=�9����
 ���
 ���	 ���	 ���5���5��$��$���>���>���.���.�.�F��F��	&��	&��
(��
(��&��&�(����;��;�������
%�8�,�,�%�4�M��M�"�
��
�@0�H�%�%�@0�F����� ��	�<�	�<��	&��	&�JJ�X�&�&�JJ��c�:���G�+�5�+�+�G�4�C�K�K���:����:��.:�*���t�(�	:��:�s6�"G�*H#�<H�H#�H�H#�H�H#�"H#

Youez - 2016 - github.com/yon3zu
LinuXploit