Your IP : 18.224.51.49


Current Path : /opt/alt/python39/lib64/python3.9/__pycache__/
Upload File :
Current File : //opt/alt/python39/lib64/python3.9/__pycache__/pathlib.cpython-39.opt-2.pyc

a

R�f9��@sbddlZddlZddlZddlZddlZddlZddlZddlZddlm	Z	ddl
mZmZm
Z
mZmZddlmZddlmZmZmZmZmZmZmZddlmZdZejdkr�ddlZe� �dd	�d
kr�ddlm!Z!q�dZdZ!ndZgd
�Z"ee
eefZ#dZ$dd�Z%dd�Z&Gdd�de'�Z(Gdd�de(�Z)Gdd�de(�Z*e)�Z+e*�Z,Gdd�d�Z-Gdd�de-�Z.e.�Z/dd�Z0e1ed��r�e�2�e0�Z0Gd d!�d!�Z3Gd"d#�d#�Z4Gd$d%�d%e3�Z5Gd&d'�d'e3�Z6Gd(d)�d)e3�Z7Gd*d+�d+e	�Z8Gd,d-�d-e'�Z9ej:�;e9�Gd.d/�d/e9�Z<Gd0d1�d1e9�Z=Gd2d3�d3e9�Z>Gd4d5�d5e>e<�Z?Gd6d7�d7e>e=�Z@dS)8�N)�Sequence)�EINVAL�ENOENT�ENOTDIR�EBADF�ELOOP)�
attrgetter)�S_ISDIR�S_ISLNK�S_ISREG�S_ISSOCK�S_ISBLK�S_ISCHR�S_ISFIFO)�quote_from_bytesT�nt�)�r)�_getfinalpathnameF)�PurePath�
PurePosixPath�PureWindowsPath�Path�	PosixPath�WindowsPath)��{i�cCs t|dd�tvpt|dd�tvS)N�errnoZwinerror)�getattr�_IGNORED_ERROS�_IGNORED_WINERRORS)Z	exception�r!�,/opt/alt/python39/lib64/python3.9/pathlib.py�
_ignore_error.s�r#cCsd|vpd|vpd|vS)N�*�?�[r!)�patr!r!r"�_is_wildcard_pattern3sr(c@s$eZdZdd�Zdd�Zdd�ZdS)�_FlavourcCs|jj|_dS�N)�sep�join��selfr!r!r"�__init__=sz_Flavour.__init__cCsg}|j}|j}d}}t|�}|D]�}|s.q$|r>|�||�}|�|�\}}}	||	vr�t|	�|��D] }
|
rd|
dkrd|�t�|
��qdn|	r�|	dkr�|�t�|	��|s�|r$|s�|D]0}|s�q�|r�|�||�}|�|�d}|r�q�q�q�q$|s�|�r|�||�|�	�|||fS)N��.r)
r+�altsep�reversed�replace�	splitroot�split�append�sys�intern�reverse)r.�partsZparsedr+r2�drv�root�it�partZrel�xr!r!r"�parse_parts@s@
z_Flavour.parse_partscCsz|r*|sp|rp||||g|dd�fSnF|rb||ksJ|�|�|�|�krp||||dd�fSn||||fS|||fS�N�)�casefold)r.r<r=r;Zdrv2Zroot2Zparts2r!r!r"�join_parsed_partsfsz_Flavour.join_parsed_partsN)�__name__�
__module__�__qualname__r/rArEr!r!r!r"r)9s&r)c@s�eZdZdZdZdZeZej	dkZ
ed�ZdZ
hd�dd	�d
D�Bdd	�d
D�BZefdd
�Zdd�Zdd�Zdd�Zd"dd�Ze
fdd�Zdd�Zdd�Zdd�Zdd �Zd!S)#�_WindowsFlavour�\�/TrZ4abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZz\\?\>zCONIN$ZCONzCONOUT$ZNULZAUXZPRNcCsh|]}d|�qS)zCOM%sr!��.0�cr!r!r"�	<setcomp>��z_WindowsFlavour.<setcomp>u123456789¹²³cCsh|]}d|�qS)zLPT%sr!rLr!r!r"rO�rPcCs\|dd�}|dd�}||krP||krP|�|�\}}|dd�}|dd�}nd}|dd�}||kr�||kr�||kr�|�|d�}|dkr�|�||d�}||dkr�|dkr�t|�}|r�||d|�|||dd�fS|d|�|||dd�fSd}	}
|dk�r6||jv�r6|dd�}	|dd�}|}||k�rN|}
|�|�}||	|
|fS)NrrCrr0�����:)�_split_extended_path�find�len�
drive_letters�lstrip)r.r?r+�first�second�prefixZthird�indexZindex2r<r=r!r!r"r5�s6"

