ok

Mini Shell

Direktori : /opt/alt/python35/lib64/python3.5/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/__pycache__/pathlib.cpython-35.pyc



B�Ma���@sPddlZddlZddlZddlZddlZddlZddlZddlZddlm	Z	ddl
mZddlm
Z
mZmZddlmZddlmZmZmZmZmZmZmZddlmZdZejd	krUddlZej �dd
�ddfkrFddlm!Z!n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,ed d!��Z-d"d#�Z.e/ed$�rDej0�e.�Z.Gd%d&�d&�Z1Gd'd(�d(�Z2Gd)d*�d*e1�Z3Gd+d,�d,e1�Z4Gd-d.�d.e1�Z5Gd/d0�d0e	�Z6Gd1d�de$�Z7Gd2d�de7�Z8Gd3d�de7�Z9Gd4d�de7�Z:Gd5d�de:e8�Z;Gd6d�de:e9�Z<dS)7�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�WindowsPathcCs"d|kp!d|kp!d|kS)N�*�?�[�)�patrr�,/opt/alt/python35/lib64/python3.5/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]}|sDq5|r\|j||�}|j|�\}}}	||	kr�xpt|	j|��D].}
|
r�|
dkr�|jtj|
��q�Wn(|	r�|	dkr�|jtj|	��|s�|r5|sQxI|D]A}|sq|r3|j||�}|j|�d}|rPqWPq5W|sb|rs|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�|r8|r�|r�||||g|dd�fSn_|r�||ksh|j|�|j|�kr�||||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@sWeZdZdZdZdZeZej	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�BZedd�Zdd�Zdd�Zdd�Zedd�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>~s	z_WindowsFlavour.<setcomp>�
cCsh|]}d|�qS)zLPT%dr)rCrIrrrrJs	cCs�|dd�}|dd�}||krp||krp|j|�\}}|dd�}|dd�}nd}|dd�}||krZ||krZ||krZ|j|d�}|dkrZ|j||d�}||dkrZ|dkrt|�}|r5||d|�|||dd�fS|d|�|||dd�fSd}	}
|dkr�||jkr�|dd�}	|dd�}|}||kr�|}
|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>�s	z2_WindowsFlavour.casefold_parts.<locals>.<listcomp>r)r$r1rrr�casefold_parts�sz_WindowsFlavour.casefold_partscCs?t|�}|stj�Stdk	r;|jt|��SdS)N)�str�os�getcwdr�_ext_to_normal)r$�pathrYrrr�resolve�s
z_WindowsFlavour.resolvecCsvd}|j|�rl|dd�}|dd�}|jd�rl||dd�7}d|dd�}||fS)Nr&�zUNC\rLr@)�
startswith)r$rYZ
ext_prefixrVrrrrO�sz$_WindowsFlavour._split_extended_pathcCs|j|�dS)Nr8)rO)r$rYrrrr`�sz_WindowsFlavour._ext_to_normalcCsE|s
dS|djd�r!dS|djd�dj�|jkS)NFrz\\r8r'rN)rd�	partition�upper�reserved_names)r$r1rrr�is_reserved�s
z_WindowsFlavour.is_reservedcCs�|j}t|�dkrg|ddkrg|j�dd�jd�}d|t|jd��fSdt|j�jd��SdS)Nrr8rMrAz
file:///%s/%szutf-8zfile:)�driverQ�as_posixrS�urlquote_from_bytes�encode)r$rari�restrrr�make_uri�s	"z_WindowsFlavour.make_uric
CsAdtjkrtjd}nzdtjkr>tjd}n[dtjkr�ytjd}Wntk
rxd}YnX|tjd}ntd��|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)r;r<r=r"r(�has_drv�ntpath�pathmodr^�name�is_supported�set�range�ordrRZext_namespace_prefixrgr+r9r\rbrOr`rhrnrurrrrr?ks&/3)	'	
r?c@s�eZdZdZdZdZeZej	dkZ
edd�Zdd�Zd	d
�Z
dd�Zd
d�Zdd�Zdd�ZdS)�
_PosixFlavourrAr&FrcCss|rb|d|krb|j|�}t|�t|�dkrRd|d|fSd||fSn
dd|fSdS)Nrrr&)rSrQ)r$r5r"Z
stripped_partrrrr+sz_PosixFlavour.splitrootcCs|S)Nr)r$rYrrrr9sz_PosixFlavour.casefoldcCs|S)Nr)r$r1rrrr\sz_PosixFlavour.casefold_partscsj|j�|j�i�����fdd��|j�rEdn	tj�}�|t|��pi�S)Ncs)|j��rd}x
|j��D]�}|s%|dkrAq%|dkrh|j��\}}}q%|�|}|�kr��|}|dk	r�q%td|��y�j|�}Wn=tk
r�}z|jtkr��|}WYdd}~Xq%Xd�|<�||�}|�|<q%W|S)Nr&r'z..zSymlink loop from %r)rdr,�
rpartitionrr�readlink�OSError�errnor)rarmry�_�newpath�target�e)�_resolve�accessor�seenr"rrr�$s0

