a �DOgVl�@s�dZdZdZdZdZdZdZdZddlZddl Z ddl Z ddl Z dd l Tgd �Z d d �Z d d�Zdd�Zdd�Zdd�Zdd�Zdd�Ze jje_dd�Zdd�Zdd�Zdd �Zzdd!lmZWney�dZYn0d"d#�Zd$d%�Zd&d'�Zd(d)�Z d*d+�Z!zdd,lm"Z"Wne�y*e!Z#Yn 0d-d.�Z#zdd/lm$Z$m%Z&Wne�y`e#Z'Yn0d0d1�Z(d2d3�Z)d4d5�Z'e*e d6��o�e �+�d7d8kZ,d>d9d:�Z-d;d<�Z.zdd=lm/Z0Wne�y�Yn0dS)?�.�..�\�;�/z.;C:\bin�nul�N)�*)&�normcase�isabs�join� splitdrive�split�splitext�basename�dirname� commonprefix�getsize�getmtime�getatime�getctime�islink�exists�lexists�isdir�isfile�ismount� expanduser� expandvars�normpath�abspath�curdir�pardir�sep�pathsep�defpath�altsep�extsep�devnull�realpath�supports_unicode_filenames�relpath�samefile� sameopenfile�samestat� commonpathcCst|t�rdSdSdS)N�\/�\/)� isinstance�bytes��path�r5�/usr/lib64/python3.9/ntpath.py� _get_bothseps"s r7cCs8t�|�}t|t�r$|�dd���S|�dd���SdS)N�/�\rr)�os�fspathr1r2�replace�lower��sr5r5r6r ,s  r cCsjt�|�}t|t�r,|�dd��d�rBdSn|�dd��d�rBdSt|�d}t|�d koh|d t|�vS) Nr8r9�\\?\Trr�\\?\�r) r:r;r1r2r<� startswithr �lenr7r>r5r5r6r =s   r c GsTt�|�}t|t�r"d}d}d}n d}d}d}z�|sD|dd�|t|�\}}ttj|�D]~}t|�\}} | r�| d|vr�|s�|s�|}| }q\n*|r�||kr�|��|��kr�|}| }q\|}|r�|d|vr�||}|| }q\|�r|d|v�r|�r|dd�|k�r|||WS||WSttt f�yNt j d |g|�R��Yn0dS) Nr9r/�:rr0�:r�����r ) r:r;r1r2r �mapr=� TypeError�AttributeError� BytesWarning� genericpath�_check_arg_types) r4�pathsr"�seps�colon� result_drive� result_path�p�p_drive�p_pathr5r5r6r MsL      �� r cCst�|�}t|�dk�rt|t�r0d}d}d}n d}d}d}|�||�}|dd�|dkr�|dd �|kr�|�|d�}|d kr�|dd�|fS|�||d �}||d kr�|dd�|fS|d kr�t|�}|d|�||d�fS|d d�|k�r|dd�|dd�fS|dd�|fS) N�r9r8rErrrFr�rGrB)r:r;rDr1r2r<�find)rSr"r%rP�normp�index�index2r5r5r6r |s.   $  r cCsxt�|�}t|�}t|�\}}t|�}|rD||d|vrD|d8}q&|d|�||d�}}|�|�pj|}|||fS�NrB)r:r;r7r rD�rstrip)rSrO�d�i�head�tailr5r5r6r �s   r cCs8t�|�}t|t�r$t�|ddd�St�|ddd�SdS)Nr9r8�.rrr)r:r;r1r2rL� _splitext�rSr5r5r6r�s  rcCs t|�dSr\�r rdr5r5r6r�srcCs t|�dS)Nrrerdr5r5r6r�src Cs6zt�|�}Wntttfy(YdS0t�|j�S)NF)r:�lstat�OSError� ValueErrorrJ�stat�S_ISLNK�st_mode�r4�str5r5r6r�s rc Cs,zt�|�}Wnttfy&YdS0dS)NFT)r:rfrgrhrlr5r5r6r�s r)�_getvolumepathnamecCstt�|�}t|�}t|�}t|�\}}|rD|d|vrD| pB||vS||vrPdStrl|�|�t|��|�kSdSdS)NrTF)r:r;r7rr rnr])r4rO�root�restr5r5r6rs  rcCs�t�|�}t|t�rd}nd}|�|�s,|Sdt|�}}||kr\||t|�vr\|d7}q:dtjvrrtjd}nDdtjvr�|Sztjd}Wnty�d}Yn0t |tjd�}t|t�r�t� |�}|dkr�t t |�|d|��}|||d�S)N�~�~rB� USERPROFILE�HOMEPATH� HOMEDRIVE�) r:r;r1r2rCrDr7�environ�KeyErrorr �fsencoder)r4�tilder_�n�userhome�driver5r5r6r!s.           rcCs&t�|�}t|t�rhd|vr(d|vr(|Sddl}t|j|jdd�}d}d}d}d}d}ttd d�}nFd |vr|d |vr||Sddl}|j|jd}d }d }d }d}d }tj}|dd�} d} t |�} | | k�r"|| | d�} | |k�rV|| dd�}t |�} z&|� | �} | | |d| d�7} Wn(t �yP| | |7} | d} Yn0�n�| |k�rD|| d| d�|k�r�| | 7} | d7} n�|| dd�}t |�} z|� |�} Wn(t �y�| ||7} | d} Ynf0|d| �} z.|du�r t� tjt� | ��}n|| }Wn t�y6|| |}Yn0| |7} �n�| |k�r|| d| d�|k�r|| | 7} | d7} �q|| d| d�|k�rT|| dd�}t |�} z|� |�} Wn,t �y�| |||7} | d} Ynj0|d| �} z.|du�rt� tjt� | ��}n|| }Wn$t�yH||| |}Yn0| |7} n�|dd�} | d7} || | d�} | �r�| |v�r�| | 7} | d7} || | d�} �qxz.|du�r�t� tjt� | ��}n|| }Wnt�y�|| }Yn0| |7} | �r| d8} n| | 7} | d7} q�| S)N�$�%rz_-�ascii�'�{�}�environb�$�%�'�{�}rBrV)r:r;r1r2�string� ascii_letters�digits�getattrrwrDrZrhry�fsdecoderx)r4r��varchars�quote�percent�brace�rbrace�dollarrw�resrZ�pathlen�c�var�valuer5r5r6rQs�                         rc CsPt�|�}t|t�r*d}d}d}d}d}nd}d}d}d }d }|�|�rL|S|�||�}t|�\}}|�|�r�||7}|�|�}|�|�}d }|t |�k�r,||r�|||kr�||=q�|||k�r"|d kr�||d |kr�||d |d �=|d 8}n&|d k�r|� |��r||=n|d 7}q�|d 7}q�|�sB|�sB|� |�||� |�S) Nr9r8rb�..)s\\.\r@rrrr)z\\.\rArrB) r:r;r1r2rCr<r �lstripr rD�endswith�appendr ) r4r"r%r r!�special_prefixes�prefix�compsr_r5r5r6r�sF             rcCs@t�|�}t|�s8t|t�r&t��}nt��}t||�}t|�S�N) r:r;r r1r2�getcwdb�getcwdr r)r4�cwdr5r5r6�_abspath_fallback�s    r�)�_getfullpathnamec Cs2ztt|��WSttfy,t|�YS0dSr�)rr�rgrhr�r3r5r5r6r sr)�_getfinalpathname�readlinkc Cs�d}t�}t|�|vr�|�t|��z:|}t|�}t|�s\t|�sJ|}Wq�ttt|�|��}Wq t y�}z$|j |vr�WYd}~q��WYd}~q d}~0t y�Yq�Yq 0q |S)N) rBrVrW��� �2�C�Wi&i(i)) �setr �add� _nt_readlinkr rrr rrg�winerrorrh)r4�allowed_winerror�seenZold_path�exr5r5r6�_readlink_deeps&     r�c Cs�d}d}|r�zt|�}|r$t||�n|WSty�}z�|j|vrD�z4t|�}||krv|rdt||�n|WWYd}~SWnty�Yn0t|�\}}|r�|s�||WYd}~S|r�t||�n|}WYd}~qd}~00q|S)N) rBrVrWr�r�r�r�r�r��{i�i�rv)r�r rgr�r�r )r4r�rar��new_path�namer5r5r6�_getfinalpathname_nonstrictCs( $  *r�c Csdt|�}t|t�rBd}d}d}t��}t|�tt�t��krjdSn(d}d}d}t��}t|�tt�krjdS|� |�}|s�t |�s�t ||�}zt |�}d }Wn2t y�}z|j}t|�}WYd}~n d}~00|�s`|� |��r`|� |��r||t|�d�}n|t|�d�}zt |�|k�r&|}Wn6t �y^}z|j|k�rJ|}WYd}~n d}~00|S) Nr@s\\?\UNC\s\\s\\.\NULrAz\\?\UNC\z\\z\\.\NULr)rr1r2r:r�r ryr'r�rCr r r�rgr�r�rD) r4r�Z unc_prefixZnew_unc_prefixr�Z had_prefixZinitial_winerrorr�Zspathr5r5r6r(qsD      r(�getwindowsversionrWrVc Csdt�|�}t|t�r"d}d}d}n d}d}d}|dur:|}|sFtd��t�|�}z�tt|��}tt|��}t|�\}}t|�\} } t|�t| �kr�td| |f��d d �|� |�D�} d d �| � |�D�} d } t | | �D]$\}}t|�t|�kr�q�| d 7} q�|gt | �| | | d�}|�s(|WSt |�WSt ttttf�y^t�d||��Yn0dS)Nr9rbr�rrrzno path specifiedz&path is on mount %r, start on mount %rcSsg|] }|r|�qSr5r5��.0�xr5r5r6� ��zrelpath..cSsg|] }|r|�qSr5r5r�r5r5r6r��r�rrBr*)r:r;r1r2rhrrr r r �ziprDr rIrJrK�DeprecationWarningrLrM)r4�startr"r r!� start_abs�path_abs� start_drive� start_rest� path_drive� path_rest� start_list� path_listr_�e1�e2�rel_listr5r5r6r*�sH       �  r*c s�|s td��tttj|��}t|dt�r8d�d�d�n d�d�d��z>��fd d �|D�}�fd d �|D�}zt�fd d �|D��\}Wnty�td�d�Yn0ttdd �|D���dkr�td��t |d� ����\}}|� ��}�fdd �|D�}�fdd �|D�}t |�}t |�}t|�D]*\} } | || k�r(|d| �}�qd�q(|dt|��}|�rr|�n|} | ��|�WSttf�y�tjdg|�R��Yn0dS)Nz%commonpath() arg is an empty sequencerr9r8rbrrrcs g|]}t|��������qSr5)r r<r=)r�rS)r%r"r5r6r��r�zcommonpath..csg|]\}}|����qSr5re�r�r^rS�r"r5r6r��r�c3s"|]\}}|dd��kVqdSr\r5r�r�r5r6� �r�zcommonpath..z%Can't mix absolute and relative pathscss|]\}}|VqdSr�r5r�r5r5r6r��r�rBzPaths don't have the same drivecsg|]}|r|�kr|�qSr5r5�r�r��r r5r6r��r�csg|]}�fdd�|D��qS)csg|]}|r|�kr|�qSr5r5r�r�r5r6r�r�z)commonpath...r5)r�r?r�r5r6r�r�r.)rh�tuplerHr:r;r1r2r�rDr r<r �min�max� enumerater rIrJrLrM) rN� drivesplits� split_pathsr r}r4�common�s1�s2r_r�r�r5)r%r r"r6r.�sF    r.)�_isdir)N)1r r!r&r"r#r%r$r'r:�sysrirL�__all__r7r r r r r rrc�__doc__rrrr�ntrn� ImportErrorrrrrr�r�rr�r�r�r(r�r��hasattrr�r)r*r.r�rr5r5r5r6� sn /8    0q2  *.2 � 84