AlkantarClanX12

Your IP : 3.12.146.100


Current Path : /opt/alt/python310/lib64/python3.10/__pycache__/
Upload File :
Current File : //opt/alt/python310/lib64/python3.10/__pycache__/pathlib.cpython-310.opt-1.pyc

o

6��f���@s4ddlZddlZddlZddlZddlZddlZddlZddlZddlZddl	m
Z
ddlmZm
Z
mZmZmZddlmZddlmZmZmZmZmZmZmZddlmZgd�ZdZd	Z d
Z!e
eeefZ"ee e!fZ#dd�Z$d
d�Z%Gdd�de&�Z'Gdd�de'�Z(Gdd�de'�Z)e(�Z*e)�Z+Gdd�d�Z,Gdd�de,�Z-e-�Z.dd�Z/e0ed�r�e�1�e/�Z/Gdd�d�Z2Gdd�d�Z3Gd d!�d!e2�Z4Gd"d#�d#e2�Z5Gd$d%�d%e2�Z6Gd&d'�d'e
�Z7Gd(d)�d)e&�Z8ej9�:e8�Gd*d+�d+e8�Z;Gd,d-�d-e8�Z<Gd.d/�d/e8�Z=Gd0d1�d1e=e;�Z>Gd2d3�d3e=e<�Z?dS)4�N)�Sequence)�EINVAL�ENOENT�ENOTDIR�EBADF�ELOOP)�
attrgetter)�S_ISDIR�S_ISLNK�S_ISREG�S_ISSOCK�S_ISBLK�S_ISCHR�S_ISFIFO)�quote_from_bytes)�PurePath�
PurePosixPath�PureWindowsPath�Path�	PosixPath�WindowsPath��{i�cCs t|dd�tvpt|dd�tvS)N�errno�winerror)�getattr�_IGNORED_ERROS�_IGNORED_WINERRORS)Z	exception�r�./opt/alt/python310/lib64/python3.10/pathlib.py�
_ignore_error&s�r cCsd|vpd|vpd|vS)N�*�?�[r)�patrrr�_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__5�z_Flavour.__init__cCsg}|j}|j}d}}t|�}|D]c}|sq|r|�||�}|�|�\}}}	||	vrDt|	�|��D]}
|
rB|
dkrB|�t�|
��q2n|	rR|	dkrR|�t�|	��|sV|ru|ss|D]}|s_qZ|rg|�||�}|�|�d}|rrnqZnq|sz|r�|�||�|�	�|||fS)N��.r)
r(�altsep�reversed�replace�	splitroot�split�append�sys�intern�reverse)r+�partsZparsedr(r0�drv�root�it�partZrel�xrrr�parse_parts8sH����
z_Flavour.parse_partscCsz|r|s|r||||g|dd�fSn#|r1||ks%|�|�|�|�kr0||||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;r9Zdrv2Zroot2Zparts2rrr�join_parsed_parts^s��
z_Flavour.join_parsed_partsN)�__name__�
__module__�__qualname__�__doc__r,r?rBrrrrr&1s
&r&c@s�eZdZdZdZdZeZej	dkZ
ed�ZdZ
hd�dd	�d
D�Bdd	�d
D�BZefdd
�Zdd�Zdd�Zdd�Ze
fdd�Zdd�Zdd�ZdS)�_WindowsFlavour�\�/T�ntZ4abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZz\\?\>ZAUXZCONZNULzCONIN$ZPRNzCONOUT$cC�h|]}d|�qS)zCOM%sr��.0�crrr�	<setcomp>��z_WindowsFlavour.<setcomp>u123456789¹²³cCrK)zLPT%srrLrrrrO�rPcCsV|dd�}|dd�}||kr(||kr(|�|�\}}|dd�}|dd�}nd}|dd�}||kr~||kr~||kr~|�|d�}|dkr~|�||d�}||dkr~|dkr\t|�}|ro||d|�|||dd�fS|d|�|||dd�fSd}	}
|dkr�||jvr�|dd�}	|dd�}|}||kr�|}
|�|�}||	|
|fS)Nrr@�r.�����:)�_split_extended_path�find�len�
drive_letters�lstrip)r+r=r(�first�second�prefixZthird�indexZindex2r:r;rrrr3�s6"
z_WindowsFlavour.splitrootcCs|��Sr'��lower�r+�srrrrA��z_WindowsFlavour.casefoldcCsdd�|D�S)NcSsg|]}|���qSrr^)rM�prrr�
<listcomp>�rPz2_WindowsFlavour.casefold_parts.<locals>.<listcomp>r�r+r9rrr�casefold_parts�r-z_WindowsFlavour.casefold_partscCst�t�|�tj�jSr')�re�compile�fnmatch�	translate�
IGNORECASE�	fullmatch�r+�patternrrr�compile_pattern�sz_WindowsFlavour.compile_patterncCsXd}|�|�r(|dd�}|dd�}|�d�r(||dd�7}d|dd�}||fS)Nr.�zUNC\rRrH)�
startswith)r+raZ
ext_prefixr\rrrrU�s

