%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /snap/core20/2379/lib/python3.8/__pycache__/
Upload File :
Create Path :
Current File : //snap/core20/2379/lib/python3.8/__pycache__/pathlib.cpython-38.pyc

U

k�]e���@sjddlZddlZddlZddlZddlZddlZddlZddlZddlm	Z	ddl
mZmZm
Z
mZmZddlmZddlmZmZmZmZmZmZmZddlmZdZejdkr�ddlZe� �dd	�d
kr�ddlm!Z!q�dZdZ!ndZd
dddddgZ"ee
eefZ#dZ$dd�Z%dd�Z&Gdd�de'�Z(Gdd�de(�Z)Gdd�de(�Z*e)�Z+e*�Z,Gdd�d�Z-Gd d!�d!e-�Z.e.�Z/d"d#�Z0e1ed$��r�e�2�e0�Z0Gd%d&�d&�Z3Gd'd(�d(�Z4Gd)d*�d*e3�Z5Gd+d,�d,e3�Z6Gd-d.�d.e3�Z7Gd/d0�d0e	�Z8Gd1d
�d
e'�Z9ej:�;e9�Gd2d�de9�Z<Gd3d�de9�Z=Gd4d�de9�Z>Gd5d�de>e<�Z?Gd6d�de>e=�Z@dS)7�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�tkpt|dd�tkS)N�errnoZwinerror)�getattr�_IGNORED_ERROS�_IGNORED_WINERRORS)Z	exception�r!�/usr/lib/python3.8/pathlib.py�
_ignore_error.s�r#cCsd|kpd|kpd|kS)N�*�?�[r!)�patr!r!r"�_is_wildcard_pattern3sr(c@s(eZdZdZdd�Zdd�Zdd�ZdS)	�_FlavourzPA flavour implements a particular (platform-specific) set of path
    semantics.cCs|jj|_dS�N)�sep�join��selfr!r!r"�__init__=sz_Flavour.__init__cCsg}|j}|j}d}}t|�}|D]�}|s.q$|r>|�||�}|�|�\}}}	||	kr�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)z�
        Join the two paths represented by the respective
        (drive, root, parts) tuples.  Return a new (drive, root, parts) tuple.
        �N)�casefold)r.r<r=r;Zdrv2Zroot2Zparts2r!r!r"�join_parsed_partsfsz_Flavour.join_parsed_partsN)�__name__�
__module__�__qualname__�__doc__r/rArDr!r!r!r"r)9s&r)c@s�eZdZdZdZdZeZej	dkZ
ed�ZdZ
ddd	d
hdd�ed
d�D�Bdd�ed
d�D�BZefdd�Zdd�Zdd�Zdd�Zd&dd�Ze
fdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%S)'�_WindowsFlavour�\�/TrZ4abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZz\\?\ZCONZPRNZAUXZNULcCsh|]}d|�qS)zCOM%dr!��.0�ir!r!r"�	<setcomp>�sz_WindowsFlavour.<setcomp>rB�
cCsh|]}d|�qS)zLPT%dr!rLr!r!r"rO�scCs\|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||jk�r6|dd�}	|dd�}|}||k�rN|}
|�|�}||	|
|fS)NrrBrr0�����:)�_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"rC�sz_WindowsFlavour.casefoldcCsdd�|D�S)NcSsg|]}|���qSr!r])rM�pr!r!r"�
<listcomp>�sz2_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}tdk	r�|r2|�t|��Sg}z|�t|��}WnBtk
r�|}tj�|�\}}|�|�||kr�|YSYq6Xtjj	|ft
|���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|�|�dS�NrB)rTr_r!r!r"rq�sz_WindowsFlavour._ext_to_normalcCs6|sdS|d�d�rdS|d�d�d��|jkS)NFrz\\rRr1)rx�	partition�upper�reserved_namesrcr!r!r"�is_reserved�s
z_WindowsFlavour.is_reservedcCsd|j}t|�dkrJ|ddkrJ|��dd��d�}d|t|�d��fSdt|���d��SdS)NrrBrSrKz
file:///%s/%szutf-8zfile:)�driverV�as_posixrX�urlquote_from_bytes�encode)r.rsr~�restr!r!r"�make_uri�s�z_WindowsFlavour.make_uricCs�dtjkrtjd}nJdtjkrXztjd}Wntk
rFd}YnX|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 %rrB)ro�environ�KeyError�RuntimeErrorrAr,)r.�username�userhomer<r=r;r!r!r"�
gethomedirs*