z_WindowsFlavour.splitrootcCs|��Sr*��lower�r.�sr!r!r"rD�sz_WindowsFlavour.casefoldcCsdd�|D�S)NcSsg|]}|���qSr!r])rM�pr!r!r"�
<listcomp>�rPz2_WindowsFlavour.casefold_parts.<locals>.<listcomp>r!�r.r;r!r!r"�casefold_parts�sz_WindowsFlavour.casefold_partscCst�t�|�tj�jSr*)�re�compile�fnmatch�	translate�
IGNORECASE�	fullmatch�r.�patternr!r!r"�compile_pattern�sz_WindowsFlavour.compile_patternFcCs�t|�}|st��Sd}tdur�|r2|�t|��Sg}z|�t|��}Wn@ty�|}tj�|�\}}|�|�||kr�|YSYq60tjj	|gt
|��R�Sq6dSr*)�str�os�getcwdr�_ext_to_normal�FileNotFoundError�pathr6r7r,r3)r.rs�strictr`Z
previous_sZ
tail_parts�tailr!r!r"�resolve�s$
z_WindowsFlavour.resolvecCsXd}|�|�rP|dd�}|dd�}|�d�rP||dd�7}d|dd�}||fS)Nr0�zUNC\rQrJ)�
startswith)r.r`Z
ext_prefixr[r!r!r"rT�s

z$_WindowsFlavour._split_extended_pathcCs|�|�dSrB)rTr_r!r!r"rq�sz_WindowsFlavour._ext_to_normalcCsJ|sdS|d�d�rdS|d�d�d�d�d�d�}|��|jvS)NFrz\\rRr1rS� )rx�	partition�rstrip�upper�reserved_names)r.r;�namer!r!r"�is_reserved�s"z_WindowsFlavour.is_reservedcCsd|j}t|�dkrJ|ddkrJ|��dd��d�}d|t|�d��fSdt|���d��SdS)NrrCrSrKz
file:///%s/%szutf-8zfile:)�driverV�as_posixrX�urlquote_from_bytes�encode)r.rsr��restr!r!r"�make_uri�s�z_WindowsFlavour.make_uricCs�dtjvrtjd}nHdtjvrVztjd}WntyDd}Yn0|tjd}ntd��|r�tjd|kr�|�|f�\}}}|dtjdkr�td|��||d<|s�|r�|||�|d	d��}n
|�|�}|S)
NZUSERPROFILEZHOMEPATHZ	HOMEDRIVEr0zCan't determine home directoryZUSERNAMErR�%Can't determine home directory for %rrC)ro�environ�KeyError�RuntimeErrorrAr,)r.�username�userhomer<r=r;r!r!r"�
gethomedir
s*


�
z_WindowsFlavour.gethomedirN)F)rFrGrHr+r2�has_drv�ntpath�pathmodror~�is_supported�setrWZext_namespace_prefixr}r5rDrdrmrvrTrqrr�r�r!r!r!r"rIxs.
���'


rIc@sleZdZdZdZdZeZej	dkZ
efdd�Zdd�Zd	d
�Z
dd�Zdd
d�Zdd�Zdd�Zdd�ZdS)�
_PosixFlavourrKr0FrcCsV|rH|d|krH|�|�}t|�t|�dkr<d|d|fSd||fSn
dd|fSdS)Nrrr0)rXrV)r.r?r+Z
stripped_partr!r!r"r5/s
z_PosixFlavour.splitrootcCs|Sr*r!r_r!r!r"rD>sz_PosixFlavour.casefoldcCs|Sr*r!rcr!r!r"rdAsz_PosixFlavour.casefold_partscCst�t�|��jSr*)rerfrgrhrjrkr!r!r"rmDsz_PosixFlavour.compile_patterncsJ|j�|j�i������fdd��|��r0dnt��}�|t|��pH�S)Ncs�|���rd}|���D]�}|r|dkr*q|dkrD|���\}}}q|���rX||}n|�|}|�vr��|}|dur~qtd|��z��|�}Wn8ty�}z |jtkr��r��|}WYd}~qd}~00d�|<�||�}|�|<q|S)Nr0r1�..zSymlink loop from %r)	rxr6�
rpartition�endswithr��readlink�OSErrorrr)rsr�r~�_�newpath�target�e��_resolveZaccessor�seenr+rtr!r"r�Ks4