z$_WindowsFlavour._split_extended_pathcCsJ|sdS|d�d�r
dS|d�d�d�d�d�d�}|��|jvS)NFrz\\rSr/rT� )rq�	partition�rstrip�upper�reserved_names)r+r9�namerrr�is_reserved�s"z_WindowsFlavour.is_reservedcCs`|j}t|�dkr%|ddkr%|��dd��d�}d|t|�d��fSdt|���d��S)NrQr@rTrIz
file:///%s/%szutf-8zfile:)�driverW�as_posixrY�urlquote_from_bytes�encode)r+�pathry�restrrr�make_uri�s�z_WindowsFlavour.make_uriN)rCrDrEr(r0�has_drv�ntpath�pathmod�osrw�is_supported�setrXZext_namespace_prefixrvr3rArfrorUrxrrrrrrGps*
���'

rGc@sZeZdZdZdZdZeZej	dkZ
efdd�Zdd�Zd	d
�Z
dd�Zd
d�Zdd�ZdS)�
_PosixFlavourrIr.FrJcCsP|r#|d|kr#|�|�}t|�t|�dkrd|d|fSd||fSdd|fS)NrrQr.)rYrW)r+r=r(Z
stripped_partrrrr3�s


z_PosixFlavour.splitrootcC�|Sr'rr`rrrrA��z_PosixFlavour.casefoldcCr�r'rrerrrrfr�z_PosixFlavour.casefold_partscCst�t�|��jSr')rgrhrirjrlrmrrrro�z_PosixFlavour.compile_patterncCsdS�NFrrerrrrxr�z_PosixFlavour.is_reservedcCst|�}dt|�S)Nzfile://)�bytesr{)r+r}Zbpathrrrr
sz_PosixFlavour.make_uriN)rCrDrEr(r0r��	posixpathr�r�rwr�r3rArfrorxrrrrrr��s
r�c@seZdZdZdS)�	_AccessorzjAn accessor implements a particular (system-specific or not) way of
    accessing paths on the filesystem.N)rCrDrErFrrrrr�sr�c@s�eZdZejZejZejZejZej	Z	ej
