a �DOg���@sPddlZddlZddlZddlmZeee�Z ej Z gd�Z dd�Z dd�Zde vr�dZd Zdd lTzdd lmZe �d �Wney�Yn0ddlZzdd lmZWney�Yn0ddlZe �ee��[n�de v�rldZdZdd lTzdd lmZe �d �Wne�y"Yn0ddlZddlZe �ee��[zdd lmZWne�yhYn0ned��eejd<ddlmZmZmZm Z m!Z!m"Z"m#Z#m$Z$[ e d��r�e%�Z&dd�Z'e(�Z)e'dd�e'dd�e'dd�e'dd�e'dd�e'd d!�e'd"d#�e'd$d%�e'd&d'�e'd(d)�e'd*d+�e'd,d-�e'd.d/�e'd0d1�e'd0d2�e'd3d�e)Z*e(�Z)e'dd�e)Z+e(�Z)e'd4d5�e'd6d�e'd7d�e'd8d9�e'd8d:�e'd;d<�e)�,e�e'd=d>�e'd?d�e'd@d�e'dAdB�e dC��re dD��re'dEdC�e)Z-e(�Z)e'dd�e'dd�e'dd�e'dFdG�e'dHd�e dI��r`e'dJd�e'd d!�e'dKd�e'dLd�e'dd�e'd3d�e'dMd�e)Z.[)[[&['dZ/dNZ0dOZ1d�dRdS�Z2dTdU�Z3dVdW�Z4e �gdX��d�dZd[�Z5d\d]�Z6e �d[�e7ehe*k�r8e8ehe-k�r8d�dQdd_�d`da�Z9dbdc�Z:e �da�ddde�Z;dfdg�Zdldm�Z?dndo�Z@e �gdp��d�dqdr�ZAd�dsdt�ZBddulmCZCmDZDGdvdw�dweC�ZEdxdy�ZFeF�ZG[Fd�dzd{�ZHedkZIe �d|�eI�r d}d~�ZJeEeGjKeJeLeJeL�ZM[Jd�dd��ZNe �d��d�d��ZOeO�\ZPZQ[Oe d���r�e d���s�e d���r�dZRdNZSZTe �gd���d�d��ZUd�d��ZVd�d��ZWd�d��ZXd�d��ZYe �gd���e d���r�d�d��ZZd�d��Z[e �d�d�g�e d���r�d�d��Z\d�d��Z]e �d�d�g�d�d�d��Z^Gd�d��d��Z_d�d��Z`d�d��Zae d���seaZbd�eb_cGd�d��d�ejd�Zeedk�rLGd�d��d��Zfd�d��ZgdS)��N)�_check_methods)�altsep�curdir�pardir�sep�pathsep�linesep�defpath�name�path�devnull�SEEK_SET�SEEK_CUR�SEEK_END�fsencode�fsdecode� get_exec_path�fdopen�popen�extsepcCs |t�vS�N)�globals)r �r�/usr/lib64/python3.9/os.py�_exists)srcCs6z t|j�WSty0dd�t|�D�YS0dS)NcSsg|]}|ddkr|�qS)r�_r)�.0�nrrr� 0�z%_get_exports_list..)�list�__all__�AttributeError�dir)�modulerrr�_get_exports_list,s  r%�posix� )�*)�_exitr))�_have_functions�ntz zno os specific module foundzos.path)rrrrr rrr r*cCs"|tvr|tvrt�t|�dSr)�_globalsr*�_set�add)�str�fnrrr�_addhsr1ZHAVE_FACCESSAT�accessZ HAVE_FCHMODAT�chmodZ HAVE_FCHOWNAT�chownZ HAVE_FSTATAT�statZHAVE_FUTIMESAT�utimeZ HAVE_LINKAT�linkZ HAVE_MKDIRAT�mkdirZ HAVE_MKFIFOAT�mkfifoZ HAVE_MKNODAT�mknodZ HAVE_OPENAT�openZHAVE_READLINKAT�readlinkZ HAVE_RENAMEAT�renameZHAVE_SYMLINKAT�symlinkZ HAVE_UNLINKAT�unlink�rmdirZHAVE_UTIMENSATZ HAVE_FCHDIR�chdirZ HAVE_FCHMODZ HAVE_FCHOWNZHAVE_FDOPENDIR�listdir�scandirZ HAVE_FEXECVE�execveZHAVE_FTRUNCATE�truncateZ HAVE_FUTIMENSZ HAVE_FUTIMESZHAVE_FPATHCONF�pathconf�statvfs�fstatvfsZ HAVE_FSTATVFSZ HAVE_LCHFLAGS�chflagsZ HAVE_LCHMOD�lchownZ HAVE_LCHOWNZ HAVE_LUTIMESZ HAVE_LSTATZ MS_WINDOWS����FcCs�t�|�\}}|s t�|�\}}|rz|rzt�|�szzt||d�WntyTYn0t}t|t�rnttd�}||krzdSzt||�Wn"t y�|r�t� |�s��Yn0dS)N)�exist_ok�ASCII) r �split�exists�makedirs�FileExistsErrorr� isinstance�bytesr8�OSError�isdir)r �moderN�head�tail�cdirrrrrR�s$     rRcCsht|�t�|�\}}|s(t�|�\}}|rd|rdz t|�WntyRYqdYn0t�|�\}}q(dSr)r@r rPrV)r rYrZrrr� removedirs�s    r\cCslt�|�\}}|r(|r(t�|�s(t|�t||�t�|�\}}|rh|rhz t|�WntyfYn0dSr)r rPrQrRr=r\rV)�old�newrYrZrrr�renames�s   r_)rRr\r_TcCs$t�d||||�tt|�|||�S)Nzos.walk)�sys�audit�_walk�fspath)�top�topdown�onerror� followlinksrrr�walks;rhc cs g}g}g}z t|�}Wn6tyN}z|dur8||�WYd}~dSd}~00|��z,z t|�} Wnty�YW�q`Yn0WnBty�}z*|dur�||�WYd}~Wd�dSd}~00z | ��} Wnt�y�d} Yn0| �r|�| j�n |�| j�|sX| rX|�r"d} n,z | ��} Wnt�yFd} Yn0| } | rX|�| j�qXWd�n1�sv0Y|�r�|||fVtj tj } }|D]4}|||�}|�s�| |��s�t ||||�EdH�q�n,|D]}t ||||�EdH�q�|||fVdS)NFT) rCrV�next� StopIteration�is_dir�appendr � is_symlinkr �islink�joinrb)rdrerfrg�dirs�nondirs� walk_dirs� scandir_it�error�entryrk� walk_intormrnro�dirname�new_pathrrrrbXs\   $     .  rb�.��follow_symlinks�dir_fdccs�t�d|||||�t|t�r(t|d�s0t|�}|sBt|d|d�}t|t|d�}zJ|srt � |j �r�t � |t|��r�t||t|t�|||�EdHWt|�n t|�0dS)Nzos.fwalk� __index__Frz�r|)r`rarT�int�hasattrrcr5r;�O_RDONLY�st�S_ISDIR�st_moder �samestat�_fwalkrU�close)rdrerfr{r|�orig_st�topfdrrr�fwalk�s!�� r�c cs�t|�}g}g}|s|rdng} |D]�} | j} |r:t| �} z4| ��rb|�| �| durl| �| �n |�| �Wq$ty�z| ��r�|�| �Wnty�Yn0Yq$0q$|r�||||fV| dur�|nt|| �D]�} z@|�s |r�t| |dd�} n| \} } | jdd�} t | t |d�} WnDt�y^}z*|du�r>||�WYd}~q�WYd}~n d}~00zH|�szt � | t| ���r�t � || �}t| |||||�EdHWt| �q�t| �0q�|�s�||||fVdS)NF)r|r{)r{r~)rCr rrkrlrVrm�zipr5r;r�r r�ror�r�)r��toppath�isbytesrerfr{rsrprq�entriesrur r��dirfd�err�dirpathrrrr��sV      " � r�cGst||�dSr)�execv��file�argsrrr�execlsr�cGs |d}t||dd�|�dS�N�����)rD�r�r��envrrr�execle sr�cGst||�dSr)�execvpr�rrr�execlp(sr�cGs |d}t||dd�|�dSr�)�execvper�rrr�execlpe/sr�cCst||�dSr��_execvper�rrrr�8sr�cCst|||�dSrr�r�rrrr�@sr�)r�r�r�r�r�r�c Cs|durt}||f}nt}|f}t}t�|�rB||g|�R�dSd}t|�}tdkrht|�}tt|�}|D]�}t� ||�}z||g|�R�Wqlt t fy�} z| } WYd} ~ qld} ~ 0t y�} z| } |dur�| }WYd} ~ qld} ~ 00ql|dur�|�| �dS)Nr+) rDr��environr rwrr r�mapro�FileNotFoundError�NotADirectoryErrorrV) r�r�r�� exec_func�argrest� saved_exc� path_listr#�fullname�e�last_excrrrr�Ks6    r�c Cs�ddl}|durt}|����|�dt�z|�d�}WntyNd}Yn0tr�z |d}WnttfyvYn0|dur�t d��|}|dur�t |t �r�t |�}Wd�n1s�0Y|dur�t }|�t�S)Nr�ignore�PATHsPATHz*env cannot contain 'PATH' and b'PATH' keys)�warningsr��catch_warnings� simplefilter� BytesWarning�get� TypeError�supports_bytes_environ�KeyError� ValueErrorrTrUrr rPr)r�r�r�� path_listbrrrrks0      �&r)�MutableMapping�Mappingc@sleZdZdd�Zdd�Zdd�Zdd�Zd d �Zd d �Zd d�Z dd�Z dd�Z dd�Z dd�Z dd�ZdS)�_EnvironcCs"||_||_||_||_||_dSr)� encodekey� decodekey� encodevalue� decodevalue�_data)�self�datar�r�r�r�rrr�__init__�s z_Environ.__init__cCs<z|j|�|�}Wnty0t|�d�Yn0|�|�Sr)r�r�r�r��r��key�valuerrr� __getitem__�s  z_Environ.__getitem__cCs,|�|�}|�|�}t||�||j|<dSr)r�r��putenvr�r�rrr� __setitem__�s   z_Environ.__setitem__cCs@|�|�}t|�z |j|=Wnty:t|�d�Yn0dSr)r��unsetenvr�r�)r�r�� encodedkeyrrr� __delitem__�s    z_Environ.__delitem__ccs$t|j�}|D]}|�|�VqdSr)r r�r�)r��keysr�rrr�__iter__�s z_Environ.__iter__cCs t|j�Sr)�lenr��r�rrr�__len__�sz_Environ.__len__cs$d�d��fdd��j��D���S)Nzenviron({{{}}})z, c3s*|]"\}}d���|���|��VqdS)z {!r}: {!r}N)�formatr�r�)rr�r�r�rr� �s�z$_Environ.__repr__..)r�ror��itemsr�rr�r�__repr__�s  ��z_Environ.__repr__cCst|�Sr)�dictr�rrr�copy�sz _Environ.copycCs||vr|||<||Srrr�rrr� setdefault�sz_Environ.setdefaultcCs|�|�|Sr)�update)r��otherrrr�__ior__�s z_Environ.__ior__cCs$t|t�stSt|�}|�|�|Sr�rTr��NotImplementedr�r��r�r�r^rrr�__or__�s   z_Environ.__or__cCs$t|t�stSt|�}|�|�|Srr�r�rrr�__ror__�s   z_Environ.__ror__N)�__name__� __module__� __qualname__r�r�r�r�r�r�r�r�r�r�r�r�rrrrr��s r�cs�tdkrHdd�}|�t}�fdd�}i}t��D]\}}||||�<q0n(t����fdd���fdd �}�}t}t|||�|�S) Nr+cSs t|t�stdt|�j��|S)N�str expected, not %s)rTr/r��typer��r�rrr� check_str�s z!_createenviron..check_strcs �|���Sr)�upper)r�)�encoderrr��sz!_createenviron..encodekeycs(t|t�stdt|�j��|��d�S)Nr��surrogateescape)rTr/r�r�r�r�r���encodingrrr��s z_createenviron..encodecs |��d�S)Nr�)�decoder�r�rrr��sz_createenviron..decode)r r/r�r�r`�getfilesystemencodingr�)r�r�r�r�r�r�r)r�r�r�_createenviron�s"   �r�cCs t�||�Sr)r�r��r��defaultrrr�getenvsr�)r�r�cCs t|t�stdt|�j��|S)Nzbytes expected, not %s)rTrUr�r�r�r�rrr� _check_bytes s r�cCs t�||�Sr)�environbr�r�rrr�getenvbsr�)r�r�cs4t���t�����fdd�}��fdd�}||fS)Ncs&t|�}t|t�r|����S|SdSr)rcrTr/r���filename�r��errorsrrr$s  z_fscodec..fsencodecs&t|�}t|t�r|����S|SdSr)rcrTrUr�r�r�rrr0s  z_fscodec..fsdecode)r`r��getfilesystemencodeerrors)rrrr�r�_fscodec s   r��fork�spawnvr�)�P_WAIT�P_NOWAIT� P_NOWAITOcCs�t|ttf�std��|r"|ds*td��t�}|spz$|durJ|||�n ||||�Wq�td�Yq�0n,|tkr||St|d�\}}t |�r�q|t |�SdS)Nzargv must be a tuple or a listrz"argv first element cannot be empty�) rT�tupler r�r�r�r)r��waitpid� WIFSTOPPED�waitstatus_to_exitcode)rXr�r�r��func�pid�wpid�stsrrr� _spawnvefMs$  r cCst|||dt�Sr)r r��rXr�r�rrrr�hscCst||||t�Sr)r rD�rXr�r�r�rrr�spawnveqsr cCst|||dt�Sr)r r�r rrr�spawnvp}srcCst||||t�Sr)r r�r rrr�spawnvpe�sr)r�r rrcGs t|||�Sr)r�r rrr�spawnl�srcGs|d}t|||dd�|�Sr�)r r rrr�spawnle�srcGs t|||�Sr)rr rrr�spawnlp�srcGs|d}t|||dd�|�Sr�)rr rrr�spawnlpe�sr�rr�cCs�t|t�stdt|���|dvr.td|��|dks>|durFtd��ddl}ddl}|dkr�|j|d|j|d�}t |� |j �|�S|j|d|j|d �}t |� |j �|�SdS) Nz&invalid cmd type (%s, expected string))r�wzinvalid mode %rrz+popen() does not support unbuffered streamsrT)�shell�stdout�bufsize)r�stdinr) rTr/r�r�r�� subprocess�io�Popen�PIPE� _wrap_close� TextIOWrapperrr)�cmdrX� bufferingrr�procrrrr�s(  ��rc@s<eZdZdd�Zdd�Zdd�Zdd�Zd d �Zd d �Zd S)rcCs||_||_dSr)�_stream�_proc)r��streamr"rrrr��sz_wrap_close.__init__cCs8|j��|j��}|dkr dStdkr,|S|d>SdS)Nrr+�)r#r�r$�waitr )r�� returncoderrrr��s  z_wrap_close.closecCs|Srrr�rrr� __enter__�sz_wrap_close.__enter__cGs |��dSr�r��r�r�rrr�__exit__�sz_wrap_close.__exit__cCs t|j|�Sr)�getattrr#)r�r rrr� __getattr__�sz_wrap_close.__getattr__cCs t|j�Sr)�iterr#r�rrrr��sz_wrap_close.__iter__N) r�r�r�r�r�r)r,r.r�rrrrr�s  rcOs:t|t�stdt|���ddl}|j|g|�Ri|��S)Nz&invalid fd type (%s, expected integer)r)rTrr�r�rr;)�fdr��kwargsrrrrr�s rcCs�t|ttf�r|St|�}z|�|�}Wn.tyVt|d�rD�ntd|j��Yn0t|ttf�rj|Std� |jt|�j���dS)N� __fspath__z/expected str, bytes or os.PathLike object, not z7expected {}.__fspath__() to return str or bytes, not {}) rTr/rUr�r2r"r�r�r�r�)r � path_type� path_reprrrr�_fspaths"  � �r5rcc@s.eZdZejdd��Zedd��Zee�Z dS)�PathLikecCst�dSr)�NotImplementedErrorr�rrrr2,szPathLike.__fspath__cCs|turt|d�StS)Nr2)r6rr�)�cls�subclassrrr�__subclasshook__1s zPathLike.__subclasshook__N) r�r�r��abc�abstractmethodr2� classmethodr:� GenericAlias�__class_getitem__rrrrr6(s   r6c@s4eZdZdd�Zdd�Zdd�Zdd�Zd d �Zd S) �_AddedDllDirectorycCs||_||_||_dSr)r �_cookie�_remove_dll_directory)r�r �cookieZremove_dll_directoryrrrr�<sz_AddedDllDirectory.__init__cCs|�|j�d|_dSr)rBrAr r�rrrr�@s z_AddedDllDirectory.closecCs|Srrr�rrrr)Csz_AddedDllDirectory.__enter__cGs |��dSrr*r+rrrr,Esz_AddedDllDirectory.__exit__cCs|jrd�|j�SdS)Nzz)r r�r�rrrr�Gs z_AddedDllDirectory.__repr__N)r�r�r�r�r�r)r,r�rrrrr@;s r@cCs ddl}|�|�}t|||j�S)Nr)r+Z_add_dll_directoryr@rB)r r+rCrrr�add_dll_directoryLs  �rD)rMF)TNF)ryTN)N)N)N)N)rr�)hr;r`r5r��_collections_abcrr�r rr>�builtin_module_namesZ_namesr!rr%r rr&r)rl� ImportError� posixpathr r*�extendr+�ntpath�modulesZos.pathrrrrr rrr rr,r1�setr-�supports_dir_fd�supports_effective_idsr.� supports_fd�supports_follow_symlinksr rrrRr\r_rhrbr;rCr�r�r�r�r�r�r�r�r�rr�r�r�r�r�r�r�r�r�rUr�r�r�rrr�r�rr r�r rrrrrrrrrr5rcr��ABCr6r@rDrrrr�s`        (                                             >R 18    -G  