z'_PosixFlavour.resolve.<locals>._resolver0)r+�	_accessor�is_absoluterorprn)r.rsrt�baser!r�r"rvGs)z_PosixFlavour.resolvecCsdS�NFr!rcr!r!r"rwsz_PosixFlavour.is_reservedcCst|�}dt|�S)Nzfile://)�bytesr�)r.rsZbpathr!r!r"r�zsz_PosixFlavour.make_uricCsx|s>ztjdWSty:ddl}|�t���jYS0n6ddl}z|�|�jWStyrtd|��Yn0dS)N�HOMErr�)	ror�r��pwd�getpwuid�getuid�pw_dir�getpwnamr�)r.r�r�r!r!r"r��s�z_PosixFlavour.gethomedirN)F)rFrGrHr+r2r��	posixpathr�ror~r�r5rDrdrmrvrr�r�r!r!r!r"r�'s

0r�c@seZdZdS)�	_AccessorN)rFrGrHr!r!r!r"r��sr�c@s�eZdZejZejZejZejZejZej	Z	e
ed�r>ejZndd�ZejZej
Z
e
ed�rdejZnedd��ZejZejZejZer�er�ejZq�dd�Zned	d��ZejZd
d�Zdd
�Zdd�ZdS)�_NormalAccessor�lchmodcCstd��dS)Nz%lchmod() not available on this system��NotImplementedError)r.Zpathobj�moder!r!r"r��sz_NormalAccessor.lchmod�linkcCstd��dS)Nz&os.link() not available on this systemr��r.r�r!r!r"�link_to�sz_NormalAccessor.link_tocCstd��dS)Nz&symlink() not available on this systemr���a�b�target_is_directoryr!r!r"�symlink�sz_NormalAccessor.symlinkcCst�||�Sr*)ror�r�r!r!r"r��scCs
t�|�Sr*)ror��r.rsr!r!r"r��sz_NormalAccessor.readlinkcCs>zddl}|�|�|�j�jWSty8td��Yn0dS)Nrz*Path.owner() is unsupported on this system)r�r��stat�st_uidZpw_name�ImportErrorr�)r.rsr�r!r!r"�owner�s
z_NormalAccessor.ownercCs>zddl}|�|�|�j�jWSty8td��Yn0dS)Nrz*Path.group() is unsupported on this system)�grpZgetgrgidr��st_gidZgr_namer�r�)r.rsr�r!r!r"�group�s
z_NormalAccessor.groupN)rFrGrHror��lstat�open�listdir�scandir�chmod�hasattrr��mkdir�unlinkr�r��staticmethod�rmdir�renamer4r�supports_symlinksr��utimer�r�r�r!r!r!r"r��s8




r�cCsR|d}|dd�}|dkr"t}n$d|vr4td��nt|�rBt}nt}||||�S)NrrC�**z:Invalid pattern: '**' can only be an entire path component)�_RecursiveWildcardSelector�
ValueErrorr(�_WildcardSelector�_PreciseSelector)�
pattern_parts�flavourr'�child_parts�clsr!r!r"�_make_selector�s
r��	lru_cachec@seZdZdd�Zdd�ZdS)�	_SelectorcCs0||_|rt||�|_d|_nt�|_d|_dS�NTF)r�r��	successor�dironly�_TerminatingSelector)r.r�r�r!r!r"r/�sz_Selector.__init__cCs<t|�}|j}|j}|jj}||�s,tg�S|�||||�Sr*)�type�is_dir�existsr�r��iter�_select_from)r.�parent_pathZpath_clsr�r�r�r!r!r"�select_fromsz_Selector.select_fromN)rFrGrHr/r�r!r!r!r"r��s	r�c@seZdZdd�ZdS)r�ccs
|VdSr*r!)r.r�r�r�r�r!r!r"r�sz!_TerminatingSelector._select_fromN)rFrGrHr�r!r!r!r"r�sr�c@seZdZdd�Zdd�ZdS)r�cCs||_t�|||�dSr*)r~r�r/)r.r~r�r�r!r!r"r/sz_PreciseSelector.__init__ccsZz@|�|j�}|jr|n||�r>|j�||||�D]
}|Vq2WntyTYdS0dSr*)�_make_child_relpathr~r�r�r��PermissionError)r.r�r�r�r�rsrar!r!r"r�sz_PreciseSelector._select_fromN�rFrGrHr/r�r!r!r!r"r�sr�c@seZdZdd�Zdd�ZdS)r�cCs|�|�|_t�|||�dSr*)rm�matchr�r/�r.r'r�r�r!r!r"r/(sz_WildcardSelector.__init__ccs�z�||��}t|�}Wd�n1s(0Y|D]�}|jr�z|��sNWq6Wn:ty�}z"t|�sj�WYd}~q6WYd}~n
d}~00|j}	|�|	�r6|�|	�}
|j�	|
|||�D]
}|Vq�q6Wnt
y�YdS0dSr*)�listr�r�r�r#r~r�r�r�r�r�)r.r�r�r�r��
scandir_it�entries�entryr�r~rsrar!r!r"r�,s&
&"