z'_PosixFlavour.resolve.<locals>._resolver&)r"�	_accessor�is_absoluter^r_r])r$ra�baser)r�r�r�r"rrb s		%z_PosixFlavour.resolvecCsdS)NFr)r$r1rrrrhLsz_PosixFlavour.is_reservedcCst|�}dt|�S)Nzfile://)�bytesrk)r$raZbpathrrrrnOsz_PosixFlavour.make_uricCs�|sOytjdSWq�tk
rKddl}|jtj��jSYq�XnEddl}y|j|�jSWn"tk
r�td|��YnXdS)Nrorz%Can't determine home directory for %r)	r^rprq�pwd�getpwuid�getuid�pw_dir�getpwnamrr)r$rsr�rrrruUs

z_PosixFlavour.gethomedirN)r;r<r=r"r(rv�	posixpathrxr^ryrzr+r9r\rbrhrnrurrrrr~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�isr�c@sEeZdZdd�Zdd�Zeej�Zeej�Zeej�Zeej	�Z	eej
�Z
eed�r�eej�Zndd�Zeej
�Z
eej�Zeej�Zeej�Zeej�Zerereej�Zq&dd	�Zned
d	��Zeej�Zdd�Zd
S)�_NormalAccessorcs+tj���fdd��}t|�S)Ncs�t|�|�S)N)r])�pathobj�args)�strfuncrr�wrappedqsz._NormalAccessor._wrap_strfunc.<locals>.wrapped)�	functools�wraps�staticmethod)r�r�r)r�r�
_wrap_strfuncps!z_NormalAccessor._wrap_strfunccs+tj���fdd��}t|�S)Ncs�t|�t|�|�S)N)r])ZpathobjAZpathobjBr�)r�rrr�wsz5_NormalAccessor._wrap_binary_strfunc.<locals>.wrapped)r�r�r�)r�r�r)r�r�_wrap_binary_strfuncvs!z$_NormalAccessor._wrap_binary_strfunc�lchmodcCstd��dS)Nz%lchmod() not available on this system)�NotImplementedError)r$r��moderrrr��sz_NormalAccessor.lchmodcCstd��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$rarrrr��sz_NormalAccessor.readlinkN)r;r<r=r�r�r^�stat�lstat�open�listdir�chmod�hasattrr��mkdir�unlink�rmdir�renamer*r�supports_symlinksr�r��utimer�rrrrr�ns,r�c#sdy�j�VWnMtk
r_i���fdd�}d|_z	|VWd�j�XYnXdS)Ncs=y�|SWn*tk
r8�|�}�|<|SYnXdS)N)rq)r��value)�cache�funcrr�wrapper�s

z_cached.<locals>.wrapperT)�
__cached__�AttributeError�clear)r�r�r)r�r�r�_cached�s	
		r�cCsr|d}|dd�}|dkr/t}n6d|krJtd��nt|�r_t}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.cCs1||_|r!t|�|_nt�|_dS)N)r�r��	successor�_TerminatingSelector)r$r�rrrr%�s	z_Selector.__init__cCs@t|�}|j}|j}|jj}|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��_select_from)r$�parent_pathZpath_clsr�r�r�rrr�select_from�s
		z_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��sr�c@s(eZdZdd�Zdd�ZdS)r�cCs||_tj||�dS)N)ryr�r%)r$ryr�rrrr%�s	z_PreciseSelector.__init__ccszy]||�sdS|j|j�}||�r\x(|jj||||�D]}|VqMWWntk
