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.opt-2.pyc



���]���@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@s4eZdZdd�Zdd�Zdd�ZdS)�_FlavourcCs|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)N�)�casefold)r$r2r3r1Zdrv2Zroot2Zparts2rrr�join_parsed_partsYs
%*z_Flavour.join_parsed_partsN)�__name__�
__module__�__qualname__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)rA)rBr6rrrrCxs�A�Zz\\?\ZCONZPRNZAUXZNULcCsh|]}d|�qS)zCOM%dr)rB�irrr�	<setcomp>~s	z_WindowsFlavour.<setcomp>�
cCsh|]}d|�qS)zLPT%dr)rBrHrrrrIs	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&��:���rM)�_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)rW)rB�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$�pathrXrrr�resolve�s
z_WindowsFlavour.resolvecCsvd}|j|�rl|dd�}|dd�}|jd�rl||dd�7}d|dd�}||fS)Nr&�zUNC\rKr?)�
startswith)r$rXZ
ext_prefixrUrrrrN�sz$_WindowsFlavour._split_extended_pathcCs|j|�dS)Nr8)rN)r$rXrrrr_�sz_WindowsFlavour._ext_to_normalcCsE|s
dS|djd�r!dS|djd�dj�|jkS)NFrz\\r8r'rM)rc�	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)Nrr8rLr@z
file:///%s/%szutf-8zfile:)�driverP�as_posixrR�urlquote_from_bytes�encode)r$r`rh�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 %rrMrM)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�ordrQZext_namespace_prefixrfr+r9r[rarNr_rgrmrtrrrrr>ks&/3)	'	
r>c@s�eZdZdZdZdZeZej	dkZ
edd�Zdd�Zd	d
�Z
dd�Zd
d�Zdd�Zdd�ZdS)�
_PosixFlavourr@r&FrcCss|rb|d|krb|j|�}t|�t|�dkrRd|d|fSd||fSn
dd|fSdS)Nrrr&)rRrP)r$r5r"Z
stripped_partrrrr+sz_PosixFlavour.splitrootcCs|S)Nr)r$rXrrrr9sz_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)rcr,�
rpartitionrq�readlink�OSError�errnor)r`rlrx�_�newpath�target�e)�_resolve�accessor�seenr"rrr�$s0

z'_PosixFlavour.resolve.<locals>._resolver&)r"�	_accessor�is_absoluter]r^r\)r$r`�baser)r�r�r�r"rra s		%z_PosixFlavour.resolvecCsdS)NFr)r$r1rrrrgLsz_PosixFlavour.is_reservedcCst|�}dt|�S)Nzfile://)�bytesrj)r$r`ZbpathrrrrmOsz_PosixFlavour.make_uricCs�|sOytjdSWq�tk
rKddl}|jtj��jSYq�XnEddl}y|j|�jSWn"tk
r�td|��YnXdS)Nrnrz%Can't determine home directory for %r)	r]rorp�pwd�getpwuid�getuid�pw_dir�getpwnamrq)r$rrr�rrrrtUs