Z
ejZeed�r"ej
Z
ndd�Z
ejZejZejZeed�r8ejZnddd�Zdd
d�Zeed�rKejZnd
d�Zdd�Zdd�ZejZeejj�Zeejj�ZdS)�_NormalAccessor�linkcC�td��)Nz&os.link() not available on this system��NotImplementedError)r+�src�dstrrrr�-rbz_NormalAccessor.link�symlinkFcCr�)Nz)os.symlink() not available on this systemr�)r+r�r��target_is_directoryrrrr�9rbz_NormalAccessor.symlink�TcCs`|rz	t�|d�WdStyYnwtjtjB}|s"|tjO}t�|||�}t�|�dSr')r��utime�OSError�O_CREAT�O_WRONLY�O_EXCL�open�close)r+r}�mode�exist_ok�flags�fdrrr�touch<s��
z_NormalAccessor.touch�readlinkcCr�)Nz*os.readlink() not available on this systemr��r+r}rrrr�Qrbz_NormalAccessor.readlinkcC�6zddl}|�|�|�j�jWStytd��w)Nrz*Path.owner() is unsupported on this system)�pwd�getpwuid�stat�st_uidZpw_name�ImportErrorr�)r+r}r�rrr�ownerT��z_NormalAccessor.ownercCr�)Nrz*Path.group() is unsupported on this system)�grpZgetgrgidr��st_gidZgr_namer�r�)r+r}r�rrr�group[r�z_NormalAccessor.groupN�F�r�T)rCrDrEr�r��ior��listdir�scandir�chmod�mkdir�unlink�hasattrr��rmdir�renamer2r�r�r�r�r��getcwd�staticmethodr}�
expanduser�realpathrrrrr�s4




r�cCsP|d}|dd�}|dkrt}nd|vrtd��t|�r t}nt}||||�S)Nrr@�**z:Invalid pattern: '**' can only be an entire path component)�_RecursiveWildcardSelector�
ValueErrorr%�_WildcardSelector�_PreciseSelector)�
pattern_parts�flavourr$�child_parts�clsrrr�_make_selectorpsr��	lru_cachec@s eZdZdZdd�Zdd�ZdS)�	_SelectorzYA selector matches a specific glob pattern part against the children
    of a given path.cCs2||_|rt||�|_d|_dSt�|_d|_dS)NTF)r�r��	successor�dironly�_TerminatingSelector)r+r�r�rrrr,�s

z_Selector.__init__cCs<t|�}|j}|j}|jj}||�stg�S|�||||�S)zuIterate over all child paths of `parent_path` matched by this
        selector.  This can contain parent_path itself.)�type�is_dir�exists�	_accessorr��iter�_select_from)r+�parent_pathZpath_clsr�r�r�rrr�select_from�sz_Selector.select_fromN)rCrDrErFr,r�rrrrr��s	r�c@seZdZdd�ZdS)r�ccs�|VdSr'r)r+r�r�r�r�rrrr��s�
z!_TerminatingSelector._select_fromN)rCrDrEr�rrrrr��sr�c@�eZdZdd�Zdd�ZdS)r�cCs||_t�|||�dSr')rwr�r,)r+rwr�r�rrrr,�sz_PreciseSelector.__init__ccs`�z$|�|j�}|jr
|n||�r |j�||||�D]}|VqWdSWdSty/YdSwr')�_make_child_relpathrwr�r�r��PermissionError)r+r�r�r�r�r}rcrrrr��s���z_PreciseSelector._select_fromN�rCrDrEr,r�rrrrr���r�c@r�)r�cCs|�|�|_t�|||�dSr')ro�matchr�r,�r+r$r�r�rrrr,�sz_WildcardSelector.__init__ccs��z_||��}t|�}Wd�n1swY|D]A}|jrAz|��s(WqWnty@}zt|�s6�WYd}~qd}~ww|j}	|�|	�r]|�|	�}
|j�	|
|||�D]}|VqWqWdSt
yjYdSwr')�listr�r�r�r rwr�r�r�r�r�)r+r�r�r�r��
scandir_it�entries�entry�erwr}rcrrrr��s6�

����

���z_WildcardSelector._select_fromNr�rrrrr��r�r�c@s$eZdZdd�Zdd�Zdd�ZdS)r�cCst�|||�dSr')r�r,r�rrrr,�r�z#_RecursiveWildcardSelector.__init__ccs��|VzY||��}t|�}Wd�n1swY|D];}d}z|��}Wnty@}zt|�s6�WYd}~nd}~ww|rZ|��sZ|�|j�}	|�|	||�D]}
|
VqTqWdStygYdSwr�)	r�r�r�r �
is_symlinkr�rw�_iterate_directoriesr�)r+r�r�r�r�r�r�Zentry_is_dirr�r}rcrrrr��s2�

�������z/_RecursiveWildcardSelector._iterate_directoriesc	cs��z5t�}z,|jj}|�|||�D]}|||||�D]}||vr(|V|�|�qqW|��WdS|��wty@YdSwr')r�r�r�r��add�clearr�)	r+r�r�r�r�ZyieldedZsuccessor_selectZstarting_pointrcrrrr��s"�
����z'_RecursiveWildcardSelector._select_fromN)rCrDrEr,r�r�rrrrr��sr�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�rrrr,s
z_PathParents.__init__cCs$|js|jr
t|j�dSt|j�S�Nr@)r�r�rWr�r*rrr�__len__s
z_PathParents.__len__cs�t|t�rt�fdd�t|�t����D��S|t��ks$|t��kr(t|��|dkr2|t��7}�j��j	�j
�jd|d��S)Nc3s�|]}�|VqdSr'r)rM�ir*rr�	<genexpr>s�z+_PathParents.__getitem__.<locals>.<genexpr>rr@)�
isinstance�slice�tuple�range�indicesrW�
IndexErrorr��_from_parsed_partsr�r�r�)r+�idxrr*r�__getitem__
s
$�z_PathParents.__getitem__cCsd�|jj�S)Nz<{}.parents>)�formatr�rCr*rrr�__repr__r-z_PathParents.__repr__N)	rCrDrErF�	__slots__r,r�r�r�rrrrr��sr�c@s�eZdZdZdZdd�Zdd�Zedd��Zed	d
��Z	edd��Z
ed
d��Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zedd��Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zeed-�d.d/�Zeed0�d1d/�Zed2d3��Zed4d5��Z ed6d7��Z!ed8d9��Z"ed:d;��Z#d<d=�Z$d>d?�Z%d@dA�Z&dBdC�Z'dDdE�Z(edFdG��Z)dHdI�Z*dJdK�Z+dLdM�Z,edNdO��Z-edPdQ��Z.dRdS�Z/dTdU�Z0dVdW�Z1dXS)Yra|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$|tur
tjdkrtnt}|�|�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.
        rJ)rr�rwrr�_from_parts)r��argsrrr�__new__*s
zPurePath.__new__cCs|jt|j�fSr')�	__class__r�r�r*rrr�
__reduce__4szPurePath.__reduce__cCsbg}|D]&}t|t�r||j7}qt�|�}t|t�r#|�t|��qtdt|���|j	�
|�S)NzNargument should be a str object or an os.PathLike object returning str, not %r)r�rr�r��fspath�strr5�	TypeErrorr��_flavourr?)r�rr9�arrr�_parse_args9s


��zPurePath._parse_argscCs0t�|�}|�|�\}}}||_||_||_|Sr')�objectrr
r�r�r�)r�rr+r:r;r9rrrrMs
zPurePath._from_partscCs t�|�}||_||_||_|Sr')rrr�r�r�)r�r:r;r9r+rrrr�Xs