�
z_WindowsFlavour.gethomedirN)F)rErFrGr+r2�has_drv�ntpath�pathmodro�name�is_supported�setrWZext_namespace_prefix�ranger|r5rCrdrmrvrTrqr}r�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"rC4sz_PosixFlavour.casefoldcCs|Sr*r!rcr!r!r"rd7sz_PosixFlavour.casefold_partscCst�t�|��jSr*)rerfrgrhrjrkr!r!r"rm:sz_PosixFlavour.compile_patterncsJ|j�|j�i������fdd��|��r0dnt��}�|t|��pH�S)Ncs�|���rd}|���D]�}|r|dkr*q|dkrD|���\}}}q|���rX||}n|�|}|�kr��|}|dk	r~qtd|��z��|�}Wn6tk
r�}z|jtkr��r��|}W5d}~XYqXd�|<�||�}|�|<q|S)Nr0r1�..zSymlink loop from %r)	rxr6�
rpartition�endswithr��readlink�OSErrorrr)rsr�r��_�newpath�target�e��_resolveZaccessor�seenr+rtr!r"r�As4




z'_PosixFlavour.resolve.<locals>._resolver0)r+�	_accessor�is_absoluterorprn)r.rsrt�baser!r�r"rv=s)z_PosixFlavour.resolvecCsdS�NFr!rcr!r!r"r}msz_PosixFlavour.is_reservedcCst|�}dt|�S)Nzfile://)�bytesr�)r.rsZbpathr!r!r"r�psz_PosixFlavour.make_uricCs||s@ztjdWStk
r<ddl}|�t���jYSXn8ddl}z|�|�jWStk
rvtd|��YnXdS)N�HOMErr�)	ror�r��pwd�getpwuid�getuid�pw_dir�getpwnamr�)r.r�r�r!r!r"r�vs�z_PosixFlavour.gethomedirN)F)rErFrGr+r2r��	posixpathr�ror�r�r5rCrdrmrvr}r�r�r!r!r!r"r�s

0r�c@seZdZdZdS)�	_AccessorzjAn accessor implements a particular (system-specific or not) way of
    accessing paths on the filesystem.N)rErFrGrHr!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S)
�_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.readlinkN)rErFrGro�stat�lstat�open�listdir�scandir�chmod�hasattrr��mkdir�unlinkr�r��staticmethod�rmdir�renamer4r�supports_symlinksr��utimer�r!r!r!r"r��s4




r�cCsR|d}|dd�}|dkr"t}n$d|kr4td��nt|�rBt}nt}||||�S)NrrB�**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@s eZdZdZdd�Zdd�ZdS)�	_SelectorzYA selector matches a specific glob pattern part against the children
    of a given path.cCs0||_|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|�||||�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�r!r!r"�select_from�sz_Selector.select_fromN)rErFrGrHr/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)rErFrGr�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__ccs\z@|�|j�}|jr|n||�r>|j�||||�D]
}|Vq2Wntk
rVYdSXdSr*)�_make_child_relpathr�r�r�r��PermissionError)r.r�r�r�r�rsrar!r!r"r�sz_PreciseSelector._select_fromN�rErFrGr/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|�}W5QRX|D]�}|jrrz|��s:Wq"Wn4tk
rp}zt|�sX�WY�q"W5d}~XYnX|j}	|�|	�r"|�|	�}
|j�	|
|||�D]
}|Vq�q"Wnt
k
r�YdSXdSr*)�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//sz#_RecursiveWildcardSelector.__init__ccs�|Vz�||��}t|�}W5QRX|D]t}d}z|��}Wn,tk
rh}zt|�sX�W5d}~XYnX|r(|��s(|�|j�}	|�|	||�D]
}
|
Vq�q(Wntk
r�YdSXdSr�)	r�r�r�r#�
is_symlinkr�r��_iterate_directoriesr�)r.r�r�r�r�r�r�Zentry_is_dirr�rsrar!r!r"r�2s"
z/_RecursiveWildcardSelector._iterate_directoriesc	cs~zbt�}zL|jj}|�|||�D]0}|||||�D]}||kr2|V|�|�q2q W5|��XWntk
rxYdSXdSr*)r��clearr�r�r��addr�)	r.r�r�r�r�ZyieldedZsuccessor_selectZstarting_pointrar!r!r"r�Esz'_RecursiveWildcardSelector._select_fromN)rErFrGr/r�r�r!r!r!r"r�-sr�c@s4eZdZdZdZdd�Zdd�Zdd�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|_dSr*)r�r�r�r�r�r�r!r!r"r/^s
z_PathParents.__init__cCs(|js|jrt|j�dSt|j�SdSry)r�r�rVr�r-r!r!r"�__len__esz_PathParents.__len__cCs@|dks|t|�krt|��|j�|j|j|jd|d��S)NrrB)rV�
IndexErrorr��_from_parsed_partsr�r�r�)r.�idxr!r!r"�__getitem__ks
�z_PathParents.__getitem__cCsd�|jj�S)Nz<{}.parents>)�formatr�rEr-r!r!r"�__repr__qsz_PathParents.__repr__N)	rErFrGrH�	__slots__r/r�r�r�r!r!r!r"r�Ysr�c@s�eZdZdZdZdd�Zdd�Zedd��ZedVd
d��Z	edWdd
��Z
edd��Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zed d!��Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zeed.�d/d0�Zeed1�d2d0�Zed3d4��Zed5d6��Z ed7d8��Z!ed9d:��Z"ed;d<��Z#d=d>�Z$d?d@�Z%dAdB�Z&edCdD��Z'dEdF�Z(dGdH�Z)dIdJ�Z*edKdL��Z+edMdN��Z,dOdP�Z-dQdR�Z.dSdT�Z/dUS)Xra|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}|�|�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)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�r�r;r�r!r!r"�_parse_args�s