rudSYnXdS)N)�_make_child_relpathryr�r��PermissionError)r$r�r�r�r�rarZrrrr��s"

z_PreciseSelector._select_fromN)r;r<r=r%r�rrrrr��sr�c@s(eZdZdd�Zdd�ZdS)r�cCs/tjtj|��|_tj||�dS)N)�re�compile�fnmatch�	translaterr�r%)r$rr�rrrr%sz_WildcardSelector.__init__c
cs�y�||�sdS|jj}xl||�D]^}||�}|jj|�r,|j|�}x(|jj||||�D]}	|	Vq{Wq,WWntk
r�dSYnXdS)N)�_flavourr9r�matchr�r�r�r�)
r$r�r�r�r��cfryZ
casefoldedrarZrrrr�s"
z_WildcardSelector._select_fromN)r;r<r=r%r�rrrrr�sr�c@s4eZdZdd�Zdd�Zdd�ZdS)r�cCstj||�dS)N)r�r%)r$rr�rrrr%sz#_RecursiveWildcardSelector.__init__ccs�|Vyhxa||�D]S}|j|�}||�r|j�rx"|j|||�D]}|VqYWqWWntk
r�dSYnXdS)N)r��
is_symlink�_iterate_directoriesr�)r$r�r�r�ryrarZrrrr�s
z/_RecursiveWildcardSelector._iterate_directoriesc	cs�y�||�sdSt|���}t�}zn|jj}x[|j|||�D]D}x;|||||�D]$}||krl|V|j|�qlWqPWWd|j�XWdQRXWntk
r�dSYnXdS)N)r�r{r�r�r��addr�r�)	r$r�r�r�r�ZyieldedZsuccessor_selectZstarting_pointrZrrrr�'s	
z'_RecursiveWildcardSelector._select_fromN)r;r<r=r%r�r�rrrrr�sr�c@sLeZdZdZdZdd�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�_partscCs7t|�|_|j|_|j|_|j|_dS)N)r�r�r�r�r�)r$rarrrr%Csz_PathParents.__init__cCs4|js|jr#t|j�dSt|j�SdS)Nr8)r�r�rQr�)r$rrr�__len__Jsz_PathParents.__len__cCsX|dks|t|�kr*t|��|jj|j|j|jd|d��S)Nrr8)rQ�
IndexErrorr��_from_parsed_partsr�r�r�)r$�idxrrr�__getitem__Psz_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\eZdZdZdXZd	d
�Zdd�Zed
d��Zeddd��Z	eddd��Z
edd��Zdd�Zdd�Z
dd�Zdd�Zdd�Zd d!�Zd"d#�Zed$d%��Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�Zd0d1�Zeed�d2d3�Zeed�d2d4�Zed5d6��Zed7d8��Zed9d:��Z ed;d<��Z!ed=d>��Z"d?d@�Z#dAdB�Z$dCdD�Z%edEdF��Z&dGdH�Z'dIdJ�Z(dKdL�Z)edMdN��Z*edOdP��Z+dQdR�Z,dSdT�Z-dUdV�Z.dWS)YraHPurePath 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_cpartscGs4|tkr'tjdkr!tnt}|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^ryrr�_from_parts)r�r�rrr�__new__fszPurePath.__new__cCs|jt|j�fS)N)�	__class__�tupler�)r$rrr�
__reduce__pszPurePath.__reduce__cCs�g}xh|D]`}t|t�r2||j7}q
t|t�rW|jt|��q
tdt|���q
W|jj|�S)Nz/argument should be a path or str object, not %r)	�
isinstancerr�r]r-�	TypeErrorr�r�r7)r�r�r1rErrr�_parse_argsus
zPurePath._parse_argsTcCsVtj|�}|j|�\}}}||_||_||_|rR|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_partscCsB|s|r.|||jj|dd��S|jj|�SdS)Nr8)r�r#)r�r2r3r1rrr�_format_parsed_parts�s"zPurePath._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�s	*zPurePath._make_childcCsRy|jSWn@tk
rM|j|j|j|j�p<d|_|jSYnXdS)z[Return the string representation of the path, suitable for
        passing to system calls.r'N)r�r�r�r�r�r�)r$rrr�__str__�s
zPurePath.__str__cCs"|j}t|�j|jd�S)zNReturn the string representation of the path with forward (/)
        slashes.rA)r�r]r*r")r$�frrrrj�s	zPurePath.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;rj)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�rn)r$rrr�as_uri�szPurePath.as_uricCsCy|jSWn1tk
r>|jj|j�|_|jSYnXdS)N)r�r�r�r\r�)r$rrr�_cparts�s

zPurePath._cpartscCs5t|t�stS|j|jko4|j|jkS)N)r�r�NotImplementedr�r�)r$�otherrrr�__eq__�szPurePath.__eq__cCsCy|jSWn1tk
r>tt|j��|_|jSYnXdS)N)r�r��hashr�r�)r$rrr�__hash__�s

zPurePath.__hash__cCs6t|t�s"|j|jk	r&tS|j|jkS)N)r�rr�r�r�)r$r�rrr�__lt__�s"zPurePath.__lt__cCs6t|t�s"|j|jk	r&tS|j|jkS)N)r�rr�r�r�)r$r�rrr�__le__�s"zPurePath.__le__cCs6t|t�s"|j|jk	r&tS|j|jkS)N)r�rr�r�r�)r$r�rrr�__gt__�s"zPurePath.__gt__cCs6t|t�s"|j|jk	r&tS|j|jkS)N)r�rr�r�r�)r$r�rrr�__ge__�s"zPurePath.__ge__�docz.The drive prefix (letter or UNC path), if any.zThe root of the path, if any.cCs|j|j}|S)z/The concatenation of the drive and root, or ''.)r�r�)r$�anchorrrrr�szPurePath.anchorcCs?|j}t|�|js$|jr*dndkr7dS|dS)z!The final path component, if any.r8rr&rN)r�rQr�r�)r$r1rrrrys	*z
PurePath.namecCsT|j}|jd�}d|ko9t|�dknrL||d�SdSdS)z*The final component's last suffix, if any.r'rr8Nr&)ry�rfindrQ)r$ryrIrrr�suffix	s
	&zPurePath.suffixcCsO|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)rCrrrrr[s	z%PurePath.suffixes.<locals>.<listcomp>r8N)ry�endswithrSr,)r$ryrrr�suffixess
	zPurePath.suffixescCsT|j}|jd�}d|ko9t|�dknrL|d|�S|SdS)z0The final path component, minus its last suffix.r'rr8N)ryrrQ)r$ryrIrrr�stems
	&z
PurePath.stemcCs�|jstd|f��|jj|f�\}}}|s�|d|jj|jjgks�|s�|s�t|�dkr�td|��|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)ryr�r�r7r"r(rQr�r�r�r�)r$ryr2r3r1rrr�	with_name&s	)zPurePath.with_namecCs�|j}|j|ks0|jr@|j|kr@td|��|rV|jd�sb|dkrrtd|��|j}|s�td|f��|j}|s�||}n|dt|��|}|j|j	|j
|jdd�|g�S)zCReturn a new path with the file suffix changed (or added, if none).zInvalid suffix %rr'z%r has an empty nameNr8rN)r�r"r(r�rdryrrQr�r�r�r�)r$rr�ryZ
old_suffixrrr�with_suffix1s	'"		
zPurePath.with_suffixc
GsQ|std��|j}|j}|j}|rP||g|dd�}n|}|j|�\}}}|r�||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$r�r1r2r3Z	abs_partsZto_drvZto_rootZto_partsZto_abs_parts�nr�Z	formattedrrr�relative_toDs(				:	zPurePath.relative_tocCs=y|jSWn+tk
r8t|j�|_|jSYnXdS)zZAn object providing sequence-like access to the
        components in the filesystem path.N)r�r�r�r�)r$rrrr1ds

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�joinpathpszPurePath.joinpathcCs|j|f�S)N)r�)r$�keyrrr�__truediv__xszPurePath.__truediv__cCs|j|g|j�S)N)r�r�)r$rrrr�__rtruediv__{szPurePath.__rtruediv__cCsZ|j}|j}|j}t|�dkr=|s9|r=|S|j|||dd��S)zThe logical parent of the path.r8NrN)r�r�r�rQr�)r$r2r3r1rrr�parent~s			zPurePath.parentcCs
t|�S)z*A sequence of this path's logical parents.)r�)r$rrr�parents�szPurePath.parentscCs'|js
dS|jjp&t|j�S)zSTrue if the path is absolute (has both a root and, if applicable,
        a drive).F)r�r�rv�boolr�)r$rrrr��s	zPurePath.is_absolutecCs|jj|j�S)zaReturn True if the path contains one of the special names reserved
        by the system, if any.)r�rhr�)r$rrrrh�szPurePath.is_reservedc	Cs,|jj}||�}|jj|f�\}}}|sHtd��|rg|||j�krgdS|r�|||j�kr�dS|j}|s�|r�t|�t|�kr�dS|dd�}nt|�t|�kr�dSx?tt	|�t	|��D]"\}}t
j||�sdSqWdS)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�)/r;r<r=r>r�r�r��classmethodr�r�r�r�r�r�r�rjr�r�r��propertyr�r�r�rrrrrrir3rryrr	r
rrrr1rrrrrr�rhr�rrrrrZs\
	
			
	
 
c@seZdZeZfZdS)rN)r;r<r=�_posix_flavourr�r�rrrrr�sc@seZdZeZfZdS)rN)r;r<r=�_windows_flavourr�r�rrrrr�sc@s\eZdZd`Zdd�Zddd�Zdd	�Zd
d�Zdd
�Zdd�Z	ddd�Z
ddd�Zedd��Z
edd��Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,dadddd.d/�Zd0d1�Zddd2d3�Zd4d5�Zddd6d7�Zdd8d9d:�Zdd;d;d<d=�Zd>d?�Zd@dA�Z dBdC�Z!dDdE�Z"dFdG�Z#dHdI�Z$dJdK�Z%d;dLdM�Z&dNdO�Z'dPdQ�Z(dRdS�Z)dTdU�Z*dVdW�Z+dXdY�Z,dZd[�Z-d\d]�Z.d^d_�Z/dS)brr��_closedcOsl|tkr'tjdkr!tnt}|j|dd�}|jjs^td|j	f��|j
�|S)Nrr�Fz$cannot instantiate %r on your system)rr^ryrrr�r�rzr�r;r�)r�r��kwargsr$rrrr��s
zPath.__new__NcCs1d|_|dk	r$|j|_n	t|_dS)NF)rr��_normal_accessor)r$�templaterrrr��s	z
Path._initcCs)|j|g}|j|j|j|�S)N)r�r�r�r�)r$r5r1rrrr��szPath._make_child_relpathcCs|jr|j�|S)N)r�
_raise_closed)r$rrr�	__enter__�s	
zPath.__enter__cCs
d|_dS)NT)r)r$�t�v�tbrrr�__exit__�sz
Path.__exit__cCstd��dS)NzI/O operation on closed path)r�)r$rrrr�szPath._raise_closedi�cCs|jj|||�S)N)r�r�)r$ry�flagsr�rrr�_opener�szPath._openeri�cCs)|jr|j�|jj|||�S)zm
        Open the file pointed by this path and return a file descriptor,
        as os.open() does.
        )rrr�r�)r$r%r�rrr�	_raw_open�s	