z_WildcardSelector._select_fromNr�r!r!r!r"r�&sr�c@s$eZdZdd�Zdd�Zdd�ZdS)r�cCst�|||�dSr*)r�r/r�r!r!r"r/Gsz#_RecursiveWildcardSelector.__init__ccs�|Vz�||��}t|�}Wd�n1s.0Y|D]v}d}z|��}Wn.ty~}zt|�sj�WYd}~n
d}~00|r<|��s<|�|j�}	|�|	||�D]
}
|
Vq�q<Wnty�YdS0dSr�)	r�r�r�r#�
is_symlinkr�r~�_iterate_directoriesr�)r.r�r�r�r�r�r�Zentry_is_dirr�rsrar!r!r"r�Js"
&z/_RecursiveWildcardSelector._iterate_directoriesc	cs�zjt�}zT|jj}|�|||�D]0}|||||�D]}||vr2|V|�|�q2q W|��n
|��0Wnty~YdS0dSr*)r�r�r�r��add�clearr�)	r.r�r�r�r�ZyieldedZsuccessor_selectZstarting_pointrar!r!r"r�]sz'_RecursiveWildcardSelector._select_fromN)rFrGrHr/r�r�r!r!r!r"r�Esr�c@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)�_PathParents)�_pathcls�_drv�_root�_partscCs&t|�|_|j|_|j|_|j|_dSr*)r�r�r�r�r�r�r!r!r"r/vs
z_PathParents.__init__cCs(|js|jrt|j�dSt|j�SdSrB)r�r�rVr�r-r!r!r"�__len__}sz_PathParents.__len__cCs@|dks|t|�krt|��|j�|j|j|jd|d��S)NrrC)rV�
IndexErrorr��_from_parsed_partsr�r�r�)r.�idxr!r!r"�__getitem__�s
�z_PathParents.__getitem__cCsd�|jj�S)Nz<{}.parents>)�formatr�rFr-r!r!r"�__repr__�sz_PathParents.__repr__N)rFrGrH�	__slots__r/r�r�r�r!r!r!r"r�qs
r�c@s�eZdZdZdd�Zdd�Zedd��Zed[d	d
��Zed\dd��Z	ed
d��Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zedd ��Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zeed/�d0d1�Zeed2�d3d1�Zed4d5��Zed6d7��Z ed8d9��Z!ed:d;��Z"ed<d=��Z#d>d?�Z$d@dA�Z%dBdC�Z&dDdE�Z'dFdG�Z(edHdI��Z)dJdK�Z*dLdM�Z+dNdO�Z,edPdQ��Z-edRdS��Z.dTdU�Z/dVdW�Z0dXdY�Z1dZS)]r)r�r�r��_str�_hash�_pparts�_cached_cpartscGs$|turtjdkrtnt}|�|�S)Nr)rror~rr�_from_parts)r��argsr!r!r"�__new__�szPurePath.__new__cCs|jt|j�fSr*)�	__class__�tupler�r-r!r!r"�
__reduce__�szPurePath.__reduce__cCsdg}|D]N}t|t�r"||j7}qt�|�}t|t�rF|�t|��qtdt|���q|j	�
|�S)NzNargument should be a str object or an os.PathLike object returning str, not %r)�
isinstancerr�ro�fspathrnr7�	TypeErrorr��_flavourrA)r�rr;r�r!r!r"�_parse_args�s


