����JFIF���������
1#@!#!123s
D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
usr
/
lib
/
python3.10
/
test
/
support
/
__pycache__
/
Filename :
os_helper.cpython-310.pyc
back
Copy
o �����*�g�M������������������� ���@���s��d�dl�Zd�dlZd�dlZd�dlZd�dlZd�dlZd�dlZd�dlZd�dl Z d�dl Z ejdkr0dZndZd� ee����Zed�ZejdkrMd�dlZe�de�ZdZejd kre���jd kr~ed�Zz e�e�����W�n �eyq���Y�n1w�edee���f���dZn#ejdkr�z d �e�����W�n�ey����ed�e���d��ZY�nw� �dZdD�]Zze�e�e��ekr�e�W�n �ey����Y�q�w�eZ�e� ��Z!dZ"dD�]Zz e�e�����W�q��ey����e�e�e�Z"Y��nw�er�ee�Z#ndZ#e#p�eZ$dd��Z%da&dd��Z'dd��Z(da)dd��Z*dd��Z+dd��Z,ej�-d��r.dGd!d"�Z.d#d$��Z/d%d&��Z0d'd(��Z1d)d*��Z2nej,Z/ej3Z0d+d(��Z1d,d*��Z2d-d.��Z3d/d0��Z4ej5dHd1d2��Z6ej5dGd3d4��Z7ej5dId6d7��Z8d8d9��Z9ej5d:d;���Z:d<d=��Z;G�d>d?��d?�Z<d@dA��Z=e>edB��r�ej5dCdD���Z?G�dEdF��dFej@jA�ZBdS�)J�����N�javaz$testz@testz {}_{}_tmpu���-àòɘŁğ�darwin�NFD�nt����u���-共Ł♡ͣ�ztWARNING: The filename %r CAN be encoded by the filesystem encoding (%s). Unicode filename tests may not be effective�����s���-��surrogateescape��)����æu���İu���Łu���φu���Кu���אu���،u���تu���ก���� u���€)s����w�r���s������s����s�����c������������������C���s8���t�td�}�z |����W�|�����tt��S�|�����tt��w�)z` Create an invalid file descriptor by opening and closing a file and return its fd. �wb)�open�TESTFN�fileno�close�unlink��file��r����-/usr/lib/python3.10/test/support/os_helper.py�make_bad_fd����s��� � r���c��������������� ���C���s^���t�d�urt�S�td�}�z t�t|���d}W�n�tttfy%���d}Y�|a�|S�w�t�|���|a�|S�)N�can_symlinkTF)�_can_symlinkr����os�symlink�OSError�NotImplementedError�AttributeError�remove)�symlink_path�canr���r���r���r�������s���� r���c�����������������C���� ���t���}d}|r |�S�t�|�|��S�)z8Skip decorator for tests that require functional symlinkz*Requires functional symlink implementation)r����unittest�skip��test�ok�msgr���r���r����skip_unless_symlink��������r(���c������������ ��� ���C���sL��dd�l�}�td�ur tS�ttd�sd}|a|S�dd�l}|����}|�j|d�\}}zsttd��D}z0t� |dd��t� |dd ��t� |� ��dd��|���}t� d |�}|d�u�pZt|�d��dk}W�n�tyg���d}Y�nw�W�d�����n1�srw���Y��W�tt��t|��t|��|a|S�W�tt��t|��t|��|a|S�tt��t|��t|��w�) Nr����setxattrF��dirr���s ���user.test�����s���trusted.foos���42z 2.6.(\d{1,2})�����'���)�tempfile� _can_xattr�hasattrr����platform�mkdtemp�mkstempr ���r���r*���r����release�re�match�int�groupr���r����rmdir) r0���r ���r3����tmp_dir�tmp_fp�tmp_name�fp�kernel_version�mr���r���r���� can_xattr����sL��� ������ rB���c�����������������C���r!���)zDSkip decorator for tests that require functional extended attributesz(no non-broken extended attribute support)rB���r"���r#���r$���r���r���r����skip_unless_xattr����r)���rC���c�������������� ���C���s(���zt�|���W�d�S��ttfy���Y�d�S�w��N)�_unlink�FileNotFoundError�NotADirectoryError��filenamer���r���r���r�������s ����r����winFc�����������������C���s����|�|��|r |}nt�j�|�\}}|pd}d}|dk�r9t��|�}|r&|s,d�S�||v�s,d�S�t�|��|d9�}|dk�stjd|�tdd��d�S�)N�.g����MbP?g�������?r���z)tests may fail, delete still pending for ������ stacklevel) r����path�split�listdir�time�sleep�warnings�warn�RuntimeWarning)�func�pathname�waitall�dirname�name�timeout�Lr���r���r����_waitfor����s$��� � � �r^���c�����������������C�������t�tj|���d�S�rD���)r^���r���r���rH���r���r���r���rE���������rE���c�����������������C���r_���rD���)r^���r���r;����rZ���r���r���r����_rmdir��r`���rb���c��������������������s>���ddl�m������fdd��t�|�dd��t��fdd�|���d�S�) Nr����� _force_runc��������������������s������|�t�j|��D�]L}t�j�|�|�}zt��|�j}W�n�ty7�}�ztd||f�tj d��d}W�Y�d�}~nd�}~ww�t �|�rLt�|dd����|t�j |��q��|t�j|��qd�S�)Nz-support.rmtree(): os.lstat(%r) failed with %sr���r���T�rY���)r���rQ���rO����join�lstat�st_moder����print�sys� __stderr__�stat�S_ISDIRr^���r;���r���)rO���r[����fullname�mode�exc�rd���� _rmtree_innerr���r���rr�����s$������� �_rmtree.<locals>._rmtree_innerTre���c��������������������s�����|�t�j|��S�rD���)r���r;���)�prc���r���r����<lambda>.��s����z_rmtree.<locals>.<lambda>)�test.supportrd���r^����rO���r���rq���r����_rmtree��s���rx���c�����������������C���s^���zdd�l�}W�n �ty���Y�|�S�w�|�t|��d��}|jj�|�|t|��}|r-|d�|��S�|�S�)Nr���r���)�ctypes�ImportError�create_unicode_buffer�len�windll�kernel32�GetLongPathNameW)rO���ry����buffer�lengthr���r���r���� _longpath0��s�����r����c��������������������sN���dd�l�}z|�|���W�d�S��ty���Y�nw���fdd�����|���t�|���d�S�)Nr���c�������������� ������s����ddl�m}�||�tj|��D�]5}tj�|�|�}zt�|�j}W�n�ty)���d}Y�nw�t � |�r;��|��||�tj|��q ||�tj|��q d�S�)Nr���rc���) rv���rd���r���rQ���rO���rf���rg���rh���r���rl���rm���r;���r���)rO���rd���r[���rn���ro����rr���r���r���rr���I��s���� �rs���)�shutil�rmtreer���r���r;���)rO���r����r���r����r���rx���A��s��� � c�����������������C�������|�S�rD���r���rw���r���r���r���r����Y������c�����������������C����$���zt�|���W�d�S��ty���Y�d�S�w�rD���)rb���rF���ra���r���r���r���r;���]��� ����r;���c�����������������C���r����rD���)rx���rF���rw���r���r���r���r����d��r����r����c�������������� ���c���s������ddl�}d}|�du�r|���}�d}tj�|��}�n-z t�|���d}W�n#�tyD�}�z|s,��tjd|��d|���t dd��W�Y�d}~nd}~ww�|rKt� ��}z|�V��W�|r^|t� ��kr`t|���dS�dS�dS�|ro|t� ��krpt|���w�w�w�) a���Return a context manager that creates a temporary directory. Arguments: path: the directory to create temporarily. If omitted or None, defaults to creating a temporary directory using tempfile.mkdtemp. quiet: if False (the default), the context manager raises an exception on error. Otherwise, if the path is specified and cannot be created, only a warning is issued. r���NFTz5tests may fail, unable to create temporary directory �: ����rM���)r0���r4���r���rO����realpath�mkdirr���rT���rU���rV����getpidr����)rO����quietr0����dir_createdrp����pidr���r���r����temp_dirk��s>���� ������ �r����c�������������� ���c���s������t����}zt��t�j�|����W�n#�ty3�}�z|s��tjd|��d|���tdd��W�Y�d}~nd}~ww�z t����V��W�t��|��dS�t��|��w�)ag��Return a context manager that changes the current working directory. Arguments: path: the directory to use as the temporary current working directory. quiet: if False (the default), the context manager raises an exception on error. Otherwise, it issues only a warning and keeps the current working directory the same. zBtests may fail, unable to change the current working directory to r����r����rM���N) r����getcwd�chdirrO���r����r���rT���rU���rV���)rO���r����� saved_dirrp���r���r���r���� change_cwd���s&���� �����r�����tempcwdc�������������� ���c���sv�����t�|�|d��*}t||d��}|V��W�d����n1�sw���Y��W�d����dS�W�d����dS�1�s4w���Y��dS�)a��� Context manager that temporarily creates and changes the CWD. The function temporarily changes the current working directory after creating a temporary directory in the current directory with name *name*. If *name* is None, the temporary directory is created using tempfile.mkdtemp. If *quiet* is False (default) and it is not possible to create or change the CWD, an error is raised. If *quiet* is True, only a warning is raised and the original CWD is used. )rO���r����)r����N)r����r����)r[���r����� temp_path�cwd_dirr���r���r����temp_cwd���s������"�r����c�����������������C���s(���t��|�t�jt�jB�t�jB��}t��|��dS�)z>Create an empty file. If the file already exists, truncate it.N)r���r ����O_WRONLY�O_CREAT�O_TRUNCr���)rI����fdr���r���r����create_empty_file���s���r����c�������������� ���c���sD�����t�j�|��s J��t��|�t�j�}z|V��W�t��|��dS�t��|��w�)z&Open a file descriptor to a directory.N)r���rO����isdirr ����O_RDONLYr���)rO����dir_fdr���r���r����open_dir_fd���s����r����c�������������� ���C���s����ddl�}|j|�d��0}|j}|���}||kr|���}ztj�||�W�W��d����S��ty9���Y�W�d����dS�w�1�s=w���Y��dS�)zODetects if the file system for the specified directory is case-insensitive.r���Nr+���F) r0����NamedTemporaryFiler[����upper�lowerr���rO����samefilerF���)� directoryr0����base� base_path� case_pathr���r���r����fs_is_case_insensitive���s������r����c�������������������@���s(���e�Zd�ZdZdd��Zdd��Zdd��ZdS�) �FakePathz.Simple implementing of the path protocol. c�����������������C���s ���||�_�d�S�rD���rw���)�selfrO���r���r���r����__init__������� zFakePath.__init__c�����������������C���s���d|�j��d�S�)Nz <FakePath �>rw����r����r���r���r����__repr__���s���zFakePath.__repr__c�����������������C���s0���t�|�jt�st�|�jt�rt|�jt�r|�j�|�jS�rD���)� isinstancerO���� BaseException�type� issubclassr����r���r���r���� __fspath__���s��� � �zFakePath.__fspath__N)�__name__� __module__�__qualname__�__doc__r����r����r����r���r���r���r���r�������s ����r����c������������ ������C���s���t�j�d�rzt�d�}�t|��d�W�S��ty���Y�nw�d}ttd�r4zt�d�}W�n �t y3���Y�nw�d}t�jdkrez d dl }|j�W�n�tt fyO���Y�nw�i�}|j|j|jfD�] }|�|d �||<�qZzMd }t|�D�],}zt�|�}W�n�t y��}�z |jtjkr���W�Y�d}~qld}~ww�t�|��|d7�}qlW�|dur�|j|j|jfD�] }|�|||���q�|S�|dur�|j|j|jfD�]}|�|||���q�w�w�) z/Count the number of open file descriptors. )�linux�freebsdz /proc/self/fdr.��������sysconf�SC_OPEN_MAXN�win32r���)rj���r3���� startswithr���rQ���r|���rF���r2���r����r����msvcrt�CrtSetReportModer���rz����CRT_WARN� CRT_ERROR� CRT_ASSERT�range�dup�errno�EBADFr���) �names�MAXFD� old_modesr�����report_type�countr�����fd2�er���r���r����fd_count���sv��� � � �� ���� �����r�����umaskc�������������� ���c���s0�����t��|��}zdV��W�t��|��dS�t��|��w�)z8Context manager that temporarily sets the process umask.N)r���r����)r�����oldmaskr���r���r���� temp_umask3��s ���� r����c�������������������@���sh���e�Zd�ZdZdd��Zdd��Zdd��Zdd ��Zd d��Zdd ��Z dd��Z dd��Zdd��Zdd��Z dd��ZdS�)�EnvironmentVarGuardz_Class to help protect the environment variable properly. Can be used as a context manager.c�����������������C���s���t�j|�_i�|�_d�S�rD���)r����environ�_environ�_changedr����r���r���r���r����B��s��� zEnvironmentVarGuard.__init__c�����������������C���s ���|�j�|�S�rD���)r�����r�����envvarr���r���r����__getitem__F��r����zEnvironmentVarGuard.__getitem__c�����������������C���s*���||�j�vr|�j�|�|�j�|<�||�j|<�d�S�rD����r����r�����get�r����r�����valuer���r���r����__setitem__I��s��� zEnvironmentVarGuard.__setitem__c�����������������C���s6���||�j�vr|�j�|�|�j�|<�||�jv�r|�j|=�d�S�d�S�rD���r����r����r���r���r����__delitem__O��s ��� �zEnvironmentVarGuard.__delitem__c�����������������C���s ���|�j����S�rD���)r�����keysr����r���r���r���r����V��r����zEnvironmentVarGuard.keysc�����������������C���� ���t�|�j�S�rD���)�iterr����r����r���r���r����__iter__Y��r����zEnvironmentVarGuard.__iter__c�����������������C���r����rD���)r|���r����r����r���r���r����__len__\��r����zEnvironmentVarGuard.__len__c�����������������C���s���||�|<�d�S�rD���r���r����r���r���r����set_��s���zEnvironmentVarGuard.setc�����������������C���s ���|�|=�d�S�rD���r���r����r���r���r����unsetb��r����zEnvironmentVarGuard.unsetc�����������������C���r����rD���r���r����r���r���r���� __enter__e��r����zEnvironmentVarGuard.__enter__c�����������������G���sF���|�j����D�]\}}|d�u�r||�jv�r|�j|=�q||�j|<�q|�jt_d�S�rD���)r�����itemsr����r���r����)r����� ignore_exc�k�vr���r���r����__exit__h��s��� �zEnvironmentVarGuard.__exit__N)r����r����r����r����r����r����r����r����r����r����r����r����r����r����r����r���r���r���r���r����=��s����r����)F)NF)r����F)C�collections.abc�collections� contextlibr����r���r7���rl���rj���rR���r"���rT���r[����TESTFN_ASCII�formatr�����TESTFN_UNICODEr3����unicodedata� normalize�TESTFN_UNENCODABLE�getwindowsversion�encode�getfilesystemencoding�UnicodeEncodeErrorri����decode�UnicodeDecodeError�FS_NONASCII� character�fsdecode�fsencode�UnicodeErrorr�����SAVEDCWD�TESTFN_UNDECODABLE�TESTFN_NONASCIIr���r���r���r���r(���r1���rB���rC���r���r����r^���rE���rb���rx���r����r;���r�����contextmanagerr����r����r����r����r����r����r����r����r2���r�����abc�MutableMappingr����r���r���r���r����<module>���s����� � �� ��!��� ! ! ( <