AlkantarClanX12

Your IP : 18.227.48.237


Current Path : /proc/self/root/usr/lib64/python3.6/__pycache__/
Upload File :
Current File : //proc/self/root/usr/lib64/python3.6/__pycache__/pathlib.cpython-36.opt-1.pyc

3


 \V��@sVddlZddlZddlZddlZddlZddlZddlZddlZddlm	Z	ddl
mZddlm
Z
mZmZddlmZddlmZmZmZmZmZmZmZddlmZdZejd	kr�ddlZej �dd
�d5kr�ddlm!Z!q�d
ZdZ!ndZddddddgZ"dd�Z#Gdd�de$�Z%Gdd�de%�Z&Gdd�de%�Z'e&�Z(e'�Z)Gdd�d�Z*Gdd�de*�Z+e+�Z,d d!�Z-e.ed"��r�ej/�e-�Z-Gd#d$�d$�Z0Gd%d&�d&�Z1Gd'd(�d(e0�Z2Gd)d*�d*e0�Z3Gd+d,�d,e0�Z4Gd-d.�d.e	�Z5Gd/d�de$�Z6ej7j8e6�Gd0d�de6�Z9Gd1d�de6�Z:Gd2d�de6�Z;Gd3d�de;e9�Z<Gd4d�de;e:�Z=dS)6�N)�Sequence)�contextmanager)�EINVAL�ENOENT�ENOTDIR)�
attrgetter)�S_ISDIR�S_ISLNK�S_ISREG�S_ISSOCK�S_ISBLK�S_ISCHR�S_ISFIFO)�quote_from_bytesT�nt��)�_getfinalpathnameF�PurePath�
PurePosixPath�PureWindowsPath�Path�	PosixPath�WindowsPathcCsd|kpd|kpd|kS)N�*�?�[�)�patrr�/usr/lib64/python3.6/pathlib.py�_is_wildcard_pattern&sr c@s(eZdZdZdd�Zdd�Zdd�ZdS)	�_FlavourzPA flavour implements a particular (platform-specific) set of path
    semantics.cCs|jj|_dS)N)�sep�join)�selfrrr�__init__0sz_Flavour.__init__cCs g}|j}|j}d}}t|�}x�|D]�}|s0q&|r@|j||�}|j|�\}}}	||	kr�xPt|	j|��D] }
|
rh|
dkrh|jtj|
��qhWn|	r�|	dkr�|jtj|	��|s�|r&|s�x6|D].}|s�q�|r�|j||�}|j|�d}|r�Pq�WPq&W|�s|�r|j||�|j	�|||fS)N��.r)
r"�altsep�reversed�replace�	splitroot�split�append�sys�intern�reverse)r$�partsZparsedr"r(�drv�root�it�partZrel�xrrr�parse_parts3s@

z_Flavour.parse_partscCs||r,|rr|rr||||g|dd�fSnF|rd||ksL|j|�|j|�krr||||dd�fSn||||fS|||fS)z�
        Join the two paths represented by the respective
        (drive, root, parts) tuples.  Return a new (drive, root, parts) tuple.
        �N)�casefold)r$r2r3r1Zdrv2Zroot2Zparts2rrr�join_parsed_partsYs
z_Flavour.join_parsed_partsN)�__name__�
__module__�__qualname__�__doc__r%r7r:rrrrr!,s&r!c@s�eZdZdZdZdZeZej	dkZ
edd�ee
d�e
d�d	�D��ed
d�ee
d�e
d�d	�D��BZd
Zddddhdd�ed	d�D�Bdd�ed	d�D�BZefdd�Zdd�Zdd�Zd*dd�Zefdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)S)+�_WindowsFlavour�\�/Trccs|]}t|�VqdS)N)�chr)�.0r6rrr�	<genexpr>wsz_WindowsFlavour.<genexpr>�a�zr8ccs|]}t|�VqdS)N)rB)rCr6rrrrDxs�A�Zz\\?\ZCONZPRNZAUXZNULcCsh|]}d|�qS)zCOM%dr)rC�irrr�	<setcomp>~sz_WindowsFlavour.<setcomp>�
cCsh|]}d|�qS)zLPT%dr)rCrIrrrrJscCsb|dd�}|dd�}||krP||krP|j|�\}}|dd�}|dd�}nd}|dd�}||kov||kov||k�r|j|d�}|dk�r|j||d�}||dk�r|dkr�t|�}|r�||d|�|||dd�fS|d|�|||dd�fSd}	}
|dk�r<||jk�r<|dd�}	|dd�}|}||k�rT|}
|j|�}||	|
|fS)	Nrr8rr&��:���rN)�_split_extended_path�find�len�
drive_letters�lstrip)r$r5r"�first�second�prefixZthird�indexZindex2r2r3rrrr+�s6
"