��zPurePath._parse_argsTcCs<t�|�}|�|�\}}}||_||_||_|r8|��|Sr*)�objectr�rr�r�r��_init)r�r��initr.r<r=r;r!r!r"r��s
zPurePath._from_partscCs,t�|�}||_||_||_|r(|��|Sr*)rr�r�r�r�r)r�r<r=r;r	r.r!r!r"r��s
zPurePath._from_parsed_partscCs4|s|r$|||j�|dd��S|j�|�SdSry)rr,)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*)rrrDr�r�r�r�)r.r�r<r=r;r!r!r"�_make_child�s�
zPurePath._make_childcCsBz|jWStk
r<|�|j|j|j�p.d|_|jYSXdS)z[Return the string representation of the path, suitable for
        passing to system calls.r1N)r��AttributeErrorr
r�r�r�r-r!r!r"�__str__�s��zPurePath.__str__cCst|�Sr*)rnr-r!r!r"�
__fspath__�szPurePath.__fspath__cCs|j}t|��|jd�S)zNReturn the string representation of the path with forward (/)
        slashes.rK)rrnr4r+�r.�fr!r!r"r�szPurePath.as_posixcCs
t�|�S)zaReturn the bytes representation of the path.  This is only
        recommended to use under Unix.)ro�fsencoder-r!r!r"�	__bytes__�szPurePath.__bytes__cCsd�|jj|���S)Nz{}({!r}))r�r�rErr-r!r!r"r��szPurePath.__repr__cCs|��std��|j�|�S)z Return the path as a 'file' URI.z.relative path can't be expressed as a file URI)r�r�rr�r-r!r!r"�as_uri�szPurePath.as_uricCs8z|jWStk