��zPurePath._parse_argsTcCs<t�|�}|�|�\}}}||_||_||_|r8|��|Sr*)�objectrr
r�r�r��_init)r�r�initr.r<r=r;r!r!r"r�s
zPurePath._from_partscCs,t�|�}||_||_||_|r(|��|Sr*)rrr�r�r�r)r�r<r=r;rr.r!r!r"r��s
zPurePath._from_parsed_partscCs4|s|r$|||j�|dd��S|j�|�SdSrB)rr,)r�r<r=r;r!r!r"�_format_parsed_parts�szPurePath._format_parsed_partscCsdSr*r!r-r!r!r"r�szPurePath._initcCs@|�|�\}}}|j�|j|j|j|||�\}}}|�|||�Sr*)r
rrEr�r�r�r�)r.rr<r=r;r!r!r"�_make_child�s
�
zPurePath._make_childcCs@z|jWSty:|�|j|j|j�p,d|_|jYS0dS)Nr1)r��AttributeErrorrr�r�r�r-r!r!r"�__str__�s��zPurePath.__str__cCst|�Sr*)rnr-r!r!r"�
__fspath__�szPurePath.__fspath__cCs|j}t|��|jd�S)NrK)rrnr4r+�r.�fr!r!r"r��szPurePath.as_posixcCs
t�|�Sr*)ro�fsencoder-r!r!r"�	__bytes__�szPurePath.__bytes__cCsd�|jj|���S)Nz{}({!r}))r�rrFr�r-r!r!r"r��szPurePath.__repr__cCs|��std��|j�|�S)Nz.relative path can't be expressed as a file URI)r�r�rr�r-r!r!r"�as_uriszPurePath.as_uricCs6z|jWSty0|j�|j�|_|jYS0dSr*)rrrrdr�r-r!r!r"�_cpartss
zPurePath._cpartscCs&t|t�stS|j|jko$|j|juSr*)r	r�NotImplementedrr�r.�otherr!r!r"�__eq__s
zPurePath.__eq__cCs6z|jWSty0tt|j��|_|jYS0dSr*)rr�hashrrr-r!r!r"�__hash__s
zPurePath.__hash__cCs&t|t�r|j|jurtS|j|jkSr*�r	rrrrrr!r!r"�__lt__szPurePath.__lt__cCs&t|t�r|j|jurtS|j|jkSr*r"rr!r!r"�__le__!szPurePath.__le__cCs&t|t�r|j|jurtS|j|jkSr*r"rr!r!r"�__gt__&szPurePath.__gt__cCs&t|t�r|j|jurtS|j|jkSr*r"rr!r!r"�__ge__+szPurePath.__ge__cCs|Sr*r!)r�r�r!r!r"�__class_getitem__0szPurePath.__class_getitem__r�z.The drive prefix (letter or UNC path), if any.)�docr�zThe root of the path, if any.cCs|j|j}|Sr*)r�r�)r.�anchorr!r!r"r)9szPurePath.anchorcCs.|j}t|�|js|jrdndkr&dS|dS)NrCrr0rR)r�rVr�r�rcr!r!r"r~?sz
PurePath.namecCsD|j}|�d�}d|kr,t|�dkr<nn||d�SdSdS)Nr1rrCr0�r~�rfindrV�r.r~�ir!r!r"�suffixGs

 zPurePath.suffixcCs:|j}|�d�rgS|�d�}dd�|�d�dd�D�S)Nr1cSsg|]}d|�qS)r1r!)rMr.r!r!r"rb`rPz%PurePath.suffixes.<locals>.<listcomp>rC)r~r�rXr6�r.r~r!r!r"�suffixesUs


zPurePath.suffixescCsD|j}|�d�}d|kr,t|�dkr<nn|d|�S|SdS)Nr1rrCr*r,r!r!r"�stembs

 z