zPath._raw_opencCs|tj��S)zjReturn a new path pointing to the current working directory
        (as returned by os.getcwd()).
        )r^r_)r�rrr�cwd�szPath.cwdcCs||�jjd��S)zrReturn a new path pointing to the user's home directory (as
        returned by os.path.expanduser('~')).
        N)r�ru)r�rrr�homesz	Path.homecCsS|j�}y|j�}Wn!tk
r?tj|�}YnXtjj||�S)zoReturn whether other_path is the same or not as this file
        (as returned by os.path.samefile()).
        )r�r�r^ra�samestat)r$Z
other_path�stZother_strrr�samefiles
z
Path.samefileccsd|jr|j�xJ|jj|�D]6}|dkr;q&|j|�V|jr&|j�q&WdS)zyIterate over the files in this directory.  Does not yield any
        result for the special paths '.' and '..'.
        r'�..N>r'r-)rrr�r�r�)r$ryrrr�iterdirs	
	zPath.iterdirccs�|stdj|���|jj|�}|jj|f�\}}}|sW|rctd��tt|��}x|j|�D]}|Vq�WdS)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�glob!sz	Path.globccs�|jj|�}|jj|f�\}}}|s<|rHtd��tdt|��}x|j|�D]}|VqnWdS)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)r2)r�r9r7r�r�r�r�)r$r/r2r3r�r0rZrrr�rglob/sz