r2|j�|j�|_|jYSXdSr*)r�rrrdr�r-r!r!r"�_cparts�s
zPurePath._cpartscCs&t|t�stS|j|jko$|j|jkSr*)rr�NotImplementedrr�r.�otherr!r!r"�__eq__�s
zPurePath.__eq__cCs8z|jWStk
r2tt|j��|_|jYSXdSr*)r�r�hashrrr-r!r!r"�__hash__�s
zPurePath.__hash__cCs&t|t�r|j|jk	rtS|j|jkSr*�rrrrrrr!r!r"�__lt__szPurePath.__lt__cCs&t|t�r|j|jk	rtS|j|jkSr*rrr!r!r"�__le__	szPurePath.__le__cCs&t|t�r|j|jk	rtS|j|jkSr*rrr!r!r"�__gt__szPurePath.__gt__cCs&t|t�r|j|jk	rtS|j|jkSr*rrr!r!r"�__ge__szPurePath.__ge__r�z.The drive prefix (letter or UNC path), if any.)�docr�zThe root of the path, if any.cCs|j|j}|S)z/The concatenation of the drive and root, or ''.)r�r�)r.�anchorr!r!r"r!szPurePath.anchorcCs.|j}t|�|js|jrdndkr&dS|dS)z!The final path component, if any.rBrr0rR)r�rVr�r�rcr!r!r"r�$sz
PurePath.namecCsD|j}|�d�}d|kr,t|�dkr<nn||d�SdSdS)z{
        The final component's last suffix, if any.

        This includes the leading period. For example: '.txt'
        r1rrBNr0�r��rfindrV�r.r�rNr!r!r"�suffix,s

 zPurePath.suffixcCs:|j}|�d�rgS|�d�}dd�|�d�dd�D�S)z�
        A list of the final component's suffixes, if any.

        These include the leading periods. For example: ['.tar', '.gz']
        r1cSsg|]}d|�qS)r1r!)rMr%r!r!r"rbEsz%PurePath.suffixes.<locals>.<listcomp>rBN)r�r�rXr6�r.r�r!r!r"�suffixes:s


zPurePath.suffixescCsD|j}|�d�}d|kr,t|�dkr<nn|d|�S|SdS)z0The final path component, minus its last suffix.r1rrBNr"r$r!r!r"�stemGs

 z
PurePath.stemcCs�|jstd|f��|j�|f�\}}}|rX|d|jj|jjfksX|sX|sXt|�dkrdtd|��|�|j|j	|j
dd�|g�S)z-Return a new path with the file name changed.�%r has an empty namerRrBzInvalid name %rN)r�r�rrAr+r2rVr�r�r�r�)r.r�r<r=r;r!r!r"�	with_nameQs��
��zPurePath.with_namecCs�|j}|j|ks |jr.|j|kr.td|f��|r<|�d�rD|dkrPtd|��|j}|shtd|f��|j}|s|||}n|dt|��|}|�|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 %rr1r)NrR)rr+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)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 argumentrBNrz{!r} does not start with {!r}r0)
rr�r�r�rrVrrdr
r�r�rnr�)
r.rr;r<r=Z	abs_partsZto_drvZto_rootZto_partsZto_abs_parts�n�cfZ	formattedr!r!r"�relative_toqs.	*�
�zPurePath.relative_tocCs4z|jWStk
r.t|j�|_|jYSXdS)zZAn object providing sequence-like access to the
        components in the filesystem path.N)r�rrr�r-r!r!r"r;�s
zPurePath.partscGs
|�|�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�r!r!r"�joinpath�szPurePath.joinpathcCs,z|�|f�WStk
r&tYSXdSr*)rrr�r.�keyr!r!r"�__truediv__�szPurePath.__truediv__cCs2z|�|g|j�WStk
r,tYSXdSr*)r�r�rrr0r!r!r"�__rtruediv__�szPurePath.__rtruediv__cCs@|j}|j}|j}t|�dkr*|s&|r*|S|�|||dd��S)zThe logical parent of the path.rBNrR)r�r�r�rVr�)r.r<r=r;r!r!r"�parent�szPurePath.parentcCst|�S)z*A sequence of this path's logical parents.)r�r-r!r!r"�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�rr��boolr�r-r!r!r"r��szPurePath.is_absolutecCs|j�|j�S)zaReturn True if the path contains one of the special names reserved
        by the system, if any.)rr}r�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)zE
        Return True if this path matches the given pattern.
        z
empty patternFrBNT)rrCrAr�r�r�rrV�zipr3rgZfnmatchcase)	r.Zpath_patternr-r<r=Z	pat_partsr;r?r'r!r!r"r��s(zPurePath.matchN)T)T)0rErFrGrHr�r�r�classmethodrr�r�r
rrr
rrrr�r�propertyrrrrrrrrr~r=r!r�r%r'r(r*r+r.r;r/r2r3r4r5r�r}r�r!r!r!r"rusv

	


��





	 

	
c@seZdZdZeZdZdS)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.
    r!N)rErFrGrH�_posix_flavourrr�r!r!r!r"r�sc@seZdZdZeZdZdS)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.
    r!N)rErFrGrH�_windows_flavourrr�r!r!r!r"r�sc@s�eZdZdZdZdd�Zdddd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dedd�Zdfdd�Ze