z_WindowsFlavour.splitrootcCs|j�S)N)�lower)r$�srrrr9�sz_WindowsFlavour.casefoldcCsdd�|D�S)NcSsg|]}|j��qSr)rX)rC�prrr�
<listcomp>�sz2_WindowsFlavour.casefold_parts.<locals>.<listcomp>r)r$r1rrr�casefold_parts�sz_WindowsFlavour.casefold_partsFcCs�t|�}|stj�Sd}tdk	r�|r2|jt|��Sg}xly|jt|��}Wn>tk
r�|}tjj|�\}}|j|�||kr�|SYq8Xtjj	|ft
|���Sq8WdS)N)�str�os�getcwdr�_ext_to_normal�FileNotFoundError�pathr,r-r#r))r$rb�strictrYZ
previous_sZ
tail_parts�tailrrr�resolve�s&

z_WindowsFlavour.resolvecCsXd}|j|�rP|dd�}|dd�}|jd�rP||dd�7}d|dd�}||fS)Nr&�zUNC\rLr@)�
startswith)r$rYZ
ext_prefixrVrrrrO�s

z$_WindowsFlavour._split_extended_pathcCs|j|�dS)Nr8)rO)r$rYrrrr`�sz_WindowsFlavour._ext_to_normalcCs6|sdS|djd�rdS|djd�dj�|jkS)NFrz\\r8r'rN)rg�	partition�upper�reserved_names)r$r1rrr�is_reserved�s
z_WindowsFlavour.is_reservedcCsd|j}t|�dkrJ|ddkrJ|j�dd�jd�}d|t|jd��fSdt|j�jd��SdS)Nrr8rMrAz
file:///%s/%szutf-8zfile:)�driverQ�as_posixrS�urlquote_from_bytes�encode)r$rbrl�restrrr�make_uri�sz_WindowsFlavour.make_uric
Cs�dtjkrtjd}n`dtjkr,tjd}nJdtjkrnytjd}Wntk
r\d}YnX|tjd}ntd��|r�tjd|kr�|j|f�\}}}|d
tjdkr�td	|��||d<|s�|r�|||j|dd��}n
|j|�}|S)N�HOMEZUSERPROFILEZHOMEPATHZ	HOMEDRIVEr&zCan't determine home directoryZUSERNAMEr8z%Can't determine home directory for %rrNrN)r^�environ�KeyError�RuntimeErrorr7r#)r$�username�userhomer2r3r1rrr�
gethomedir�s,




z_WindowsFlavour.gethomedirN)F)r;r<r=r"r(�has_drv�ntpath�pathmodr^�name�is_supported�set�range�ordrRZext_namespace_prefixrjr+r9r\rerOr`rkrqrxrrrrr?ks&
"&	'

r?c@sdeZdZdZdZdZeZej	dkZ
efdd�Zdd�Zd	d
�Z
ddd�Zd
d�Zdd�Zdd�ZdS)�
_PosixFlavourrAr&FrcCsV|rH|d|krH|j|�}t|�t|�dkr<d|d|fSd||fSn
dd|fSdS)Nrrr&)rSrQ)r$r5r"Z
stripped_partrrrr+s
z_PosixFlavour.splitrootcCs|S)Nr)r$rYrrrr9)sz_PosixFlavour.casefoldcCs|S)Nr)r$r1rrrr\,sz_PosixFlavour.casefold_partscsJ|j�|j�i������fdd��|j�r0dntj�}�|t|��pH�S)Ncs�|j��rd}x�|j��D]�}|s|dkr.q|dkrH|j��\}}}q|�|}|�krz�|}|dk	rnqtd|��y�j|�}Wn6tk
r�}z|jtkr��r��|}WYdd}~XqXd�|<�||�}|�|<qW|S)Nr&r'z..zSymlink loop from %r)rgr,�
rpartitionru�readlink�OSError�errnor)rbrpr|�_�newpath�target�e)�_resolve�accessor�seenr"rcrrr�3s0

z'_PosixFlavour.resolve.<locals>._resolver&)r"�	_accessor�is_absoluter^r_r])r$rbrc�baser)r�r�r�r"rcrre/s&z_PosixFlavour.resolvecCsdS)NFr)r$r1rrrrk\sz_PosixFlavour.is_reservedcCst|�}dt|�S)Nzfile://)�bytesrn)r$rbZbpathrrrrq_sz_PosixFlavour.make_uricCst|s:y
tjdStk
r6ddl}|jtj��jSXn6ddl}y|j|�jStk
rntd|��YnXdS)Nrrrz%Can't determine home directory for %r)	r^rsrt�pwd�getpwuid�getuid�pw_dir�getpwnamru)r$rvr�rrrrxes
z_PosixFlavour.gethomedirN)F)r;r<r=r"r(ry�	posixpathr{r^r|r}r+r9r\rerkrqrxrrrrr�s