z_PosixFlavour.gethomedirN)r;r<r=r"r(ru�	posixpathrwr]rxryr+r9r[rargrmrtrrrrr}s,r}c@seZdZdS)�	_AccessorN)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�)rD�b�target_is_directoryrrr�symlink�sz_NormalAccessor.symlinkcCstjt|�t|��S)N)r]r�r\)rDr�r�rrrr��scCs
tj|�S)N)r]r)r$r`rrrr�sz_NormalAccessor.readlinkN)r;r<r=r�r�r]�stat�lstat�open�listdir�chmod�hasattrr��mkdir�unlink�rmdir�renamer*r�supports_symlinksr�r��utimerrrrrr�ns,r�c#sdy�j�VWnMtk
r_i���fdd�}d|_z	|VWd�j�XYnXdS)Ncs=y�|SWn*tk
r8�|�}�|<|SYnXdS)N)rp)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(eZdZdd�Zdd�ZdS)�	_SelectorcCs1||_|r!t|�|_nt�|_dS)N)r�r��	successor�_TerminatingSelector)r$r�rrrr%�s	z_Selector.__init__cCs@t|�}|j}|j}|jj}|j||||�S)N)�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�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)rxr�r%)r$rxr�rrrr%�s	z_PreciseSelector.__init__ccszy]||�sdS|j|j�}||�r\x(|jj||||�D]}|VqMWWntk
rudSYnXdS)N)�_make_child_relpathrxr�r��PermissionError)r$r�r�r�r�r`rYrrrr��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��cfrxZ
casefoldedr`rYrrrr�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�rxr`rYrrrr�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�rzr�r�r��addr�r�)	r$r�r�r�r�ZyieldedZsuccessor_selectZstarting_pointrYrrrr�'s	
z'_RecursiveWildcardSelector._select_fromN)r;r<r=r%r�r�rrrrr�sr�c@sFeZdZdZdd�Zdd�Zd	d
�Zdd�Zd
S)�_PathParents�_pathcls�_drv�_root�_partscCs7t|�|_|j|_|j|_|j|_dS)N)r�r�r�r�r�)r$r`rrrr%Csz_PathParents.__init__cCs4|js|jr#t|j�dSt|j�SdS)Nr8)r�r�rPr�)r$rrr�__len__Jsz_PathParents.__len__cCsX|dks|t|�kr*t|��|jj|j|j|jd|d��S)Nrr8)rP�
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=�	__slots__r%r�r�r�rrrrr�>s
r�c@sVeZdZdWZdd	�Zd
d�Zedd
��Zeddd��Zeddd��Z	edd��Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd �Zd!d"�Zed#d$��Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zeed�d1d2�Zeed�d1d3�Zed4d5��Zed6d7��Zed8d9��Zed:d;��Z ed<d=��Z!d>d?�Z"d@dA�Z#dBdC�Z$edDdE��Z%dFdG�Z&dHdI�Z'dJdK�Z(edLdM��Z)edNdO��Z*dPdQ�Z+dRdS�Z,dTdU�Z-dVS)Xrr�r�r��_str�_hash�_pparts�_cached_cpartscGs4|tkr'tjdkr!tnt}|j|�S)Nr)rr]rxrr�_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�r1rDrrr�_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)Nr')r�r�r�r�r�r�)r$rrr�__str__�s
zPurePath.__str__cCs"|j}t|�j|jd�S)Nr@)r�r\r*r")r$�frrrri�s	zPurePath.as_posixcCstjt|��S)N)r]�fsencoder\)r$rrr�	__bytes__�szPurePath.__bytes__cCsdj|jj|j��S)Nz{}({!r}))r�r�r;ri)r$rrrr��szPurePath.__repr__cCs(|j�std��|jj|�S)Nz.relative path can't be expressed as a file URI)r�r�r�rm)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)N)r�r�)r$�anchorrrrr�szPurePath.anchorcCs?|j}t|�|js$|jr*dndkr7dS|dS)Nr8rr&rM)r�rPr�r�)r$r1rrrrxs	*z
PurePath.namecCsT|j}|jd�}d|ko9t|�dknrL||d�SdSdS)Nr'rr8r&)rx�rfindrP)r$rxrHrrr�suffix	s
	&zPurePath.suffixcCsO|j}|jd�rgS|jd�}dd�|jd�dd�D�S)Nr'cSsg|]}d|�qS)r'r)rBrrrrrZs	z%PurePath.suffixes.<locals>.<listcomp>r8)rx�endswithrRr,)r$rxrrr�suffixess
	zPurePath.suffixescCsT|j}|jd�}d|ko9t|�dknrL|d|�S|SdS)Nr'rr8)rxrrP)r$rxrHrrr�stems
	&z
PurePath.stemcCs�|jstd|f��|jj|f�\}}}|s�|d|jj|jjgks�|s�|s�t|�dkr�td|��|j|j|j	|j
dd�|g�S)Nz%r has an empty namer8zInvalid name %rrMrM)rxr�r�r7r"r(rPr�r�r�r�)r$rxr2r3r1rrr�	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)NzInvalid suffix %rr'z%r has an empty namer8rM)r�r"r(r�rcrxrrPr�r�r�r�)r$rr�rxZ
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)Nzneed at least one argumentr8rz{!r} does not start with {!r}r&)
r�r�r�r�r�rPr�r[r�r�r�r\r�)
r$r�r1r2r3Z	abs_partsZto_drvZto_rootZto_partsZto_abs_parts�nr��	formattedrrr�relative_toDs(				:	zPurePath.relative_tocCs=y|jSWn+tk
r8t|j�|_|jSYnXdS)N)r�r�r�r�)r$rrrr1ds

zPurePath.partscGs
|j|�S)N)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)Nr8rM)r�r�r�rPr�)r$r2r3r1rrr�parent~s			zPurePath.parentcCs
t|�S)N)r�)r$rrr�parents�szPurePath.parentscCs'|js
dS|jjp&t|j�S)NF)r�r�ru�boolr�)r$rrrr��s	zPurePath.is_absolutecCs|jj|j�S)N)r�rgr�)r$rrrrg�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)Nz
empty patternFr8T)r�r9r7r�r�r�r�rP�zipr)r��fnmatchcase)	r$Zpath_patternr�r2r3Z	pat_partsr1r5rrrrr��s(	(zPurePath.matchN)r�r�r�r�r�r�r�).r;r<r=r�r�r��classmethodr�r�r�r�r�r�r�rir�r�r��propertyr�r�r�r�rrrrrhr3rrxrrr	r
rrr1rrrrrr�rgr�rrrrrZsZ
	
			
	
 
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]rxrrr�r�ryr�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$rx�flagsr�rrr�_opener�szPath._openeri�cCs)|jr|j�|jj|||�S)N)rr r�r�)r$r&r�rrr�	_raw_open�s	
zPath._raw_opencCs|tj��S)N)r]r^)r�rrr�cwd�szPath.cwdcCs||�jjd��S)N)r�rt)r�rrr�homesz	Path.homecCsS|j�}y|j�}Wn!tk
r?tj|�}YnXtjj||�S)N)r�r�r]r`�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)Nr'�..>r.r')rr r�r�r�)r$rxrrr�iterdirs	
	zPath.iterdirccs�|stdj|���|jj|�}|jj|f�\}}}|sW|rctd��tt|��}x|j|�D]}|Vq�WdS)NzUnacceptable pattern: {!r}z%Non-relative patterns are unsupported)	r�r�r�r9r7r�r�r�r�)r$�patternr2r3r��selectorrYrrr�glob!sz	Path.globccs�|jj|�}|jj|f�\}}}|s<|rHtd��tdt|��}x|j|�D]}|VqnWdS)Nz%Non-relative patterns are unsupported�**)r3)r�r9r7r�r�r�r�)r$r0r2r3r�r1rYrrr�rglob/sz