dd��Ze
dd��Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zdgd%d&�Zd'd(�Zd)d*�Zd+d,�Zdhd/d0�Zd1d2�Zdid3d4�Zd5d6�Zdjd7d8�Zdkd:d;�Zdld<d=�Zd>d?�Z d@dA�Z!dmdBdC�Z"dDdE�Z#dFdG�Z$dHdI�Z%dJdK�Z&dndLdM�Z'dNdO�Z(dPdQ�Z)dRdS�Z*dTdU�Z+dVdW�Z,dXdY�Z-dZd[�Z.d\d]�Z/d^d_�Z0d`da�Z1dbdc�Z2dS)ora�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��|�
�|S)NrF�r	z$cannot instantiate %r on your system)rror�rrr�rr�r�rEr)r�r��kwargsr.r!r!r"r�s�zPath.__new__NcCs"d|_|dk	r|j|_nt|_dSr�)r<r��_normal_accessor)r.�templater!r!r"rs
z
Path._initcCs|j|g}|�|j|j|�Sr*)r�r�r�r�)r.r?r;r!r!r"r�#szPath._make_child_relpathcCs|jr|��|Sr*)r<�
_raise_closedr-r!r!r"�	__enter__)szPath.__enter__cCs
d|_dS)NT)r<)r.�t�v�tbr!r!r"�__exit__.sz
Path.__exit__cCstd��dS)NzI/O operation on closed path)r�r-r!r!r"rA1szPath._raise_closed�cCs|j�|||�Sr*)r�r�)r.r��flagsr�r!r!r"�_opener4szPath._opener�cCs|jr|��|j�|||�S)zm
        Open the file pointed by this path and return a file descriptor,
        as os.open() does.
        )r<rAr�r�)r.rHr�r!r!r"�	_raw_open8szPath._raw_opencCs|t���S)zjReturn a new path pointing to the current working directory
        (as returned by os.getcwd()).
        )rorp�r�r!r!r"�cwdCszPath.cwdcCs||�j�d��S)zrReturn a new path pointing to the user's home directory (as
        returned by os.path.expanduser('~')).
        N)rr�rLr!r!r"�homeJsz	Path.homecCsB|��}z|��}Wntk
r2t�|�}YnXtj�||�S)zoReturn whether other_path is the same or not as this file
        (as returned by os.path.samefile()).
        )r�rrors�samestat)r.Z
other_path�stZother_str!r!r"�samefileQsz
Path.samefileccsH|jr|��|j�|�D](}|dkr(q|�|�V|jr|��qdS)zyIterate over the files in this directory.  Does not yield any
        result for the special paths '.' and '..'.
        >r�r1N)r<rAr�r�r�r&r!r!r"�iterdir\szPath.iterdirccs`|std�|���|j�|f�\}}}|s.|r6td��tt|�|j�}|�|�D]
}|VqPdS)z�Iterate over this subtree and yield all existing files (of any
        kind, including directories) matching the given relative pattern.
        zUnacceptable pattern: {!r}�%Non-relative patterns are unsupportedN)r�r�rrAr�r�rr��r.rlr<r=r�Zselectorrar!r!r"�globjsz	Path.globccsR|j�|f�\}}}|s|r$td��tdt|�|j�}|�|�D]
}|VqBdS)z�Recursively yield all existing files (of any kind, including
        directories) matching the given relative pattern, anywhere in
        this subtree.
        rS)r�N)rrAr�r�rr�rTr!r!r"�rglobwsz
Path.rglobcCsD|jr|��|��r|S|jt��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.
        Fr=�r@)r<rAr�r�rorpr�r)r.�objr!r!r"�absolute�sz