PurePath.stemcCs�|jstd|f��|j�|f�\}}}|rX|d|jj|jjfvsX|sX|sXt|�dkrdtd|��|�|j|j	|j
dd�|g�S)N�%r has an empty namerRrCzInvalid name %r)r~r�rrAr+r2rVr�r�r�r�)r.r~r<r=r;r!r!r"�	with_namels��
��zPurePath.with_namecCs|�||j�Sr*)r3r.)r.r1r!r!r"�	with_stemwszPurePath.with_stemcCs�|j}|j|vs |jr.|j|vr.td|f��|r<|�d�rD|dkrPtd|��|j}|shtd|f��|j}|s|||}n|dt|��|}|�|j	|j
|jdd�|g�S)NzInvalid suffix %rr1r2rR)rr+r2r�rxr~r.rVr�r�r�r�)r.r.rr~Z
old_suffixr!r!r"�with_suffix{s
�zPurePath.with_suffixc
Gs�|std��|j}|j}|j}|r8||g|dd�}n|}|�|�\}}}|rf||g|dd�}	n|}	t|	�}
|jj}|
dkr�|s�|r�n||d|
��||	�kr�|�|||�}t	d�
t|�t|����|�d|
dkr�|nd||
d��S)Nzneed at least one argumentrCrzU{!r} is not in the subpath of {!r} OR one path is relative and the other is absolute.r0)
rr�r�r�r
rVrrdrr�r�rnr�)
r.rr;r<r=Z	abs_partsZto_drvZto_rootZto_partsZto_abs_parts�n�cfZ	formattedr!r!r"�relative_to�s,	*�
�zPurePath.relative_tocGs*z|j|�WdSty$YdS0dSr�)r8r�rr!r!r"�is_relative_to�s

zPurePath.is_relative_tocCs2z|jWSty,t|j�|_|jYS0dSr*)rrrr�r-r!r!r"r;�s
zPurePath.partscGs
|�|�Sr*)r)r.rr!r!r"�joinpath�szPurePath.joinpathcCs*z|�|f�WSty$tYS0dSr*)rrr�r.�keyr!r!r"�__truediv__�szPurePath.__truediv__cCs0z|�|g|j�WSty*tYS0dSr*)rr�rrr;r!r!r"�__rtruediv__�szPurePath.__rtruediv__cCs@|j}|j}|j}t|�dkr*|s&|r*|S|�|||dd��S)NrCrR)r�r�r�rVr�)r.r<r=r;r!r!r"�parent�szPurePath.parentcCst|�Sr*)r�r-r!r!r"�parents�szPurePath.parentscCs|js
dS|jjpt|j�Sr�)r�rr��boolr�r-r!r!r"r��szPurePath.is_absolutecCs|j�|j�Sr*)rrr�r-r!r!r"r�szPurePath.is_reservedc	Cs�|jj}||�}|j�|f�\}}}|s0td��|rF|||j�krFdS|r\|||j�kr\dS|j}|sj|r�t|�t|�kr~dS|dd�}nt|�t|�kr�dStt	|�t	|��D]\}}t
�||�s�dSq�dS)Nz
empty patternFrCT)rrDrAr�r�r�rrV�zipr3rgZfnmatchcase)	r.Zpath_patternr7r<r=Z	pat_partsr;r?r'r!r!r"r��s(zPurePath.matchN)T)T)2rFrGrHr�rr�classmethodr
rr�rrrrrr�rr�r�propertyrrr!r#r$r%r&r'rr�r=r)r~r.r0r1r3r4r5r8r9r;r:r=r>r?r@r�rr�r!r!r!r"r�sz	

	


��





	!	

	