Path.rglobcCs\|jr|j�|j�r#|S|jtj�g|jdd�}|jd|�|S)Nr�Fr)rr r�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)Nr�Fr)rr r�rar�r\r6rw�normpathr�r�)r$rXZnormedr5rrrraMs	

zPath.resolvecCs|jj|�S)N)r�r�)r$rrrr�asz	Path.statcCs%ddl}|j|j�j�jS)Nr)r�r�r��st_uid�pw_name)r$r�rrr�ownerhsz
Path.ownercCs%ddl}|j|j�j�jS)Nr)�grp�getgrgidr��st_gid�gr_name)r$r;rrr�grouposz
Path.group�rr8c	Cs>|jr|j�tjt|�|||||d|j�S)NZopener)rr �ior�r\r')r$r��	buffering�encoding�errors�newlinerrrr�vs	
!z	Path.openc	Cs*|jdd��}|j�SWdQRXdS)Nr��rb)r��read)r$r�rrr�
read_bytes�szPath.read_bytesc	Cs6|jddd|d|��}|j�SWdQRXdS)Nr�r@rCrD)r�rG)r$rCrDr�rrr�	read_text�s!zPath.read_textc	Cs9t|�}|jdd��}|j|�SWdQRXdS)Nr��wb)�
memoryviewr��write)r$�data�viewr�rrr�write_bytes�szPath.write_bytesc	Cs^t|t�s%td|jj��|jddd|d|��}|j|�SWdQRXdS)Nzdata must be str, not %sr��wrCrD)r�r\r�r�r;r�rL)r$rMrCrDr�rrr�
write_text�s
!zPath.write_textTcCs�|jr|j�|rIy|jj|d�Wntk
rDYnXdStjtjB}|sl|tjO}|j	||�}tj
|�dS)N)rr r�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)NrTrVF)rr r�r��FileNotFoundErrorrr�r�)r$r�rrVrrrr��s	