Path.rglobcCs\|jr|j�|j�r#|S|jtj�g|jdd�}|jd|�|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.
        r�Fr)rrr�r�r^r_r�r�)r$�objrrr�absolute;s	
%z
Path.absolutecCs�|jr|j�|jj|�}|dkrM|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).
        Nr�Fr)rrr�rbr�r]r5rx�normpathr�r�)r$rYZnormedr4rrrrbMs	

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�asz	Path.statcCs%ddl}|j|j�j�jS)z:
        Return the login name of the file owner.
        rN)r�r�r��st_uidZpw_name)r$r�rrr�ownerhsz
Path.ownercCs%ddl}|j|j�j�jS)z8
        Return the group name of the file gid.
        rN)�grpZgetgrgidr��st_gidZgr_name)r$r9rrr�grouposz
Path.group�rr8c	Cs>|jr|j�tjt|�|||||d|j�S)z|
        Open the file pointed by this path and return a file object, as
        the built-in open() function does.
        Zopener)rr�ior�r]r&)r$r��	buffering�encoding�errors�newlinerrrr�vs	
!z	Path.openc	Cs*|jdd��}|j�SWdQRXdS)zK
        Open the file in bytes mode, read it, and close the file.
        r��rbN)r��read)r$r�rrr�
read_bytes�szPath.read_bytesc	Cs6|jddd|d|��}|j�SWdQRXdS)zJ
        Open the file in text mode, read it, and close the file.
        r�r<r?r@N)r�rC)r$r?r@r�rrr�	read_text�s!zPath.read_textc	Cs9t|�}|jdd��}|j|�SWdQRXdS)zO
        Open the file in bytes mode, write to it, and close the file.
        r��wbN)�
memoryviewr��write)r$�dataZviewr�rrr�write_bytes�szPath.write_bytesc	Cs^t|t�s%td|jj��|jddd|d|��}|j|�SWdQRXdS)zN
        Open the file in text mode, write to it, and close the file.
        zdata must be str, not %sr��wr?r@N)r�r]r�r�r;r�rH)r$rIr?r@r�rrr�
write_text�s
!zPath.write_textTcCs�|jr|j�|rIy|jj|d�Wntk
rDYnXdStjtjB}|sl|tjO}|j	||�}tj
|�dS)zS
        Create this file with the given access mode, if it doesn't exist.
        N)rrr�r�r�r^�O_CREAT�O_WRONLY�O_EXCLr'�close)r$r��exist_okr%�fdrrr�touch�s	


z
Path.touchFcCs�|jr|j�y|jj||�Wn�tk
r�|sP|j|krS�|jjdddd�|j|ddd|�Yn)tk
r�|s�|j�r��YnXdS)z<
        Create a new directory at this given path.
        rTrQFN)rrr�r��FileNotFoundErrorrr�r�)r$r�rrQrrrr��s	


z
Path.mkdircCs*|jr|j�|jj||�dS)zF
        Change the permissions of the path, like os.chmod().
        N)rrr�r�)r$r�rrrr��s	