rc@seZdZeZdZdS)rr!N)rFrGrH�_posix_flavourrr�r!r!r!r"rsrc@seZdZeZdZdS)rr!N)rFrGrH�_windows_flavourrr�r!r!r!r"rsrc@s�eZdZdZdd�Zdcdd�Zdd�Zd	d
�Zdd�Zdddd�Z	dedd�Z
edd��Zedd��Z
dd�Zdd�Zdd�Zdd�Zdd �Zdfd"d#�Zd$d%�Zd&d'�Zd(d)�Zdgd,d-�Zd.d/�Zdhd0d1�Zd2d3�Zdid4d5�Zd6d7�Zdjd9d:�Zdkd;d<�Zd=d>�Zd?d@�Z dldAdB�Z!dCdD�Z"dEdF�Z#dGdH�Z$dIdJ�Z%dmdKdL�Z&dMdN�Z'dOdP�Z(dQdR�Z)dSdT�Z*dUdV�Z+dWdX�Z,dYdZ�Z-d[d\�Z.d]d^�Z/d_d`�Z0dadb�Z1dS)nr)r�cOsL|turtjdkrtnt}|j|dd�}|jjs@td|j	f��|�
�|S)NrF�rz$cannot instantiate %r on your system)rror~rrrrr�r�rFr)r�r�kwargsr.r!r!r"r7s�zPath.__new__NcCs|dur|j|_nt|_dSr*)r��_normal_accessor)r.�templater!r!r"rAs
z
Path._initcCs|j|g}|�|j|j|�Sr*)r�r�r�r�)r.r?r;r!r!r"r�JszPath._make_child_relpathcCs|Sr*r!r-r!r!r"�	__enter__PszPath.__enter__cCsdSr*r!)r.�t�v�tbr!r!r"�__exit__Ss	z
Path.__exit__�cCs|j�|||�Sr*�r�r�)r.r~�flagsr�r!r!r"�_opener^szPath._opener�cCs|j�|||�Sr*rQ)r.rRr�r!r!r"�	_raw_openbszPath._raw_opencCs|t���Sr*)rorp�r�r!r!r"�cwdkszPath.cwdcCs||�j�d��Sr*)rr�rVr!r!r"�homersz	Path.homecCsB|��}z|��}Wnty2|j�|�}Yn0tj�||�Sr*)r�rr�rors�samestat)r.Z
other_path�stZother_str!r!r"�samefileysz
Path.samefileccs,|j�|�D]}|dvrq|�|�VqdS)N>r1r�)r�r�r�r/r!r!r"�iterdir�szPath.iterdirccsnt�d||�|s td�|���|j�|f�\}}}|s<|rDtd��tt|�|j�}|�	|�D]
}|Vq^dS)Nzpathlib.Path.globzUnacceptable pattern: {!r}�%Non-relative patterns are unsupported)
r8�auditr�r�rrAr�r�rr��r.rlr<r=r�Zselectorrar!r!r"�glob�sz	Path.globccs`t�d||�|j�|f�\}}}|s*|r2td��tdt|�|j�}|�|�D]
}|VqPdS)Nzpathlib.Path.rglobr])r�)r8r^rrAr�r�rr�r_r!r!r"�rglob�sz
Path.rglobcCs6|��r|S|jt��g|jdd�}|j|d�|S�NFrG�rJ)r�rrorpr�r)r.�objr!r!r"�absolute�s
z
Path.absoluteFcCsZ|jj||d�}|dur,|��t|���}|jj�|�}|j|fdd�}|j|d�|S)N)rtFrGrc)	rrvr�rnrer��normpathrr)r.rtr`Znormedrdr!r!r"rv�szPath.resolvecCs|j�|�Sr*)r�r�r-r!r!r"r��sz	Path.statcCs|j�|�Sr*)r�r�r-r!r!r"r��sz
Path.ownercCs|j�|�Sr*)r�r�r-r!r!r"r��sz
Path.group�rrRc	Cstj|||||||jd�S)N)Zopener)�ior�rS)r.r��	buffering�encoding�errors�newliner!r!r"r��s�z	Path.opencCs8|jdd��}|��Wd�S1s*0YdS)N�rb�r��r��readrr!r!r"�
read_bytes�szPath.read_bytescCs<|jd||d��}|��Wd�S1s.0YdS)Nrg�r�rjrkro)r.rjrkrr!r!r"�	read_text�szPath.read_textcCsBt|�}|jdd��}|�|�Wd�S1s40YdS)N�wbrn)�
memoryviewr��write)r.�dataZviewrr!r!r"�write_bytes�szPath.write_bytescCsXt|t�std|jj��|jd||d��}|�|�Wd�S1sJ0YdS)Nzdata must be str, not %s�wrr)r	rnrrrFr�rv)r.rwrjrkrr!r!r"�
write_text�s
�zPath.write_textcCs,|j�|�}|j|fdd�}|j|d�|Srb)r�r�rr)r.rsrdr!r!r"r�sz
Path.readlinkTcCsb|r.z|j�|d�Wnty(Yn0dStjtjB}|sH|tjO}|�||�}t�|�dSr*)	r�r�r�ro�O_CREAT�O_WRONLY�O_EXCLrU�close)r.r��exist_okrR�fdr!r!r"�touchs
z
Path.touchcCsxz|j�||�Wn`tyT|r.|j|kr0�|jjddd�|j|d|d�Yn tyr|rl|��sn�Yn0dS)NT)r@rF)r�r�rrr?r�r�)r.r�r@rr!r!r"r�&sz
Path.mkdircCs|j�||�dSr*)r�r��r.r�r!r!r"r�7sz
Path.chmodcCs|j�||�dSr*)r�r�r�r!r!r"r�=szPath.lchmodcCs.z|j�|�Wnty(|s$�Yn0dSr*)r�r�rr)r.Z
missing_okr!r!r"r�Ds
zPath.unlinkcCs|j�|�dSr*)r�r�r-r!r!r"r�Osz
Path.rmdircCs|j�|�Sr*)r�r�r-r!r!r"r�Usz
Path.lstatcCs|j�||�|�|�Sr*)r�r�rr�r!r!r"r�\s
zPath.renamecCs|j�||�|�|�Sr*)r�r4rr�r!r!r"r4is
zPath.replacecCs|j�|||�dSr*)r�r�)r.r�r�r!r!r"�
symlink_tovszPath.symlink_tocCs|j�||�dSr*)r�r�r�r!r!r"r�}s
zPath.link_toc
CsTz|��WnBty<}zt|�s&�WYd}~dSd}~0tyNYdS0dS�NFT)r�r�r#r��r.r�r!r!r"r��szPath.existsc
CsXzt|��j�WSty@}zt|�s*�WYd}~dSd}~0tyRYdS0dSr�)r	r��st_moder�r#r�r�r!r!r"r��szPath.is_dirc
CsXzt|��j�WSty@}zt|�s*�WYd}~dSd}~0tyRYdS0dSr�)rr�r�r�r#r�r�r!r!r"�is_file�szPath.is_filecCsn|��r|��sdSz|j��j}Wnty8YdS0|��j}||krPdS|��j}|j��j}||kSr�)r�r�r?r��st_devr��st_ino)r.Z
parent_devZdevZinoZ
parent_inor!r!r"�is_mount�s