zPurePath._from_parsed_partscCs0|s|r|||j�|dd��S|j�|�Sr�)rr))r�r:r;r9rrr�_format_parsed_parts`szPurePath._format_parsed_partscCs@|�|�\}}}|j�|j|j|j|||�\}}}|�|||�Sr')r
rrBr�r�r�r�)r+rr:r;r9rrr�_make_childgs

�zPurePath._make_childcCs<z|jWSty|�|j|j|j�pd|_|jYSw)z[Return the string representation of the path, suitable for
        passing to system calls.r/)r��AttributeErrorrr�r�r�r*rrr�__str__ms��
�zPurePath.__str__cC�t|�Sr')rr*rrr�
__fspath__wrbzPurePath.__fspath__cCs|j}t|��|jd�S)zNReturn the string representation of the path with forward (/)
        slashes.rI)rrr2r(�r+�frrrrzzszPurePath.as_posixcCs
t�|�S)zaReturn the bytes representation of the path.  This is only
        recommended to use under Unix.)r��fsencoder*rrr�	__bytes__�s
zPurePath.__bytes__cCsd�|jj|���S)Nz{}({!r}))r�rrCrzr*rrrr��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)�is_absoluter�rrr*rrr�as_uri�szPurePath.as_uricCs2z|jWSty|j�|j�|_|jYSwr')r�rrrfr�r*rrr�_cparts�s
�zPurePath._cpartscCs&t|t�stS|j|jko|j|juSr')r�r�NotImplementedrr�r+�otherrrr�__eq__�s
zPurePath.__eq__cCs2z|jWStytt|j��|_|jYSwr')r�r�hashr�rr*rrr�__hash__�s
�zPurePath.__hash__cCs&t|t�r|j|jur
tS|j|jkSr'�r�rrrrrrrr�__lt__��zPurePath.__lt__cCs&t|t�r|j|jur
tS|j|jkSr'rrrrr�__le__�r!zPurePath.__le__cCs&t|t�r|j|jur
tS|j|jkSr'rrrrr�__gt__�r!zPurePath.__gt__cCs&t|t�r|j|jur
tS|j|jkSr'rrrrr�__ge__�r!zPurePath.__ge__cC�|Sr'r)r�r�rrr�__class_getitem__�r�zPurePath.__class_getitem__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+�anchorrrrr(�szPurePath.anchorcCs.|j}t|�|js|jrdndkrdS|dS)z!The final path component, if any.r@rr.rS)r�rWr�r�rerrrrw�sz
PurePath.namecCsB|j}|�d�}d|krt|�dkrndS||d�SdS)z{
        The final component's last suffix, if any.

        This includes the leading period. For example: '.txt'
        r/rr@Nr.�rw�rfindrW�r+rwr�rrr�suffix�s
�zPurePath.suffixcCs:|j}|�d�r
gS|�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']
        r/cSsg|]}d|�qS)r/r)rMr,rrrrd�rPz%PurePath.suffixes.<locals>.<listcomp>r@N)rw�endswithrYr4�r+rwrrr�suffixes�s


zPurePath.suffixescCsB|j}|�d�}d|krt|�dkrn|S|d|�S|S)z0The final path component, minus its last suffix.r/rr@Nr)r+rrr�stem�s
�z
PurePath.stemcCs�|js
td|f��|j�|f�\}}}|r,|d|jj|jjfvs,|s,|s,t|�dkr2td|��|�|j|j	|j
dd�|g�S)z-Return a new path with the file name changed.�%r has an empty namerSr@zInvalid name %rN)rwr�rr?r(r0rWr�r�r�r�)r+rwr:r;r9rrr�	with_name�s���zPurePath.with_namecCs|�||j�S)z(Return a new path with the stem changed.)r2r,)r+r0rrr�	with_stem�szPurePath.with_stemcCs�|j}|j|vs|jr|j|vrtd|f��|r|�d�r"|dkr(td|��|j}|s4td|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 %rr/r1NrS)rr(r0r�rqrwr,rWr�r�r�r�)r+r,rrwZ
old_suffixrrr�with_suffixs
�zPurePath.with_suffixc
Gs�|std��|j}|j}|j}|r||g|dd�}n|}|�|�\}}}|r3||g|dd�}	n|}	t|	�}
|jj}|
dkrF|sE|ren||d|
��||	�kre|�|||�}t	d�
t|�t|����|�d|
dkrn|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 argumentr@NrzU{!r} is not in the subpath of {!r} OR one path is relative and the other is absolute.r.)
rr�r�r�r
rWrrfrr�r�rr�)
r+rr9r:r;Z	abs_partsZto_drvZto_rootZto_partsZto_abs_parts�n�cfZ	formattedrrr�relative_tos0	��
�zPurePath.relative_tocGs&z|j|�WdStyYdSw)zFReturn True if the path is relative to another path or False.
        TF)r7r�rrrr�is_relative_to8s
�zPurePath.is_relative_tocCs.z|jWStyt|j�|_|jYSw)zZAn object providing sequence-like access to the
        components in the filesystem path.)r�rr�r�r*rrrr9As
�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+rrrr�joinpathMs
zPurePath.joinpathcCs&z|�|f�WStytYSwr')r
rr�r+�keyrrr�__truediv__Us
�zPurePath.__truediv__cCs,z
|�|g|j�WStytYSwr')rr�rrr:rrr�__rtruediv__[s
�zPurePath.__rtruediv__cCs@|j}|j}|j}t|�dkr|s|r|S|�|||dd��S)zThe logical parent of the path.r@NrS)r�r�r�rWr�)r+r:r;r9rrr�parentaszPurePath.parentcCr)z*A sequence of this path's logical parents.)r�r*rrr�parentskszPurePath.parentscCs|jsdS|jjpt|j�S)zSTrue if the path is absolute (has both a root and, if applicable,
        a drive).F)r�rr��boolr�r*rrrrpszPurePath.is_absolutecCs|j�|j�S)zaReturn True if the path contains one of the special names reserved
        by the system, if any.)rrxr�r*rrrrxwszPurePath.is_reservedc	Cs�|jj}||�}|j�|f�\}}}|std��|r#|||j�kr#dS|r.|||j�kr.dS|j}|s5|rFt|�t|�kr?dS|dd�}n
t|�t|�krPdStt	|�t	|��D]
\}}t
�||�sfdSqYdS)zE
        Return True if this path matches the given pattern.
        z
empty patternFr@NT)rrAr?r�r�r�rrW�zipr1riZfnmatchcase)	r+Zpath_patternr6r:r;Z	pat_partsr9r=r$rrrr�|s*�zPurePath.matchN)2rCrDrErFr�rr�classmethodr
rr�rr
rrrzrr�r�propertyrrrr r"r#r$r&rryr;r(rwr,r/r0r2r3r4r7r8r9r9r<r=r>r?rrxr�rrrrrs|







��




	!	

	
rc@�eZdZdZeZdZdS)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.
    rN)rCrDrErF�_posix_flavourrr�rrrrr��rc@rD)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.
    rN)rCrDrErF�_windows_flavourrr�rrrrr�rFrc@s�eZdZdZeZdZdd�Zdd�Zdd�Z	d	d
�Z
edd��Zed
d��Z
dd�Zdd�Zdd�Zdd�Zdd�Zdadd�Zdd�dd�Zd d!�Zd"d#�Z	&	&dbd'd(�Zd)d*�Zdcd+d,�Zd-d.�Zddd/d0�Zd1d2�Zded4d5�Zdfd7d8�Zdd�d9d:�Zd;d<�Z dad=d>�Z!d?d@�Z"dAdB�Z#dCdD�Z$dEdF�Z%dadGdH�Z&dIdJ�Z'dKdL�Z(dMdN�Z)dOdP�Z*dQdR�Z+dSdT�Z,dUdV�Z-dWdX�Z.dYdZ�Z/d[d\�Z0d]d^�Z1d_d`�Z2d&S)gra�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.
    rcOs@|tur