-r�c@seZdZdZdS)�	_AccessorzjAn accessor implements a particular (system-specific or not) way of
    accessing paths on the filesystem.N)r;r<r=r>rrrrr�ysr�c@s�eZdZdd�Zdd�Zeej�Zeej�Zeej�Zeej	�Z	eej
�Z
eej�Zeed�rjeej
�Z
ndd�Z
eej�Zeej�Zeej�Zeej�Zeej�Zer�er�eej�Zq�dd	�Zned
d	��Zeej�Zdd�Zd
S)�_NormalAccessorcstj���fdd��}t|�S)Ncs�t|�f|��S)N)r])�pathobj�args)�strfuncrr�wrapped�sz._NormalAccessor._wrap_strfunc.<locals>.wrapped)�	functools�wraps�staticmethod)r�r�r)r�r�
_wrap_strfunc�sz_NormalAccessor._wrap_strfunccstj���fdd��}t|�S)Ncs�t|�t|�f|��S)N)r])ZpathobjAZpathobjBr�)r�rrr��sz5_NormalAccessor._wrap_binary_strfunc.<locals>.wrapped)r�r�r�)r�r�r)r�r�_wrap_binary_strfunc�sz$_NormalAccessor._wrap_binary_strfunc�lchmodcCstd��dS)Nz%lchmod() not available on this system)�NotImplementedError)r$r��moderrrr��sz_NormalAccessor.lchmodcCstd��dS)Nz&symlink() not available on this system)r�)rE�b�target_is_directoryrrr�symlink�sz_NormalAccessor.symlinkcCstjt|�t|��S)N)r^r�r])rEr�r�rrrr��scCs
tj|�S)N)r^r�)r$rbrrrr��sz_NormalAccessor.readlinkN)r;r<r=r�r�r^�stat�lstat�open�listdir�scandir�chmod�hasattrr��mkdir�unlink�rmdir�renamer*r�supports_symlinksr�r��utimer�rrrrr�~s.













r�cCsP|d}|dd�}|dkr"t}n$d|kr4td��nt|�rBt}nt}|||�S)Nrr8z**z:Invalid pattern: '**' can only be an entire path component)�_RecursiveWildcardSelector�
ValueErrorr �_WildcardSelector�_PreciseSelector)�
pattern_partsr�child_parts�clsrrr�_make_selector�s
r��	lru_cachec@s eZdZdZdd�Zdd�ZdS)�	_SelectorzYA selector matches a specific glob pattern part against the children
    of a given path.cCs.||_|rt|�|_d|_nt�|_d|_dS)NTF)r�r��	successor�dironly�_TerminatingSelector)r$r�rrrr%�s
z_Selector.__init__cCs<t|�}|j}|j}|jj}||�s,tg�S|j||||�S)zuIterate over all child paths of `parent_path` matched by this
        selector.  This can contain parent_path itself.)�type�is_dir�existsr�r��iter�_select_from)r$�parent_pathZpath_clsr�r�r�rrr�select_from�sz_Selector.select_fromN)r;r<r=r>r%r�rrrrr��s	r�c@seZdZdd�ZdS)r�ccs
|VdS)Nr)r$r�r�r�r�rrrr��sz!_TerminatingSelector._select_fromN)r;r<r=r�rrrrr��sr�c@seZdZdd�Zdd�ZdS)r�cCs||_tj||�dS)N)r|r�r%)r$r|r�rrrr%�sz_PreciseSelector.__init__ccs^yD|j|j�}|jr|n||�rBx |jj||||�D]
}|Vq4WWntk
rXdSXdS)N)�_make_child_relpathr|r�r�r��PermissionError)r$r�r�r�r�rbrZrrrr��sz_PreciseSelector._select_fromN)r;r<r=r%r�rrrrr��sr�c@seZdZdd�Zdd�ZdS)r�cCs"tjtj|��|_tj||�dS)N)�re�compile�fnmatch�	translaterr�r%)r$rr�rrrr%sz_WildcardSelector.__init__ccs�y||jj}t||��}xb|D]Z}|js0|j�r|j}||�}	|jj|	�r|j|�}
x |j	j
|
|||�D]
}|VqhWqWWntk
r�dSXdS)N)�_flavourr9�listr�r�r|r�matchr�r�r�r�)r$r�r�r�r��cf�entries�entryr|Z
casefoldedrbrZrrrr�s