z
Path.mkdircCs*|jr|j�|jj||�dS)N)rr r�r�)r$r�rrrr��s	
z
Path.chmodcCs*|jr|j�|jj||�dS)N)rr r�r�)r$r�rrrr��s	
zPath.lchmodcCs'|jr|j�|jj|�dS)N)rr r�r�)r$rrrr��s	
zPath.unlinkcCs'|jr|j�|jj|�dS)N)rr r�r�)r$rrrr��s	
z
Path.rmdircCs#|jr|j�|jj|�S)N)rr r�r�)r$rrrr��s	
z
Path.lstatcCs*|jr|j�|jj||�dS)N)rr r�r�)r$r�rrrr��s	
zPath.renamecCs*|jr|j�|jj||�dS)N)rr r�r*)r$r�rrrr*�s	
zPath.replacecCs-|jr|j�|jj|||�dS)N)rr r�r�)r$r�r�rrr�
symlink_tos	
zPath.symlink_tocCsVy|j�WnAtk
rQ}z!|jttfkr;�dSWYdd}~XnXdS)NFT)r�r�r�rr)r$r�rrrr�szPath.existscCs_yt|j�j�SWnAtk
rZ}z!|jttfkrD�dSWYdd}~XnXdS)NF)rr��st_moder�r�rr)r$r�rrrr�szPath.is_dircCs_yt|j�j�SWnAtk
rZ}z!|jttfkrD�dSWYdd}~XnXdS)NF)r
r�r[r�r�rr)r$r�rrr�is_file,szPath.is_filecCs_yt|j�j�SWnAtk
rZ}z!|jttfkrD�dSWYdd}~XnXdS)NF)r	r�r[r�r�rr)r$r�rrrr�:szPath.is_symlinkcCs_yt|j�j�SWnAtk
rZ}z!|jttfkrD�dSWYdd}~XnXdS)NF)rr�r[r�r�rr)r$r�rrr�is_block_deviceFszPath.is_block_devicecCs_yt|j�j�SWnAtk
rZ}z!|jttfkrD�dSWYdd}~XnXdS)NF)r
r�r[r�r�rr)r$r�rrr�is_char_deviceSszPath.is_char_devicecCs_yt|j�j�SWnAtk
rZ}z!|jttfkrD�dSWYdd}~XnXdS)NF)rr�r[r�r�rr)r$r�rrr�is_fifo`szPath.is_fifocCs_yt|j�j�SWnAtk
rZ}z!|jttfkrD�dSWYdd}~XnXdS)NF)rr�r[r�r�rr)r$r�rrr�	is_socketmszPath.is_socketcCs�|jp|jr}|jr}|jddd�dkr}|jj|jddd��}|j|g|jdd��S|S)Nrr8�~)r�r�r�r�rtr�)r$Zhomedirrrr�
expanduserzs
&#!zPath.expanduser)r�rrM)0r;r<r=r�r�r�r�r!r%r r'r(rr)r*r-r/r2r4r6rar�r:r?r�rHrIrOrQrXr�r�r�r�r�r�r�r*rZr�r�r\r�r]r^r_r`rbrrrrr�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$rrrr:�szWindowsPath.ownercCstd��dS)Nz*Path.group() is unsupported on this system)r�)r$rrrr?�szWindowsPath.groupN)r;r<r=r�r:r?rrrrr�s)=r�r�rArvr]r�r�r.�collectionsr�
contextlibrr�rrr�operatorrr�rr	r
rrr
rZurllib.parserrjr�rxrZgetwindowsversionr�__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