z
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)rrr�r�)r$r�rrrr��s	
zPath.lchmodcCs'|jr|j�|jj|�dS)zd
        Remove this file or link.
        If the path is a directory, use rmdir() instead.
        N)rrr�r�)r$rrrr��s	
zPath.unlinkcCs'|jr|j�|jj|�dS)zF
        Remove this directory.  The directory must be empty.
        N)rrr�r�)r$rrrr��s	
z
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.
        )rrr�r�)r$rrrr��s	
z
Path.lstatcCs*|jr|j�|jj||�dS)z5
        Rename this path to the given path.
        N)rrr�r�)r$r�rrrr��s	
zPath.renamecCs*|jr|j�|jj||�dS)zo
        Rename this path to the given path, clobbering the existing
        destination if it exists.
        N)rrr�r*)r$r�rrrr*�s	
z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)rrr�r�)r$r�r�rrr�
symlink_tos	
zPath.symlink_tocCsVy|j�WnAtk
rQ}z!|jttfkr;�dSWYdd}~XnXdS)z+
        Whether this path exists.
        FNT)r�r�r�rr)r$r�rrrr�szPath.existscCs_yt|j�j�SWnAtk
rZ}z!|jttfkrD�dSWYdd}~XnXdS)z3
        Whether this path is a directory.
        FN)rr��st_moder�r�rr)r$r�rrrr�szPath.is_dircCs_yt|j�j�SWnAtk
rZ}z!|jttfkrD�dSWYdd}~XnXdS)zq
        Whether this path is a regular file (also True for symlinks pointing
        to regular files).
        FN)r
r�rVr�r�rr)r$r�rrr�is_file,szPath.is_filecCs_yt|j�j�SWnAtk
rZ}z!|jttfkrD�dSWYdd}~XnXdS)z7
        Whether this path is a symbolic link.
        FN)r	r�rVr�r�rr)r$r�rrrr�:szPath.is_symlinkcCs_yt|j�j�SWnAtk
rZ}z!|jttfkrD�dSWYdd}~XnXdS)z6
        Whether this path is a block device.
        FN)rr�rVr�r�rr)r$r�rrr�is_block_deviceFszPath.is_block_devicecCs_yt|j�j�SWnAtk
rZ}z!|jttfkrD�dSWYdd}~XnXdS)z:
        Whether this path is a character device.
        FN)r
r�rVr�r�rr)r$r�rrr�is_char_deviceSszPath.is_char_devicecCs_yt|j�j�SWnAtk
rZ}z!|jttfkrD�dSWYdd}~XnXdS)z.
        Whether this path is a FIFO.
        FN)rr�rVr�r�rr)r$r�rrr�is_fifo`szPath.is_fifocCs_yt|j�j�SWnAtk
rZ}z!|jttfkrD�dSWYdd}~XnXdS)z0
        Whether this path is a socket.
        FN)rr�rVr�r�rr)r$r�rrr�	is_socketmszPath.is_socketcCs�|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�rur�)r$Zhomedirrrr�
expanduserzs
&#!zPath.expanduser)r�rrN)0r;r<r=r�r�r�r�r r$rr&r'rr(r)r,r.r1r3r5rbr�r8r;r�rDrErJrLrSr�r�r�r�r�r�r�r*rUr�r�rWr�rXrYrZr[r]rrrrr�s\	
	
				




c@seZdZfZdS)rN)r;r<r=r�rrrrr�sc@s.eZdZfZdd�Zdd�ZdS)rcCstd��dS)Nz*Path.owner() is unsupported on this system)r�)r$rrrr8�szWindowsPath.ownercCstd��dS)Nz*Path.group() is unsupported on this system)r�)r$rrrr;�szWindowsPath.groupN)r;r<r=r�r8r;rrrrr�s)=r�r�r=rwr^r�r�r.�collectionsr�
contextlibrr�rrr�operatorrr�rr	r
rrr
rZurllib.parserrkr�ryrZgetwindowsversionr�__all__r r�r!r?r~rrr�r�rr�r�r�r�r�r�r�r�r�r�rrrrrrrrrr�<module>sd4"		?�b		;	
'�Z��

Zerion Mini Shell 1.0