z_WildcardSelector._select_fromN)r;r<r=r%r�rrrrr�sr�c@s$eZdZdd�Zdd�Zdd�ZdS)r�cCstj||�dS)N)r�r%)r$rr�rrrr%sz#_RecursiveWildcardSelector.__init__ccsz|VyZt||��}xH|D]@}|j�r|j�r|j|j�}x|j|||�D]
}|VqLWqWWntk
rtdSXdS)N)r�r��
is_symlinkr�r|�_iterate_directoriesr�)r$r�r�r�r�r�rbrZrrrr�s
z/_RecursiveWildcardSelector._iterate_directoriesc	cs�yjt�}zT|jj}xF|j|||�D]4}x.|||||�D]}||kr6|V|j|�q6Wq"WWd|j�XWntk
r~dSXdS)N)r~r�r�r��add�clearr�)	r$r�r�r�r�ZyieldedZsuccessor_selectZstarting_pointrZrrrr�*sz'_RecursiveWildcardSelector._select_fromN)r;r<r=r%r�r�rrrrr�sr�c@s4eZdZdZdZdd�Zdd	�Zd
d�Zdd
�ZdS)�_PathParentszvThis object provides sequence-like access to the logical ancestors
    of a path.  Don't try to construct it yourself.�_pathcls�_drv�_root�_partscCs&t|�|_|j|_|j|_|j|_dS)N)r�r�r�r�r�)r$rbrrrr%Cs
z_PathParents.__init__cCs(|js|jrt|j�dSt|j�SdS)Nr8)r�r�rQr�)r$rrr�__len__Jsz_PathParents.__len__cCs@|dks|t|�krt|��|jj|j|j|jd|d��S)Nrr8)rQ�
IndexErrorr��_from_parsed_partsr�r�r�)r$�idxrrr�__getitem__Psz_PathParents.__getitem__cCsdj|jj�S)Nz<{}.parents>)�formatr�r;)r$rrr�__repr__Vsz_PathParents.__repr__N)r�r�r�r�)	r;r<r=r>�	__slots__r%r�r�r�rrrrr�>sr�c@s�eZdZdZdZZd	d
�Zdd�Zed
d��Zed[dd��Z	ed\dd��Z
edd��Zdd�Zdd�Z
dd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zed&d'��Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zd2d3�Zeed�d4d5�Zeed�d6d5�Zed7d8��Zed9d:��Z ed;d<��Z!ed=d>��Z"ed?d@��Z#dAdB�Z$dCdD�Z%dEdF�Z&edGdH��Z'dIdJ�Z(dKdL�Z)dMdN�Z*edOdP��Z+edQdR��Z,dSdT�Z-dUdV�Z.dWdX�Z/dYS)]ra|Base class for manipulating paths without I/O.

    PurePath represents a filesystem path and offers operations which
    don't imply any actual filesystem I/O.  Depending on your system,
    instantiating a PurePath will return either a PurePosixPath or a
    PureWindowsPath object.  You can also instantiate either of these classes
    directly, regardless of your system.
    r�r�r��_str�_hash�_pparts�_cached_cpartscGs$|tkrtjdkrtnt}|j|�S)z�Construct a PurePath from one or several strings and or existing
        PurePath objects.  The strings and path objects are combined so as
        to yield a canonicalized path, which is incorporated into the
        new PurePath object.
        r)rr^r|rr�_from_parts)r�r�rrr�__new__hszPurePath.__new__cCs|jt|j�fS)N)�	__class__�tupler�)r$rrr�
__reduce__rszPurePath.__reduce__cCshg}xV|D]N}t|t�r$||j7}q
tj|�}t|t�rH|jt|��q
tdt|���q
W|j	j
|�S)NzNargument should be a str object or an os.PathLike object returning str, not %r)�
isinstancerr�r^�fspathr]r-�	TypeErrorr�r�r7)r�r�r1rErrr�_parse_argsws



zPurePath._parse_argsTcCs<tj|�}|j|�\}}}||_||_||_|r8|j�|S)N)�objectr�r�r�r�r��_init)r�r��initr$r2r3r1rrrr��s
zPurePath._from_partscCs,tj|�}||_||_||_|r(|j�|S)N)r�r�r�r�r�r�)r�r2r3r1r�r$rrrr��s
zPurePath._from_parsed_partscCs4|s|r$|||jj|dd��S|jj|�SdS)Nr8)r�r#)r�r2r3r1rrr�_format_parsed_parts�szPurePath._format_parsed_partscCsdS)Nr)r$rrrr��szPurePath._initcCs@|j|�\}}}|jj|j|j|j|||�\}}}|j|||�S)N)r�r�r:r�r�r�r�)r$r�r2r3r1rrr�_make_child�szPurePath._make_childcCs<y|jStk
r6|j|j|j|j�p,d|_|jSXdS)z[Return the string representation of the path, suitable for
        passing to system calls.r'N)r��AttributeErrorr�r�r�r�)r$rrr�__str__�szPurePath.__str__cCst|�S)N)r])r$rrr�
__fspath__�szPurePath.__fspath__cCs|j}t|�j|jd�S)zNReturn the string representation of the path with forward (/)
        slashes.rA)r�r]r*r")r$�frrrrm�szPurePath.as_posixcCstjt|��S)zaReturn the bytes representation of the path.  This is only
        recommended to use under Unix.)r^�fsencoder])r$rrr�	__bytes__�szPurePath.__bytes__cCsdj|jj|j��S)Nz{}({!r}))r�r�r;rm)r$rrrr��szPurePath.__repr__cCs|j�std��|jj|�S)z Return the path as a 'file' URI.z.relative path can't be expressed as a file URI)r�r�r�rq)r$rrr�as_uri�szPurePath.as_uricCs2y|jStk