tjdkrtnt}|�|�}|jjstd|j	f��|S)NrJz$cannot instantiate %r on your system)
rr�rwrrrrr�r�rC)r�r�kwargsr+rrrr�s
�zPath.__new__cCs|j|g}|�|j|j|�Sr')r�r�r�r�)r+r=r9rrrr��szPath._make_child_relpathcCr%r'rr*rrr�	__enter__�r�zPath.__enter__cCsdSr'r)r+�t�v�tbrrr�__exit__�s	z
Path.__exit__cCs||j���S)zjReturn a new path pointing to the current working directory
        (as returned by os.getcwd()).
        )r�r��r�rrr�cwd�szPath.cwdcCs|d���S)zrReturn a new path pointing to the user's home directory (as
        returned by os.path.expanduser('~')).
        �~)r�rNrrr�home��z	Path.homecCsB|��}z|��}Wnty|j�|�}Ynwtj�||�S)zoReturn whether other_path is the same or not as this file
        (as returned by os.path.samefile()).
        )r�rr�r�r}�samestat)r+Z
other_path�stZother_strrr�samefile�s�z
Path.samefileccs.�|j�|�D]
}|dvrq|�|�VqdS)zyIterate over the files in this directory.  Does not yield any
        result for the special paths '.' and '..'.
        >r/z..N)r�r�r�r.rrr�iterdir�s��zPath.iterdirccsp�t�d||�|std�|���|j�|f�\}}}|s|r#td��tt|�|j�}|�	|�D]}|Vq0dS)z�Iterate over this subtree and yield all existing files (of any
        kind, including directories) matching the given relative pattern.
        zpathlib.Path.globzUnacceptable pattern: {!r}�%Non-relative patterns are unsupportedN)
r6�auditr�r�rr?r�r�r�r��r+rnr:r;r�Zselectorrcrrr�glob�s��z	Path.globccsb�t�d||�|j�|f�\}}}|s|rtd��tdt|�|j�}|�|�D]}|Vq)dS)z�Recursively yield all existing files (of any kind, including
        directories) matching the given relative pattern, anywhere in
        this subtree.
        zpathlib.Path.rglobrW)r�N)r6rXrr?r�r�r�r�rYrrr�rglob