Path.absoluteFcCsh|jr|��|jj||d�}|dkr:|��t|���}|jj�|�}|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).
        )rtNFr=rW)r<rArrvr�rnrYr��normpathr�r)r.rtr`ZnormedrXr!r!r"rv�szPath.resolvecCs|j�|�S)zh
        Return the result of the stat() system call on this path, like
        os.stat() does.
        )r�r�r-r!r!r"r��sz	Path.statcCsddl}|�|��j�jS)z:
        Return the login name of the file owner.
        rN)r�r�r��st_uidZpw_name)r.r�r!r!r"�owner�sz
Path.ownercCsddl}|�|��j�jS)z8
        Return the group name of the file gid.
        rN)�grpZgetgrgidr��st_gidZgr_name)r.r]r!r!r"�group�sz
Path.group�rrRc	Cs(|jr|��tj|||||||jd�S)z|
        Open the file pointed by this path and return a file object, as
        the built-in open() function does.
        )Zopener)r<rA�ior�rI)r.r��	buffering�encoding�errors�newliner!r!r"r��s
�z	Path.openc
Cs,|jdd��}|��W5QR�SQRXdS)zK
        Open the file in bytes mode, read it, and close the file.
        �rb�r�N�r��readrr!r!r"�
read_bytes�szPath.read_bytesc
Cs0|jd||d��}|��W5QR�SQRXdS)zJ
        Open the file in text mode, read it, and close the file.
        r`�r�rcrdNrh)r.rcrdrr!r!r"�	read_text�szPath.read_textc
Cs6t|�}|jdd��}|�|�W5QR�SQRXdS)zO
        Open the file in bytes mode, write to it, and close the file.
        �wbrgN)�
memoryviewr��write)r.�dataZviewrr!r!r"�write_bytes�szPath.write_bytesc
CsLt|t�std|jj��|jd||d��}|�|�W5QR�SQRXdS)zN
        Open the file in text mode, write to it, and close the file.
        zdata must be str, not %s�wrkN)rrnrr�rEr�ro)r.rprcrdrr!r!r"�
write_text�s
�zPath.write_textTcCsr|jr|��|r>z|j�|d�Wntk
r8YnXdStjtjB}|sX|tjO}|�	||�}t�
|�dS)zS
        Create this file with the given access mode, if it doesn't exist.
        N)r<rAr�r�r�ro�O_CREAT�O_WRONLY�O_EXCLrK�close)r.r��exist_okrH�fdr!r!r"�touch�s
z
Path.touchcCs�|jr|��z|j�||�Wndtk
rd|r>|j|kr@�|jjddd�|j|d|d�Yn"tk
r�|r~|��s��YnXdS)z<
        Create a new directory at this given path.
        T)r5rxFN)r<rAr�r�rrr4r�r�)r.r�r5rxr!r!r"r�sz
Path.mkdircCs |jr|��|j�||�dS)zF
        Change the permissions of the path, like os.chmod().
        N)r<rAr�r��r.r�r!r!r"r�sz
Path.chmodcCs |jr|��|j�||�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<rAr�r�r{r!r!r"r�szPath.lchmodcCs>|jr|��z|j�|�Wntk
r8|s4�YnXdS)zd
        Remove this file or link.
        If the path is a directory, use rmdir() instead.
        N)r<rAr�r�rr)r.Z
missing_okr!r!r"r�%szPath.unlinkcCs|jr|��|j�|�dS)zF
        Remove this directory.  The directory must be empty.
        N)r<rAr�r�r-r!r!r"r�2sz
Path.rmdircCs|jr|��|j�|�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<rAr�r�r-r!r!r"r�:sz
Path.lstatcCs&|jr|��|j�||�|�|�S)a2
        Rename this path to the target path.

        The target path may be absolute or relative. Relative paths are
        interpreted relative to the current working directory, *not* the
        directory of the Path object.

        Returns the new Path instance pointing to the target path.
        )r<rAr�r�r�r�r!r!r"r�Cs
zPath.renamecCs&|jr|��|j�||�|�|�S)aS
        Rename this path to the target path, overwriting if that path exists.

        The target path may be absolute or relative. Relative paths are
        interpreted relative to the current working directory, *not* the
        directory of the Path object.

        Returns the new Path instance pointing to the target path.
        )r<rAr�r4r�r�r!r!r"r4Rs
zPath.replacecCs"|jr|��|j�|||�dS)z�
        Make this path a symlink pointing to the target path.
        Note the order of arguments (link, target) is the reverse of os.symlink.
        N)r<rAr�r�)r.r�r�r!r!r"�
symlink_toaszPath.symlink_tocCs |jr|��|j�||�dS)aQ
        Make the target path a hard link pointing to this path.

        Note this function does not make this path a hard link to *target*,
        despite the implication of the function and argument names. The order
        of arguments (target, link) is the reverse of Path.symlink_to, but
        matches that of os.link.

        N)r<rAr�r�r�r!r!r"r�js