r,|jj|j�|_|jSXdS)N)r�r�r�r\r�)r$rrr�_cparts�s
zPurePath._cpartscCs&t|t�stS|j|jko$|j|jkS)N)r�r�NotImplementedr�r�)r$�otherrrr�__eq__�s
zPurePath.__eq__cCs2y|jStk
r,tt|j��|_|jSXdS)N)r�r��hashr�r�)r$rrr�__hash__�s
zPurePath.__hash__cCs(t|t�s|j|jk	rtS|j|jkS)N)r�rr�rr�)r$rrrr�__lt__�szPurePath.__lt__cCs(t|t�s|j|jk	rtS|j|jkS)N)r�rr�rr�)r$rrrr�__le__�szPurePath.__le__cCs(t|t�s|j|jk	rtS|j|jkS)N)r�rr�rr�)r$rrrr�__gt__�szPurePath.__gt__cCs(t|t�s|j|jk	rtS|j|jkS)N)r�rr�rr�)r$rrrr�__ge__�szPurePath.__ge__z.The drive prefix (letter or UNC path), if any.)�doczThe root of the path, if any.cCs|j|j}|S)z/The concatenation of the drive and root, or ''.)r�r�)r$�anchorrrrr
szPurePath.anchorcCs.|j}t|�|js|jrdndkr&dS|dS)z!The final path component, if any.r8rr&rN)r�rQr�r�)r$r1rrrr|	sz
PurePath.namecCsD|j}|jd�}d|ko*t|�dknr<||d�SdSdS)z*The final component's last suffix, if any.r'rr8Nr&)r|�rfindrQ)r$r|rIrrr�suffixs

 zPurePath.suffixcCs:|j}|jd�rgS|jd�}dd�|jd�dd�D�S)z1A list of the final component's suffixes, if any.r'cSsg|]}d|�qS)r'r)rCrrrrr["sz%PurePath.suffixes.<locals>.<listcomp>r8N)r|�endswithrSr,)r$r|rrr�suffixess


zPurePath.suffixescCsD|j}|jd�}d|ko*t|�dknr<|d|�S|SdS)z0The final path component, minus its last suffix.r'rr8N)r|rrQ)r$r|rIrrr�stem$s

 z
PurePath.stemcCs�|jstd|f��|jj|f�\}}}|sZ|d|jj|jjgksZ|sZ|sZt|�dkrftd|��|j|j|j	|j
dd�|g�S)z-Return a new path with the file name changed.z%r has an empty namer8zInvalid name %rNrNrN)r|r�r�r7r"r(rQr�r�r�r�)r$r|r2r3r1rrr�	with_name.szPurePath.with_namecCs�|j}|j|ks |jr,|j|kr,td|��|r<|jd�sD|dkrPtd|��|j}|shtd|f��|j}|s|||}n|dt|��|}|j|j	|j
|jdd�|g�S)z�Return a new path with the file suffix changed.  If the path
        has no suffix, add given suffix.  If the given suffix is an empty
        string, remove the suffix from the path.
        zInvalid suffix %rr'z%r has an empty nameNr8rN)r�r"r(r�rgr|rrQr�r�r�r�)r$rr�r|Z
old_suffixrrr�with_suffix9s
zPurePath.with_suffixc
Gs�|std��|j}|j}|j}|r8||g|dd�}n|}|j|�\}}}|rf||g|dd�}	n|}	t|	�}
|jj}|
dkr�|p�|n||d|
��||	�kr�|j|||�}t	dj
t|�t|����|jd|
dkr�|nd||
d��S)z�Return the relative path to another path identified by the passed
        arguments.  If the operation is not possible (because this is not
        a subpath of the other path), raise ValueError.
        zneed at least one argumentr8Nrz{!r} does not start with {!r}r&)
r�r�r�r�r�rQr�r\r�r�r�r]r�)
r$rr1r2r3Z	abs_partsZto_drvZto_rootZto_partsZto_abs_parts�nr�Z	formattedrrr�relative_toNs(	(zPurePath.relative_tocCs.y|jStk
r(t|j�|_|jSXdS)zZAn object providing sequence-like access to the
        components in the filesystem path.N)r�r�r�r�)r$rrrr1ns
zPurePath.partscGs
|j|�S)z�Combine this path with one or several arguments, and return a
        new path representing either a subpath (if all arguments are relative
        paths) or a totally different path (if one of the arguments is
        anchored).
        )r�)r$r�rrr�joinpathzszPurePath.joinpathcCs|j|f�S)N)r�)r$�keyrrr�__truediv__�szPurePath.__truediv__cCs|j|g|j�S)N)r�r�)r$rrrr�__rtruediv__�szPurePath.__rtruediv__cCs@|j}|j}|j}t|�dkr*|s&|r*|S|j|||dd��S)zThe logical parent of the path.r8NrN)r�r�r�rQr�)r$r2r3r1rrr�parent�szPurePath.parentcCst|�S)z*A sequence of this path's logical parents.)r�)r$rrr�parents�szPurePath.parentscCs|js