z
Path.is_mountc
CsXzt|��j�WSty@}zt|�s*�WYd}~dSd}~0tyRYdS0dSr�)r
r�r�r�r#r�r�r!r!r"r��szPath.is_symlinkc
CsXzt|��j�WSty@}zt|�s*�WYd}~dSd}~0tyRYdS0dSr�)r
r�r�r�r#r�r�r!r!r"�is_block_device�szPath.is_block_devicec
CsXzt|��j�WSty@}zt|�s*�WYd}~dSd}~0tyRYdS0dSr�)rr�r�r�r#r�r�r!r!r"�is_char_device�szPath.is_char_devicec
CsXzt|��j�WSty@}zt|�s*�WYd}~dSd}~0tyRYdS0dSr�)rr�r�r�r#r�r�r!r!r"�is_fifo�szPath.is_fifoc
CsXzt|��j�WSty@}zt|�s*�WYd}~dSd}~0tyRYdS0dSr�)rr�r�r�r#r�r�r!r!r"�	is_socketszPath.is_socketcCs`|js\|js\|jr\|jddd�dkr\|j�|jddd��}|�|g|jdd��S|S)NrrC�~)r�r�r�rr�r)r.Zhomedirr!r!r"�
expandusers��zPath.expanduser)N)rP)rT)F)rgrRNNN)NN)NN)rPT)rTFF)F)F)2rFrGrHr�rrr�rKrOrSrUrCrWrXr[r\r`rarervr�r�r�r�rqrsrxrzr�r�r�r�r�r�r�r�r�r4r�r�r�r�r�r�r�r�r�r�r�r�r!r!r!r"r*sf	�
	

	




�
	
	

	




rc@seZdZdZdS)rr!N)rFrGrHr�r!r!r!r"r*src@seZdZdZdd�ZdS)rr!cCstd��dS)Nz-Path.is_mount() is unsupported on this systemr�r-r!r!r"r�8szWindowsPath.is_mountN)rFrGrHr�r�r!r!r!r"r1sr)Arg�	functoolsrhr�ror�rer8�_collections_abcrrrrrrr�operatorrr�r	r
rrr
rrZurllib.parserr�r�r~rZgetwindowsversionr�__all__rr r#r(rr)rIr�rFrEr�r�rIr�r�r�r�r�r�r�r�r�r�PathLike�registerrrrrrr!r!r!r"�<module>sr$

?0iF
,



?>