zPath.link_toc
CsXz|��WnFtk
r>}zt|�s(�WY�dSd}~XYntk
rRYdSXdS)z+
        Whether this path exists.
        FNT)r�r�r#r��r.r�r!r!r"r�zszPath.existsc
Cs\zt|��j�WStk
rB}zt|�s,�WY�dSd}~XYntk
rVYdSXdS)z3
        Whether this path is a directory.
        FN)r	r��st_moder�r#r�r}r!r!r"r��szPath.is_dirc
Cs\zt|��j�WStk
rB}zt|�s,�WY�dSd}~XYntk
rVYdSXdS)zq
        Whether this path is a regular file (also True for symlinks pointing
        to regular files).
        FN)rr�r~r�r#r�r}r!r!r"�is_file�szPath.is_filecCsv|��r|��sdSt|j�}z|��j}Wntk
rBYdSX|��j}||krZdS|��j}|��j}||kS)z;
        Check if this path is a POSIX mount point
        FT)r�r�rr4r��st_devr��st_ino)r.r4Z
parent_devZdevZinoZ
parent_inor!r!r"�is_mount�s



z
Path.is_mountc
Cs\zt|��j�WStk
rB}zt|�s,�WY�dSd}~XYntk
rVYdSXdS)z7
        Whether this path is a symbolic link.
        FN)r
r�r~r�r#r�r}r!r!r"r��szPath.is_symlinkc
Cs\zt|��j�WStk
rB}zt|�s,�WY�dSd}~XYntk
rVYdSXdS)z6
        Whether this path is a block device.
        FN)r
r�r~r�r#r�r}r!r!r"�is_block_device�szPath.is_block_devicec
Cs\zt|��j�WStk
rB}zt|�s,�WY�dSd}~XYntk
rVYdSXdS)z:
        Whether this path is a character device.
        FN)rr�r~r�r#r�r}r!r!r"�is_char_device�szPath.is_char_devicec
Cs\zt|��j�WStk
rB}zt|�s,�WY�dSd}~XYntk
rVYdSXdS)z.
        Whether this path is a FIFO.
        FN)rr�r~r�r#r�r}r!r!r"�is_fifo�szPath.is_fifoc
Cs\zt|��j�WStk
rB}zt|�s,�WY�dSd}~XYntk
rVYdSXdS)z0
        Whether this path is a socket.
        FN)rr�r~r�r#r�r}r!r!r"�	is_socket�szPath.is_socketcCs`|js\|js\|jr\|jddd�dkr\|j�|jddd��}|�|g|jdd��S|S)zl Return a new path with expanded ~ and ~user constructs
        (as returned by os.path.expanduser)
        rNrB�~)r�r�r�rr�r�)r.Zhomedirr!r!r"�
expandusers��zPath.expanduser)N)rG)rJ)F)r`rRNNN)NN)NN)rGT)rJFF)F)F)3rErFrGrHr�r�rr�rBrFrArIrKr8rMrNrQrRrUrVrYrvr�r\r_r�rjrlrqrsrzr�r�r�r�r�r�r�r4r|r�r�r�rr�r�r�r�r�r�r�r!r!r!r"rsj�







�

	



	

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

    On a POSIX system, instantiating a Path should return this object.
    r!N)rErFrGrHr�r!r!r!r"rsc@s,eZdZdZdZdd�Zdd�Zdd�Zd	S)
rzqPath subclass for Windows systems.

    On a Windows system, instantiating a Path should return this object.
    r!cCstd��dS)Nz*Path.owner() is unsupported on this systemr�r-r!r!r"r\(szWindowsPath.ownercCstd��dS)Nz*Path.group() is unsupported on this systemr�r-r!r!r"r_+szWindowsPath.groupcCstd��dS)Nz-Path.is_mount() is unsupported on this systemr�r-r!r!r"r�.szWindowsPath.is_mountN)rErFrGrHr�r\r_r�r!r!r!r"r!s
)Arg�	functoolsrar�ror�rer8�_collections_abcrrrrrrr�operatorrr�r	r
rrr
rrZurllib.parserr�r�r�rZgetwindowsversionr�__all__rr r#r(rr)rIr�r;r:r�r�r?r�r�r�r�r�r�r�r�r�r�PathLike�registerrrrrrr!r!r!r"�<module>s|$
�
?&i8
,t



Zerion Mini Shell 1.0