dS|jjpt|j�S)zSTrue if the path is absolute (has both a root and, if applicable,
        a drive).F)r�r�ry�boolr�)r$rrrr��szPurePath.is_absolutecCs|jj|j�S)zaReturn True if the path contains one of the special names reserved
        by the system, if any.)r�rkr�)r$rrrrk�szPurePath.is_reservedc	Cs�|jj}||�}|jj|f�\}}}|s0td��|rF|||j�krFdS|r\|||j�kr\dS|j}|sj|r�t|�t|�kr~dS|dd�}nt|�t|�kr�dSx.tt	|�t	|��D]\}}t
j||�s�dSq�WdS)zE
        Return True if this path matches the given pattern.
        z
empty patternFr8NT)r�r9r7r�r�r�r�rQ�zipr)r�Zfnmatchcase)	r$Zpath_patternr�r2r3Z	pat_partsr1r5rrrrr��s(zPurePath.matchN)r�r�r�r�r�r�r�)T)T)0r;r<r=r>r�r�r��classmethodr�r�r�r�r�r�r�r�rmr�r�r��propertyr�rrrrrrrrlr3r
r|rrrrrrr1rrrrrr�rkr�rrrrrZs^
	
	
	
 
c@seZdZdZeZfZdS)rz�PurePath subclass for non-Windows systems.

    On a POSIX system, instantiating a PurePath should return this object.
    However, you can also instantiate it directly on any system.
    N)r;r<r=r>�_posix_flavourr�r�rrrrr�sc@seZdZdZeZfZdS)rz�PurePath subclass for Windows systems.

    On a Windows system, instantiating a PurePath should return this object.
    However, you can also instantiate it directly on any system.
    N)r;r<r=r>�_windows_flavourr�r�rrrrr�sc@s�eZdZdZdaZdd�Zdbdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dcdd�Zdddd�Ze