s��z
Path.rglobcCs$|��r|S|�|j��g|j�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.
        )rrr�r�r�r*rrr�absolutesz
Path.absoluteFc
Cs�dd�}z
|jj||d�}Wnty}z||��d}~ww|�|f�}|sGz|��W|StyF}z||�WYd}~|Sd}~ww|S)z�
        Make the path absolute, resolving all symlinks on the way and also
        normalizing it (for example turning slashes into backslashes under
        Windows).
        cSs0t|dd�}|jtks|tkrtd|j��dS)NrrzSymlink loop from %r)rrr�_WINERROR_CANT_RESOLVE_FILENAME�RuntimeError�filename)r�rrrr�check_eloop/s�z!Path.resolve.<locals>.check_eloop)�strictN)r�r�r�rr�)r+rar`rar�rcrrr�resolve(s&��
���zPath.resolveT��follow_symlinkscCs|jj||d�S)zh
        Return the result of the stat() system call on this path, like
        os.stat() does.
        rc)r�r�)r+rdrrrr�Dsz	Path.statcC�|j�|�S)z:
        Return the login name of the file owner.
        )r�r�r*rrrr�K�z
Path.ownercCre)z8
        Return the group name of the file gid.
        )r�r�r*rrrr�Qrfz
Path.group�rrSNcCs(d|vr	t�|�}|j�||||||�S)z|
        Open the file pointed by this path and return a file object, as
        the built-in open() function does.
        �b)r��
text_encodingr�r�)r+r��	buffering�encoding�errors�newlinerrrr�Ws

�z	Path.opencCs8|jdd��}|��Wd�S1swYdS)zK
        Open the file in bytes mode, read it, and close the file.
        �rb�r�N)r��readrrrr�
read_bytesbs$�zPath.read_bytescCsFt�|�}|jd||d��}|��Wd�S1swYdS)zJ
        Open the file in text mode, read it, and close the file.
        rg)r�rkrlN)r�rir�rp)r+rkrlrrrr�	read_textis
$�zPath.read_textcCsBt|�}|jdd��
}|�|�Wd�S1swYdS)zO
        Open the file in bytes mode, write to it, and close the file.
        �wbroN)�
memoryviewr��write)r+�dataZviewrrrr�write_bytesqs$�zPath.write_bytescCsdt|t�s
td|jj��t�|�}|jd|||d��
}|�|�Wd�S1s+wYdS)zN
        Open the file in text mode, write to it, and close the file.
        zdata must be str, not %s�w)r�rkrlrmN)	r�rrrrCr�rir�ru)r+rvrkrlrmrrrr�
write_textzs
�
$�zPath.write_textcCs|j�|�}|�|f�S)zD
        Return the path to which the symbolic link points.
        )r�r�rr�rrrr��sz
Path.readlinkr�cCs|j�|||�dS)zS
        Create this file with the given access mode, if it doesn't exist.
        N)r�r�)r+r�r�rrrr��sz
Path.touch�cCszz
|j�||�WdSty,|r|j|kr�|jjddd�|j|d|d�YdSty<|r8|��s9�YdSw)z<
        Create a new directory at this given path.
        T)r?r�FN)r�r��FileNotFoundErrorr>r�r�)r+r�r?r�rrrr��s��z
Path.mkdircCs|jj|||d�dS)zF
        Change the permissions of the path, like os.chmod().
        rcN)r�r�)r+r�rdrrrr��sz
Path.chmodcCs|j|dd�dS)z�
        Like chmod(), except if the path points to a symlink, the symlink's
        permissions are changed, rather than its target's.
        FrcN)r�)r+r�rrr�lchmod�szPath.lchmodcCs.z	|j�|�WdSty|s�YdSw)zd
        Remove this file or link.
        If the path is a directory, use rmdir() instead.
        N)r�r�r{)r+Z
missing_okrrrr��s��zPath.unlinkcCs|j�|�dS)zF
        Remove this directory.  The directory must be empty.
        N)r�r�r*rrrr��sz
Path.rmdircCs|jdd�S)z�
        Like stat(), except if the path points to a symlink, the symlink's
        status information is returned, rather than its target's.
        Frc)r�r*rrr�lstat�rRz
Path.lstatcC�|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�r�r�r+�targetrrrr���

zPath.renamecCr~)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�r2rrrrrr2�r�zPath.replacecCs|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�r�)r+r�r�rrr�
symlink_to�szPath.symlink_tocCs|j�||�dS)z�
        Make this path a hard link pointing to the same file as *target*.

        Note the order of arguments (self, target) is the reverse of os.link's.
        N)r�r�rrrr�hardlink_to�szPath.hardlink_tocCs"tjdtdd�|j�||�dS)a�
        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.

        Deprecated since Python 3.10 and scheduled for removal in Python 3.12.
        Use `hardlink_to()` instead.
        zypathlib.Path.link_to() is deprecated and is scheduled for removal in Python 3.12. Use pathlib.Path.hardlink_to() instead.rQ)�
stacklevelN)�warnings�warn�DeprecationWarningr�r�rrrr�link_to�s�zPath.link_toc
CsRz|��WdSty}zt|�s�WYd}~dSd}~wty(YdSw)z+
        Whether this path exists.
        NFT)r�r�r r��r+r�rrrr�s
���zPath.existsc
C�Tzt|��j�WSty }zt|�s�WYd}~dSd}~wty)YdSw)z3
        Whether this path is a directory.
        NF)r	r��st_moder�r r�r�rrrr����zPath.is_dirc
Cr�)zq
        Whether this path is a regular file (also True for symlinks pointing
        to regular files).
        NF)rr�r�r�r r�r�rrr�is_file$s��zPath.is_filecCsn|��r|��s
dSz|j��j}Wn
tyYdSw|��j}||kr(dS|��j}|j��j}||kS)z;
        Check if this path is a POSIX mount point
        FT)r�r�r>r��st_devr��st_ino)r+Z
parent_devZdevZinoZ
parent_inorrr�is_mount5s�

z
Path.is_mountc
Cr�)z7
        Whether this path is a symbolic link.
        NF)r
r}r�r�r r�r�rrrr�Is��zPath.is_symlinkc
Cr�)z6
        Whether this path is a block device.
        NF)r
r�r�r�r r�r�rrr�is_block_deviceXr�zPath.is_block_devicec
Cr�)z:
        Whether this path is a character device.
        NF)rr�r�r�r r�r�rrr�is_char_devicehr�zPath.is_char_devicec
Cr�)z.
        Whether this path is a FIFO.
        NF)rr�r�r�r r�r�rrr�is_fifoxr�zPath.is_fifoc
Cr�)z0
        Whether this path is a socket.
        NF)rr�r�r�r r�r�rrr�	is_socket�r�zPath.is_socketcCsp|js6|js6|jr6|jddd�dkr6|j�|jd�}|dd�dkr)td��|�|g|jdd��S|S)zl Return a new path with expanded ~ and ~user constructs
        (as returned by os.path.expanduser)
        rNr@rPz#Could not determine home directory.)r�r�r�r�r�r^r)r+Zhomedirrrrr��s�zPath.expanduserr�)rgrSNNN)NN)NNNr�)rzFF)3rCrDrErF�_normal_accessorr�r�rr�rIrMrBrOrQrUrVrZr[r\rbr�r�r�r�rqrrrwryr�r�r�r�r|r�r�r}r�r2r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrr�sf	




�

	




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

    On a POSIX system, instantiating a Path should return this object.
    rN)rCrDrErFr�rrrrr�src@seZdZdZdZdd�ZdS)rzqPath subclass for Windows systems.

    On a Windows system, instantiating a Path should return this object.
    rcCr�)Nz-Path.is_mount() is unsupported on this systemr�r*rrrr��rbzWindowsPath.is_mountN)rCrDrErFr�r�rrrrr�sr)@ri�	functoolsr�r�r�r�rgr6r��_collections_abcrrrrrrr�operatorrr�r	r
rrr
rrZurllib.parserr{�__all__Z_WINERROR_NOT_READYZ_WINERROR_INVALID_NAMEr]rrr r%rr&rGr�rGrEr�r�r�r�r�r�r�r�r�r�r�r�r�PathLike�registerrrrrrrrrr�<module>sl$	�?w*O

,!}

x