dd��Ze
dd��Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zded&d'�Zd(d)�Zd*d+�Zd,d-�Zdgd0d1�Zd2d3�Zdhd4d5�Zd6d7�Zdid8d9�Zdjd;d<�Zdkd=d>�Zd?d@�Z dAdB�Z!dCdD�Z"dEdF�Z#dGdH�Z$dIdJ�Z%dKdL�Z&dldMdN�Z'dOdP�Z(dQdR�Z)dSdT�Z*dUdV�Z+dWdX�Z,dYdZ�Z-d[d\�Z.d]d^�Z/d_d`�Z0dS)mra�PurePath subclass that can make system calls.

    Path represents a filesystem path but unlike PurePath, also offers
    methods to do system calls on path objects. Depending on your system,
    instantiating a Path will return either a PosixPath or a WindowsPath
    object. You can also instantiate a PosixPath or WindowsPath directly,
    but cannot instantiate a WindowsPath on a POSIX system or vice versa.
    r��_closedcOsL|tkrtjdkrtnt}|j|dd�}|jjs@td|j	f��|j
�|S)NrF)r�z$cannot instantiate %r on your system)rr^r|rrr�r�r}r�r;r�)r�r��kwargsr$rrrr��szPath.__new__NcCs"d|_|dk	r|j|_nt|_dS)NF)r r��_normal_accessor)r$�templaterrrr��s
z
Path._initcCs|j|g}|j|j|j|�S)N)r�r�r�r�)r$r5r1rrrr��szPath._make_child_relpathcCs|jr|j�|S)N)r �
_raise_closed)r$rrr�	__enter__szPath.__enter__cCs
d|_dS)NT)r )r$�t�v�tbrrr�__exit__sz
Path.__exit__cCstd��dS)NzI/O operation on closed path)r�)r$rrrr$szPath._raise_closed�cCs|jj|||�S)N)r�r�)r$r|�flagsr�rrr�_openerszPath._opener�cCs|jr|j�|jj|||�S)zm
        Open the file pointed by this path and return a file descriptor,
        as os.open() does.
        )r r$r�r�)r$r+r�rrr�	_raw_openszPath._raw_opencCs|tj��S)zjReturn a new path pointing to the current working directory
        (as returned by os.getcwd()).
        )r^r_)r�rrr�cwdszPath.cwdcCs||�jjd��S)zrReturn a new path pointing to the user's home directory (as
        returned by os.path.expanduser('~')).
        N)r�rx)r�rrr�home!sz	Path.homecCsB|j�}y|j�}Wntk
r2tj|�}YnXtjj||�S)zoReturn whether other_path is the same or not as this file
        (as returned by os.path.samefile()).
        )r�r�r^rb�samestat)r$Z
other_path�stZother_strrr�samefile(sz
Path.samefileccsL|jr|j�x8|jj|�D](}|dkr*q|j|�V|jr|j�qWdS)zyIterate over the files in this directory.  Does not yield any
        result for the special paths '.' and '..'.
        r'�..N>r4r')r r$r�r�r�)r$r|rrr�iterdir3szPath.iterdirccsl|stdj|���|jj|�}|jj|f�\}}}|s:|rBtd��tt|��}x|j|�D]
}|VqZWdS)z�Iterate over this subtree and yield all existing files (of any
        kind, including directories) matching the given pattern.
        zUnacceptable pattern: {!r}z%Non-relative patterns are unsupportedN)	r�r�r�r9r7r�r�r�r�)r$�patternr2r3r��selectorrZrrr�globAsz	Path.globccs^|jj|�}|jj|f�\}}}|s(|r0td��tdt|��}x|j|�D]
}|VqLWdS)z�Recursively yield all existing files (of any kind, including
        directories) matching the given pattern, anywhere in this subtree.
        z%Non-relative patterns are unsupported�**N)r9)r�r9r7r�r�r�r�)r$r6r2r3r�r7rZrrr�rglobOsz
Path.rglobcCsD|jr|j�|j�r|S|jtj�g|jdd�}|j|d�|S)aReturn an absolute version of this path.  This function works
        even if the path doesn't point to anything.

        No normalization is done, i.e. all '.' and '..' will be kept along.
        Use resolve() to get the canonical path to a file.
        F)r�)r#)r r$r�r�r^r_r�r�)r$�objrrr�absolute[sz
Path.absoluteFcCsh|jr|j�|jj||d�}|dkr:|j�t|j��}|jjj|�}|j	|fdd�}|j
|d�|S)z�
        Make the path absolute, resolving all symlinks on the way and also
        normalizing it (for example turning slashes into backslashes under
        Windows).
        )rcNF)r�)r#)r r$r�rer�r]r<r{�normpathr�r�)r$rcrYZnormedr;rrrremszPath.resolvecCs|jj|�S)zh
        Return the result of the stat() system call on this path, like
        os.stat() does.
        )r�r�)r$rrrr��sz	Path.statcCsddl}|j|j�j�jS)z:
        Return the login name of the file owner.
        rN)r�r�r��st_uidZpw_name)r$r�rrr�owner�sz
Path.ownercCsddl}|j|j�j�jS)z8
        Return the group name of the file gid.
        rN)�grpZgetgrgidr��st_gidZgr_name)r$r@rrr�group�sz
Path.group�rr8c	Cs,|jr|j�tjt|�||||||jd�S)z|
        Open the file pointed by this path and return a file object, as
        the built-in open() function does.
        )�opener)r r$�ior�r]r,)r$r��	buffering�encoding�errors�newlinerrrr��sz	Path.openc	Cs |jdd��
}|j�SQRXdS)zK
        Open the file in bytes mode, read it, and close the file.
        �rb)r�N)r��read)r$r�rrr�
read_bytes�szPath.read_bytesc	Cs$|jd||d��
}|j�SQRXdS)zJ
        Open the file in text mode, read it, and close the file.
        rC)r�rGrHN)r�rK)r$rGrHr�rrr�	read_text�szPath.read_textc	Cs*t|�}|jdd��}|j|�SQRXdS)zO
        Open the file in bytes mode, write to it, and close the file.
        �wb)r�N)�
memoryviewr��write)r$�dataZviewr�rrr�write_bytes�szPath.write_bytesc	Cs@t|t�std|jj��|jd||d��}|j|�SQRXdS)zN
        Open the file in text mode, write to it, and close the file.
        zdata must be str, not %s�w)r�rGrHN)r�r]r�r�r;r�rP)r$rQrGrHr�rrr�
write_text�s

zPath.write_textTcCsr|jr|j�|r>y|jj|d�Wntk
r8YnXdStjtjB}|sX|tjO}|j	||�}tj
|�dS)zS
        Create this file with the given access mode, if it doesn't exist.
        N)r r$r�r�r�r^�O_CREAT�O_WRONLY�O_EXCLr.�close)r$r��exist_okr+�fdrrr�touch�s
z
Path.touchcCs�|jr|j�y|jj||�Wnjtk
rf|s@|j|krB�|jjddd�|j|d|d�Yn&tk
r�|s�|j�r��YnXdS)z<
        Create a new directory at this given path.
        T)rrYFN)r r$r�r�rarr�r�)r$r�rrYrrrr��sz
Path.mkdircCs |jr|j�|jj||�dS)zF
        Change the permissions of the path, like os.chmod().
        N)r r$r�r�)r$r�rrrr��sz
Path.chmodcCs |jr|j�|jj||�dS)z�
        Like chmod(), except if the path points to a symlink, the symlink's
        permissions are changed, rather than its target's.
        N)r r$r�r�)r$r�rrrr��szPath.lchmodcCs|jr|j�|jj|�dS)zd
        Remove this file or link.
        If the path is a directory, use rmdir() instead.
        N)r r$r�r�)r$rrrr��szPath.unlinkcCs|jr|j�|jj|�dS)zF
        Remove this directory.  The directory must be empty.
        N)r r$r�r�)r$rrrr�sz
Path.rmdircCs|jr|j�|jj|�S)z�
        Like stat(), except if the path points to a symlink, the symlink's
        status information is returned, rather than its target's.
        )r r$r�r�)r$rrrr�sz
Path.lstatcCs |jr|j�|jj||�dS)z5
        Rename this path to the given path.
        N)r r$r�r�)r$r�rrrr�szPath.renamecCs |jr|j�|jj||�dS)zo
        Rename this path to the given path, clobbering the existing
        destination if it exists.
        N)r r$r�r*)r$r�rrrr*szPath.replacecCs"|jr|j�|jj|||�dS)z�
        Make this path a symlink pointing to the given path.
        Note the order of arguments (self, target) is the reverse of os.symlink's.
        N)r r$r�r�)r$r�r�rrr�
symlink_to(szPath.symlink_tocCsBy|j�Wn0tk
r<}z|jttfkr.�dSd}~XnXdS)z+
        Whether this path exists.
        FNT)r�r�r�rr)r$r�rrrr�3szPath.existscCsDyt|j�j�Stk
r>}z|jttfkr0�dSd}~XnXdS)z3
        Whether this path is a directory.
        FN)rr��st_moder�r�rr)r$r�rrrr�?szPath.is_dircCsDyt|j�j�Stk
r>}z|jttfkr0�dSd}~XnXdS)zq
        Whether this path is a regular file (also True for symlinks pointing
        to regular files).
        FN)r
r�r]r�r�rr)r$r�rrr�is_fileLszPath.is_filecCsDyt|j�j�Stk
r>}z|jttfkr0�dSd}~XnXdS)z7
        Whether this path is a symbolic link.
        FN)r	r�r]r�r�rr)r$r�rrrr�ZszPath.is_symlinkcCsDyt|j�j�Stk
r>}z|jttfkr0�dSd}~XnXdS)z6
        Whether this path is a block device.
        FN)rr�r]r�r�rr)r$r�rrr�is_block_devicefszPath.is_block_devicecCsDyt|j�j�Stk
r>}z|jttfkr0�dSd}~XnXdS)z:
        Whether this path is a character device.
        FN)r
r�r]r�r�rr)r$r�rrr�is_char_devicesszPath.is_char_devicecCsDyt|j�j�Stk
r>}z|jttfkr0�dSd}~XnXdS)z.
        Whether this path is a FIFO.
        FN)rr�r]r�r�rr)r$r�rrr�is_fifo�szPath.is_fifocCsDyt|j�j�Stk
r>}z|jttfkr0�dSd}~XnXdS)z0
        Whether this path is a socket.
        FN)rr�r]r�r�rr)r$r�rrr�	is_socket�szPath.is_socketcCsb|jp
|jr^|jr^|jddd�dkr^|jj|jddd��}|j|g|jdd��S|S)zl Return a new path with expanded ~ and ~user constructs
        (as returned by os.path.expanduser)
        rNr8�~)r�r�r�r�rxr�)r$Zhomedirrrr�
expanduser�s
zPath.expanduser)r�r )N)r*)r-)FrN)rCrNNNN)NN)NN)r*T)r-FF)F)1r;r<r=r>r�r�r�r�r%r)r$r,r.rr/r0r3r5r8r:r<rer�r?rBr�rLrMrRrTr[r�r�r�r�r�r�r�r*r\r�r�r^r�r_r`rarbrdrrrrr�s^






	



				





c@seZdZdZfZdS)rzsPath subclass for non-Windows systems.

    On a POSIX system, instantiating a Path should return this object.
    N)r;r<r=r>r�rrrrr�sc@s$eZdZdZfZdd�Zdd�ZdS)rzqPath subclass for Windows systems.

    On a Windows system, instantiating a Path should return this object.
    cCstd��dS)Nz*Path.owner() is unsupported on this system)r�)r$rrrr?�szWindowsPath.ownercCstd��dS)Nz*Path.group() is unsupported on this system)r�)r$rrrrB�szWindowsPath.groupN)r;r<r=r>r�r?rBrrrrr�s)rr)>r�r�rErzr^r�r�r.�collectionsr�
contextlibrr�rrr�operatorrr�rr	r
rrr
rZurllib.parserrnr�r|rZgetwindowsversionr�__all__r r�r!r?r�rrr�r�r"r�r�r�r�r�r�r�r�r�r�PathLike�registerrrrrrrrrr�<module>sl$

?(c=
%f

Q