HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //home/arjun/projects/env/lib/python3.10/site-packages/pathlib_mate/pathlib2.pyc
�
�´ac@s%yddlZWnnXddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
mZmZm
Z
ddl
mZmZmZmZddlmZddlmZmZmZmZmZmZmZddlZyddlmZWn!ek
rKddl mZnXyddl!m"Z#Wn!ek
r�ddl$m%Z#nXy
e&Z&Wne'k
r�e	j&Z&nXe(Z)ej*d	krddl+Z+e	j,�d
 ddfko�e	j-d
d
fkrddl+m.Z.ne/Z)e0Z.ne0Z+yddlm1Z2Wn!ek
r\ddl1m1Z2nXddl3m4Z4ddddddgZ5eeefZ6dfZ7d�Z8d�Z9e0d�Z:d�Z;d�Z<d�Z=d�Z>de?fd ��YZ@d!e@fd"��YZAd#e@fd$��YZBeA�ZCeB�ZDd%fd&��YZEd'eEfd(��YZFeF�ZGd)�ZHeIed*�r�ejJ�eH�ZHnd+fd,��YZKd-fd.��YZLd/eKfd0��YZMd1eKfd2��YZNd3eKfd4��YZOd5efd6��YZPde?fd7��YZQe	j-d
dfkrNejRjSeQ�ndeQfd8��YZTdeQfd9��YZUd:d;lVmWZWd:d<lXmYZYd:d=lZm[Z[d:d>l\m]Z]d:d?l^m_Z_deQeWeYe[e]e_fd@��YZ`de`eTfdA��YZade`eUfdB��YZbdS(Ci����N(tEEXISTtEPERMtEACCES(tEINVALtENOENTtENOTDIRtEBADF(t
attrgetter(tS_ISDIRtS_ISLNKtS_ISREGtS_ISSOCKtS_ISBLKtS_ISCHRtS_ISFIFO(tSequence(tquote(tquote_from_bytestntiiii(t_getfinalpathname(tscandir(tatomic_writetPurePatht
PurePosixPathtPureWindowsPathtPatht	PosixPathtWindowsPathicCs.t|dd�tkp-t|dd�tkS(Nterrnotwinerror(tgetattrtNonet_IGNORED_ERROSt_IGNORED_WINERRORS(t	exception((spathlib_mate/pathlib2.pyt
_ignore_errorPscCsGtjst�g|D]-}t|tj�r=|jd�n|^qS(Ntascii(tsixtPY2tAssertionErrort
isinstancet	text_typetencode(tpartstpart((spathlib_mate/pathlib2.pyt
_py2_fsencodeUscCs�tjdkrSy|�Wntk
r9}||�q�X|dk	r�|�q�nVy|�Wn2tk
r�}|jtkr��q�||�nX|dk	r�|�ndS(Ni(ii(tsystversion_infotFileExistsErrorRtEnvironmentErrorRR(ttry_functexcept_funct	else_functexc((spathlib_mate/pathlib2.pyt_try_except_fileexistserror\s
cCstjdkr=y|�Wqtk
r9}||�qXn�tjdkr�y|�Wqtk
r�}|jtkr~�q�||�qXnqy|�Wnctk
r�}|jdkr��q||�n2tk
r�}|jtkr��q||�nXdS(NiRi(ii(ii(	R.R/tFileNotFoundErrortostnameR1RRtWindowsError(R2R3R5((spathlib_mate/pathlib2.pyt_try_except_filenotfounderrorrs,
ccs�tjdkrayx|�D]}|VqWWq�tk
r]}x||�D]}|VqKWq�Xnjyx|�D]}|VqnWWnJtk
r�}|jttfkr��q�x||�D]}|Vq�WnXdS(Ni(ii(R.R/tPermissionErrorR1RRR(ttry_itertexcept_itertxR5((spathlib_mate/pathlib2.pyt _try_except_permissionerror_iter�s

cs�ddlm}m}m}ddlm�m}m}d|f�fd��Y�d|f��fd��Y}tjj	j
}tj��tj��|g|_
||_tjj	j}|||�g|_
||_tjj	j}	|g|	_
||	_d}
d	}d
}d}
tjj|�r3|}nd}|||
|d|
|d�}|d
kr�tjdkr�t|��q�td�}t|_|�n|�}|||�}|	|�|dkr�|��n|j|j|jfS(Ni����(tPOINTERt	StructuretWinError(tDWORDtHANDLEtBOOLtFILETIMEcs eZd�fd�fgZRS(tdatetime_lotdatetime_hi(t__name__t
__module__t_fields_((RD(spathlib_mate/pathlib2.pyRG�s	tBY_HANDLE_FILE_INFORMATIONcsheZd�fd�fd�fd�fd�fd�fd�fd�fd�fd	�fg
ZRS(
t
attributest
created_attaccessed_att
written_attvolumetfile_hitfile_lotn_linkstindex_hitindex_lo(RJRKRL((RDRG(spathlib_mate/pathlib2.pyRM�s									I�iiiiI����sfile not found: path(ii(tctypesRARBRCtctypes.wintypesRDRERFtwindlltkernel32tCreateFileWt	c_wchar_ptc_void_ptargtypestrestypetGetFileInformationByHandletCloseHandleR8tpathtisdirRR.R/R7tOSErrorRRRRRVRW(RcRARBRCRERFRMt
CreateFileRaRbtGENERIC_READtFILE_SHARE_READtFILE_FLAG_BACKUP_SEMANTICSt
OPEN_EXISTINGtflagsthfileR5tinfotsuccess((RDRGspathlib_mate/pathlib2.pyt_win32_get_unique_path_id�sF
							
cCs"d|kp!d|kp!d|kS(Nt*t?t[((tpat((spathlib_mate/pathlib2.pyt_is_wildcard_pattern�st_FlavourcBs)eZdZd�Zd�Zd�ZRS(sPA flavour implements a particular (platform-specific) set of path
    semantics.cCs|jj|_dS(N(tseptjoin(tself((spathlib_mate/pathlib2.pyt__init__�scCs�tjrt|�}ng}|j}|j}d}}t|�}x:|D]2}|s_qMn|rz|j||�}n|j|�\}}}	||	kr�xpt|	j|��D].}
|
r�|
dkr�|j	t
|
��q�q�Wn(|	r|	dkr|j	t
|	��n|s|rM|s{xU|D]J}|s<q*n|rW|j||�}n|j|�d}|r*Pq*q*WnPqMqMW|s�|r�|j	||�n|j�|||fS(Ntt.i(R%R&R-Rvtaltseptreversedtreplacet	splitroottsplittappendtinterntreverse(RxR+tparsedRvR|tdrvtroottitR,trelR?((spathlib_mate/pathlib2.pytparse_parts�sD			



cCs�|r2|r�|r�||||g|dfSnY|rz||ksb|j|�|j|�kr�||||dfSn||||fS|||fS(s�
        Join the two paths represented by the respective
        (drive, root, parts) tuples.  Return a new (drive, root, parts) tuple.
        i(tcasefold(RxR�R�R+tdrv2troot2tparts2((spathlib_mate/pathlib2.pytjoin_parsed_partss
*(RJRKt__doc__RyR�R�(((spathlib_mate/pathlib2.pyRu�s		(t_WindowsFlavourcBseZdZdZeZeZej	dkZ
ed�ZdZ
eddddg�eged	d
�D]Zde^qg�Beged	d
�D]Zde^q��BZed
�Zd�Zd�Zed�Ze
d�Zd�Zd�Zd�Zd�ZRS(s\t/Rt4abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZs\\?\tCONtPRNtAUXtNULii
sCOM%dsLPT%dcCs�|dd!}|dd!}||krd||krd|j|�\}}|dd!}|dd!}nd}|dd!}||krB||krB||krB|j|d�}|dkrB|j||d�}||dkr?|dkr�t|�}n|r ||d|!|||dfS|| |||dfSq?qBnd}	}
|dkr�||jkr�|d }	|d}|}n||kr�|}
|j|�}n||	|
|fS(NiiiRzii����t:(t_split_extended_pathtfindtlent
drive_letterstlstrip(RxR,Rvtfirsttsecondtprefixtthirdtindextindex2R�R�((spathlib_mate/pathlib2.pyREs6



$ "


	cCs
|j�S(N(tlower(Rxts((spathlib_mate/pathlib2.pyR�lscCsg|D]}|j�^qS(N(R�(RxR+tp((spathlib_mate/pathlib2.pytcasefold_partsoscs	t|���stj�Sd}tdk	r|rG�jt���Sg}���fd�}d�}x�trddg�t||��ddkr��}tjj	��\�}|j
|�|�kr�|Sqn�d�tjj�t|��SqnWndS(Ncs'�jt����d<d�d<dS(Nii(t_ext_to_normalR((tresultR�Rx(spathlib_mate/pathlib2.pyt	_try_func~scSsdS(N((R5((spathlib_mate/pathlib2.pyt	_exc_func�sii(
tstrR8tgetcwdRRR�tTrueR;RcR�R�RwR}(RxRctstrictt
previous_st
tail_partsR�R�ttail((R�R�Rxspathlib_mate/pathlib2.pytresolvers,
		


 cCsdd}|j|�rZ|d }|d}|jd�rZ||d 7}d|d}qZn||fS(NRzisUNC\is\(t
startswith(RxR�t
ext_prefixR�((spathlib_mate/pathlib2.pyR��s

cCs|j|�dS(Ni(R�(RxR�((spathlib_mate/pathlib2.pyR��scCsE|s
tS|djd�r!tS|djd�dj�|jkS(Nis\\i����R{(tFalseR�t	partitiontuppertreserved_names(RxR+((spathlib_mate/pathlib2.pytis_reserved�s
cCs�|j}t|�dkra|ddkra|j�djd�}d|t|jd��fSdt|j�jd��SdS(NiiR�R�s
file:///%s/%ssutf-8sfile:(tdriveR�tas_posixR�turlquote_from_bytesR*(RxRcR�trest((spathlib_mate/pathlib2.pytmake_uri�s	"cCsCdtjkrtjd}nydtjkr>tjd}nZdtjkr�ytjd}Wntk
rwd}nX|tjd}ntd��|r?tjd|kr?|j|f�\}}}|dtjdkr�td	|��n||d<|s|r*|||j|d
�}q<|j|�}q?n|S(NtHOMEtUSERPROFILEtHOMEPATHt	HOMEDRIVERzsCan't determine home directorytUSERNAMEi����s%Can't determine home directory for %ri(R8tenvirontKeyErrortRuntimeErrorR�Rw(RxtusernametuserhomeR�R�R+((spathlib_mate/pathlib2.pyt
gethomedir�s,



(RJRKRvR|R�thas_drvtntpathtpathmodR8R9tis_supportedtsetR�text_namespace_prefixtrangetiR�RR�R�R�R�R�R�R�R�R�(((spathlib_mate/pathlib2.pyR�+s$?-	'		#
			
t
_PosixFlavourcBsteZdZdZeZeZej	dkZ
ed�Zd�Zd�Z
ed�Zd�Zd�Zd	�ZRS(
R�RzRcCss|rb|d|krb|j|�}t|�t|�dkrRd|d|fSd||fSn
dd|fSdS(NiiRz(R�R�(RxR,Rvt
stripped_part((spathlib_mate/pathlib2.pyR�scCs|S(N((RxR�((spathlib_mate/pathlib2.pyR��scCs|S(N((RxR+((spathlib_mate/pathlib2.pyR��scsj|j�|j�i������fd��|j�rEdn	tj�}�|t|��pi�S(Ncs/|j��rd}nx|j��D]�}|s(|dkrGq(n|dkrq|j��\}}}q(n|�|}|�kr��|}|dk	r�q(ntd|��ny�j|�}Wn4tk
r}|jtkr��r��n|}q(Xd�|<�||�}|�|<q(W|S(NRzR{s..sSymlink loop from %r(	R�R�t
rpartitionRR�treadlinkReRR(RcR�R9t_tnewpathttargette(t_resolvetaccessortseenRvR�(spathlib_mate/pathlib2.pyR��s0	


Rz(Rvt	_accessortis_absoluteR8R�R�(RxRcR�tbase((R�R�R�RvR�spathlib_mate/pathlib2.pyR��s		(cCstS(N(R�(RxR+((spathlib_mate/pathlib2.pyR�*scCst|�}dt|�S(Nsfile://(tbytesR�(RxRctbpath((spathlib_mate/pathlib2.pyR�-scCs�|sKytjdSWq�tk
rGddl}|jtj��jSXnDddl}y|j|�jSWn!tk
r�td|��nXdS(NR�i����s%Can't determine home directory for %r(	R8R�R�tpwdtgetpwuidtgetuidtpw_dirtgetpwnamR�(RxR�R�((spathlib_mate/pathlib2.pyR�3s

(RJRKRvR|R�R�t	posixpathR�R8R9R�RR�R�R�R�R�R�(((spathlib_mate/pathlib2.pyR��s		0		t	_AccessorcBseZdZRS(sjAn accessor implements a particular (system-specific or not) way of
    accessing paths on the filesystem.(RJRKR�(((spathlib_mate/pathlib2.pyR�Gst_NormalAccessorcBsIeZd�Zd�Zeej�Zeej�Zeej�Zeej�Zee	�Z
eej�Zeed�r�eej
�Z
n	d�Z
eej�Zeej�Zeej�Zeej�Zejdkr�eej�Zner ereej�Zq/d�Zned��Zeej�Zd�ZRS(	cs(tj���fd��}t|�S(Ncs�t|�|�S(N(R�(tpathobjtargs(tstrfunc(spathlib_mate/pathlib2.pytwrappedOs(t	functoolstwrapststaticmethod(R�R�((R�spathlib_mate/pathlib2.pyt
_wrap_strfuncNscs(tj���fd��}t|�S(Ncs�t|�t|�|�S(N(R�(tpathobjAtpathobjBR�(R�(spathlib_mate/pathlib2.pyR�Vs(R�R�R�(R�R�((R�spathlib_mate/pathlib2.pyt_wrap_binary_strfuncUstlchmodcCstd��dS(Ns%lchmod() not available on this system(tNotImplementedError(RxR�tmode((spathlib_mate/pathlib2.pyR�ksicCstd��dS(Ns&symlink() not available on this system(R�(tatbttarget_is_directory((spathlib_mate/pathlib2.pytsymlink}scCstjt|�t|��S(N(R8R�R�(R�R�R�((spathlib_mate/pathlib2.pyR��scCs
tj|�S(N(R8R�(RxRc((spathlib_mate/pathlib2.pyR��s(ii(RJRKR�R�R8tstattlstattopentlistdirt
os_scandirRtchmodthasattrR�tmkdirtunlinktrmdirtrenameR.R/R~Rtsupports_symlinksR�R�tutimeR�(((spathlib_mate/pathlib2.pyR�Ls0			cCsl|d}|d}|dkr)t}n6d|krDtd��nt|�rYt}nt}|||�S(Niis**s:Invalid pattern: '**' can only be an entire path component(t_RecursiveWildcardSelectort
ValueErrorRtt_WildcardSelectort_PreciseSelector(t
pattern_partsRstchild_partstcls((spathlib_mate/pathlib2.pyt_make_selector�s

		t	lru_cachet	_SelectorcBs eZdZd�Zd�ZRS(sYA selector matches a specific glob pattern part against the children
    of a given path.cCsC||_|r*t|�|_t|_nt�|_t|_dS(N(RRt	successorR�tdironlyt_TerminatingSelectorR�(RxR((spathlib_mate/pathlib2.pyRy�s	cCsVt|�}|j}|j}|jj}||�s@tg�S|j||||�S(suIterate over all child paths of `parent_path` matched by this
        selector.  This can contain parent_path itself.(ttypetis_dirtexistsR�Rtitert_select_from(Rxtparent_pathtpath_clsRRR((spathlib_mate/pathlib2.pytselect_from�s		
(RJRKR�RyR(((spathlib_mate/pathlib2.pyR�s		RcBseZd�ZRS(ccs	|VdS(N((RxRRRR((spathlib_mate/pathlib2.pyR�s(RJRKR(((spathlib_mate/pathlib2.pyR�sRcBseZd�Zd�ZRS(cCs||_tj||�dS(N(R9RRy(RxR9R((spathlib_mate/pathlib2.pyRy�s	c#sG�����fd�}d�}xt||�D]}|Vq4WdS(Nc3s_�j�j�}�jr!�n�|�r[x+�jj|����D]}|VqIWndS(N(t_make_child_relpathR9RRR(RcR�(RRRRRx(spathlib_mate/pathlib2.pyR=�s
css	dSdV(N((R5((spathlib_mate/pathlib2.pyR>�s(R@(RxRRRRR=R>R?((RRRRRxspathlib_mate/pathlib2.pyR�s	(RJRKRyR(((spathlib_mate/pathlib2.pyR�s	RcBseZd�Zd�ZRS(cCs/tjtj|��|_tj||�dS(N(tretcompiletfnmatcht	translateRsRRy(RxRsR((spathlib_mate/pathlib2.pyRy�sc#sG�����fd�}d�}xt||�D]}|Vq4WdS(Nc3s��jj}t����}x�|D]�}�jsA|j�r%|j}||�}�jj|�r��j|�}x+�j	j
|����D]}|Vq�Wq�q%q%WdS(N(t_flavourR�tlistRRR9RstmatchRRR(tcftentriestentryR9t
casefoldedRcR�(RRRRRx(spathlib_mate/pathlib2.pyR=�s
	css	dSdV(N((R5((spathlib_mate/pathlib2.pyR>�s(R@(RxRRRRR=R>R?((RRRRRxspathlib_mate/pathlib2.pyR�s
	(RJRKRyR(((spathlib_mate/pathlib2.pyR�s	R	cBs#eZd�Zd�Zd�ZRS(cCstj||�dS(N(RRy(RxRsR((spathlib_mate/pathlib2.pyRy�sc#sI�V����fd�}d�}xt||�D]}|Vq6WdS(Nc3s�t����}x�|D]�}t}y|j�}Wn%tk
r\}t|�s]�q]nX|r|j�r�j|j�}x%�j|���D]}|Vq�WqqWdS(N(	R$R�RReR#t
is_symlinkRR9t_iterate_directories(R'R(tentry_is_dirR�RcR�(RRRRx(spathlib_mate/pathlib2.pyR=s

css	dSdV(N((R5((spathlib_mate/pathlib2.pyR>s(R@(RxRRRR=R>R?((RRRRxspathlib_mate/pathlib2.pyR+�s
	c#sG�����fd�}d�}xt||�D]}|Vq4WdS(Nc3s�t�}zq�jj}x^�j����D]G}x>||����D]'}||krJ|V|j|�qJqJWq.WWd|j�XdS(N(R�RRR+taddtclear(tyieldedtsuccessor_selecttstarting_pointR�(RRRRRx(spathlib_mate/pathlib2.pyR=s		css	dSdV(N((R5((spathlib_mate/pathlib2.pyR>$s(R@(RxRRRRR=R>R?((RRRRRxspathlib_mate/pathlib2.pyRs	(RJRKRyR+R(((spathlib_mate/pathlib2.pyR	�s		t_PathParentscBs8eZdZd	Zd�Zd�Zd�Zd�ZRS(
svThis object provides sequence-like access to the logical ancestors
    of a path.  Don't try to construct it yourself.t_pathclst_drvt_roott_partscCs7t|�|_|j|_|j|_|j|_dS(N(RR3R4R5R6(RxRc((spathlib_mate/pathlib2.pyRy5scCs4|js|jr#t|j�dSt|j�SdS(Ni(R4R5R�R6(Rx((spathlib_mate/pathlib2.pyt__len__<scCsU|dks|t|�kr-t|��n|jj|j|j|j|d �S(Nii(R�t
IndexErrorR3t_from_parsed_partsR4R5R6(Rxtidx((spathlib_mate/pathlib2.pyt__getitem__BscCsdj|jj�S(Ns
<{0}.parents>(tformatR3RJ(Rx((spathlib_mate/pathlib2.pyt__repr__Hs(R3R4R5R6(RJRKR�t	__slots__RyR7R;R=(((spathlib_mate/pathlib2.pyR20s			cBseZdZd2Zd�Zd	�Zed
��Zeed��Z	eed��Z
ed
��Zd�Zd�Z
d�Zd�Zd�Zd�Zd�Zd�Zed��Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zeed�dd�Zeed�dd �Zed!��Z ed"��Z!ed#��Z"ed$��Z#ed%��Z$d&�Z%d'�Z&d(�Z'ed)��Z(d*�Z)d+�Z*d,�Z+e,j-r�e*Z.e+Z/ned-��Z0ed.��Z1d/�Z2d0�Z3d1�Z4RS(3sHPurePath 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.
    R4R5R6t_strt_hasht_ppartst_cached_cpartscGs7|tkr*tjdkr!tnt}n|j|�S(s�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(RR8R9RRt_from_parts(RR�((spathlib_mate/pathlib2.pyt__new__XscCs|jt|j�fS(N(t	__class__ttupleR6(Rx((spathlib_mate/pathlib2.pyt
__reduce__bscCsg}x�|D]�}t|t�r2||j7}q
tjdkrStj|�}nt|d�rq|j�}nt|t	�r�|j
t	|��q
tjr�t|tj
�r�|j
|jtj�p�d��q
tdt|���q
W|jj|�S(Niit
__fspath__R$sNargument should be a str object or an os.PathLike object returning str, not %r(ii(R(RR6R.R/R8tfspathRRHR�R�R%R&R)R*tgetfilesystemencodingt	TypeErrorRR#R�(RR�R+R�((spathlib_mate/pathlib2.pyt_parse_argsgs"
cCsYtj|�}|j|�\}}}||_||_||_|rU|j�n|S(N(tobjectRDRLR4R5R6t_init(RR�tinitRxR�R�R+((spathlib_mate/pathlib2.pyRC�s			
cCsAtj|�}||_||_||_|r=|j�n|S(N(RMRDR4R5R6RN(RR�R�R+RORx((spathlib_mate/pathlib2.pyR9�s			
cCs<|s|r(|||jj|d�S|jj|�SdS(Ni(R#Rw(RR�R�R+((spathlib_mate/pathlib2.pyt_format_parsed_parts�scCsdS(N((Rx((spathlib_mate/pathlib2.pyRN�scCs^|j|�\}}}|jj|j|j|j|||�\}}}|j|||�S(N(RLR#R�R4R5R6R9(RxR�R�R�R+((spathlib_mate/pathlib2.pyt_make_child�s	*cCsNy|jSWn<tk
rI|j|j|j|j�p<d|_|jSXdS(s[Return the string representation of the path, suitable for
        passing to system calls.R{N(R?tAttributeErrorRPR4R5R6(Rx((spathlib_mate/pathlib2.pyt__str__�s
cCs
t|�S(N(R�(Rx((spathlib_mate/pathlib2.pyRH�scCs"|j}t|�j|jd�S(sNReturn the string representation of the path with forward (/)
        slashes.R�(R#R�R~Rv(Rxtf((spathlib_mate/pathlib2.pyR��s	cCs1tjdkrtd��ntjt|��S(saReturn the bytes representation of the path.  This is only
        recommended to use under Unix.iisneeds Python 3.2 or later(ii(R.R/R�R8tfsencodeR�(Rx((spathlib_mate/pathlib2.pyt	__bytes__�scCsdj|jj|j��S(Ns
{0}({1!r})(R<RERJR�(Rx((spathlib_mate/pathlib2.pyR=�scCs+|j�std��n|jj|�S(s Return the path as a 'file' URI.s.relative path can't be expressed as a file URI(R�R
R#R�(Rx((spathlib_mate/pathlib2.pytas_uri�scCs?y|jSWn-tk
r:|jj|j�|_|jSXdS(N(RBRRR#R�R6(Rx((spathlib_mate/pathlib2.pyt_cparts�s

cCs5t|t�stS|j|jko4|j|jkS(N(R(RtNotImplementedRXR#(Rxtother((spathlib_mate/pathlib2.pyt__eq__�scCs||kS(N((RxRZ((spathlib_mate/pathlib2.pyt__ne__�scCs?y|jSWn-tk
r:tt|j��|_|jSXdS(N(R@RRthashRFRX(Rx((spathlib_mate/pathlib2.pyt__hash__�s

cCs6t|t�s"|j|jk	r&tS|j|jkS(N(R(RR#RYRX(RxRZ((spathlib_mate/pathlib2.pyt__lt__�scCs6t|t�s"|j|jk	r&tS|j|jkS(N(R(RR#RYRX(RxRZ((spathlib_mate/pathlib2.pyt__le__�scCs6t|t�s"|j|jk	r&tS|j|jkS(N(R(RR#RYRX(RxRZ((spathlib_mate/pathlib2.pyt__gt__�scCs6t|t�s"|j|jk	r&tS|j|jkS(N(R(RR#RYRX(RxRZ((spathlib_mate/pathlib2.pyt__ge__�stdocs.The drive prefix (letter or UNC path), if any.sThe root of the path, if any.cCs|j|j}|S(s/The concatenation of the drive and root, or ''.(R4R5(Rxtanchor((spathlib_mate/pathlib2.pyRdscCs?|j}t|�|js$|jr*dndkr7dS|dS(s!The final path component, if any.iiRzi����(R6R�R4R5(RxR+((spathlib_mate/pathlib2.pyR9s	*cCsN|j}|jd�}d|ko9t|�dknrF||SdSdS(s*The final component's last suffix, if any.R{iiRzN(R9trfindR�(RxR9R�((spathlib_mate/pathlib2.pytsuffixs
	&cCsS|j}|jd�rgS|jd�}g|jd�dD]}d|^q?S(s1A list of the final component's suffixes, if any.R{i(R9tendswithR�R�(RxR9Rf((spathlib_mate/pathlib2.pytsuffixes#s
	cCsN|j}|jd�}d|ko9t|�dknrF|| S|SdS(s0The final path component, minus its last suffix.R{iiN(R9ReR�(RxR9R�((spathlib_mate/pathlib2.pytstem,s
	&cCs�|jstd|f��n|jj|f�\}}}|s�|d|jj|jjgks�|s�|s�t|�dkr�td|��n|j|j|j	|j
d |g�S(s-Return a new path with the file name changed.s%r has an empty namei����isInvalid name %r(R9R
R#R�RvR|R�R9R4R5R6(RxR9R�R�R+((spathlib_mate/pathlib2.pyt	with_name6s	)cCs�|j}|j|ks0|jrC|j|krCtd|��n|rY|jd�se|dkrxtd|��n|j}|s�td|f��n|j}|s�||}n|t|� |}|j|j	|j
|jd |g�S(s�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.
        sInvalid suffix %rR{s%r has an empty namei����(R#RvR|R
R�R9RfR�R9R4R5R6(RxRfRTR9t
old_suffix((spathlib_mate/pathlib2.pytwith_suffixAs	'"		
c
Gs?|std��n|j}|j}|j}|rM||g|d}n|}|j|�\}}}|r�||g|d}	n|}	t|	�}
|jj}|
dkr�|p�|n|||
 �||	�kr|j|||�}t	dj
t|�t|����n|jd|
dkr1|nd||
�S(s�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.
        sneed at least one argumentiis{0!r} does not start with {1!r}Rz(
RKR6R4R5RLR�R#R�RPR
R<R�R9(
RxRZR+R�R�t	abs_partstto_drvtto_roottto_partstto_abs_partstnR&t	formatted((spathlib_mate/pathlib2.pytrelative_toWs(				4	cCs9y|jSWn'tk
r4t|j�|_|jSXdS(sZAn object providing sequence-like access to the
        components in the filesystem path.N(RARRRFR6(Rx((spathlib_mate/pathlib2.pyR+ws

cGs
|j|�S(s�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).
        (RQ(RxR�((spathlib_mate/pathlib2.pytjoinpath�scCs|j|f�S(N(RQ(Rxtkey((spathlib_mate/pathlib2.pyt__truediv__�scCs|j|g|j�S(N(RCR6(RxRv((spathlib_mate/pathlib2.pyt__rtruediv__�scCsT|j}|j}|j}t|�dkr=|s9|r=|S|j|||d �S(s3The logical parent of the path.

        :
        ii����(R4R5R6R�R9(RxR�R�R+((spathlib_mate/pathlib2.pytparent�s			cCs
t|�S(s*A sequence of this path's logical parents.(R2(Rx((spathlib_mate/pathlib2.pytparents�scCs'|js
tS|jjp&t|j�S(sSTrue if the path is absolute (has both a root and, if applicable,
        a drive).(R5R�R#R�tboolR4(Rx((spathlib_mate/pathlib2.pyR��s	cCs|jj|j�S(saReturn True if the path contains one of the special names reserved
        by the system, if any.(R#R�R6(Rx((spathlib_mate/pathlib2.pyR��sc	Cs)|jj}||�}|jj|f�\}}}|sKtd��n|rj|||j�krjtS|r�|||j�kr�tS|j}|s�|r�t|�t|�kr�tS|d}nt|�t|�kr�tSx?t	t
|�t
|��D]"\}}tj||�s�tSq�Wt
S(sE
        Return True if this path matches the given pattern.
        s
empty patterni(R#R�R�R
R4R�R5RXR�tzipR}R!tfnmatchcaseR�(	Rxtpath_patternR&R�R�t	pat_partsR+R,Rs((spathlib_mate/pathlib2.pyR%�s(	
((R4R5R6R?R@RARB(5RJRKR�R>RDRGtclassmethodRLR�RCR9RPRNRQRSRHR�RVR=RWtpropertyRXR[R\R^R_R`RaRbRR�R�RdR9RfRhRiRjRlRtR+RuRwRxR%R&t__div__t__rdiv__RyRzR�R�R%(((spathlib_mate/pathlib2.pyRLsf	
	!				
															
	
			 					
		cBseZeZdZRS(((RJRKt_posix_flavourR#R>(((spathlib_mate/pathlib2.pyR�scBseZdZeZdZRS(s�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.
    ((RJRKR�t_windows_flavourR#R>(((spathlib_mate/pathlib2.pyR�si(tAttrAccessor(t
HashesMethods(tPathFilters(t
MutateMethods(tToolBoxcBseZdZd6Zd�Zd7d�Zd�Zd�Zd�Z	d�Z
d	d
�Zdd�Ze
d
��Ze
d��Zd�Zd�Zd�Zd�Zd�Zed�Zd�Zd�Zd�Zddd7d7d7d�Zd�Zd7d7d�Zd�Zdd7d�Zed �Zded!�Z d	e!d"�Z"deed#�Z#d$�Z$d%�Z%d&�Z&d'�Z'd(�Z(d)�Z)d*�Z*ed+�Z+d,�Z,d-�Z-d.�Z.d/�Z/d0�Z0d1�Z1d2�Z2d3�Z3d4�Z4d5�Z5RS(8s�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�t_closedcOsr|tkr*tjdkr!tnt}n|j|dt�}|jjsdt	d|j
f��n|j�|S(s
        :rtype: Path 
        RROs$cannot instantiate %r on your system(RR8R9RRRCR�R#R�R�RJRN(RR�tkwargsRx((spathlib_mate/pathlib2.pyRD�s
cCs1t|_|dk	r$|j|_n	t|_dS(N(R�R�RR�t_normal_accessor(Rxttemplate((spathlib_mate/pathlib2.pyRNs	cCs)|j|g}|j|j|j|�S(N(R6R9R4R5(RxR,R+((spathlib_mate/pathlib2.pyRscCs|jr|j�n|S(N(R�t
_raise_closed(Rx((spathlib_mate/pathlib2.pyt	__enter__s	
cCs
t|_dS(N(R�R�(Rxtttvttb((spathlib_mate/pathlib2.pyt__exit__scCstd��dS(NsI/O operation on closed path(R
(Rx((spathlib_mate/pathlib2.pyR�si�cCs|jj|||�S(N(R�R�(RxR9RkR�((spathlib_mate/pathlib2.pyt_opener"si�cCs,|jr|j�n|jj|||�S(sm
        Open the file pointed by this path and return a file descriptor,
        as os.open() does.
        (R�R�R�R�(RxRkR�((spathlib_mate/pathlib2.pyt	_raw_open&s	
cCs|tj��S(s�Return a new path pointing to the current working directory
        (as returned by os.getcwd()).

        :rtype: Path
        (R8R�(R((spathlib_mate/pathlib2.pytcwd1scCs||�jjd��S(s�Return a new path pointing to the user's home directory (as
        returned by os.path.expanduser('~')).

        :rtype: Path
        N(R#R�R(R((spathlib_mate/pathlib2.pythome:scCs�ttjd�rd|j�}y|j�}Wn tk
rPtj|�}nXtjj||�Stj|�}tj|�}t|�}t|�}||kSdS(s�Return whether other_path is the same or not as this file
        (as returned by os.path.samefile()).

        :rtype: Path
        tsamestatN(	RR8RcR�RRR�R%R)Ro(Rxt
other_pathtsttother_stt	filename1t	filename2tst1tst2((spathlib_mate/pathlib2.pytsamefileCs
ccsm|jr|j�nxP|jj|�D]<}|dkrAq)n|j|�V|jr)|j�q)q)WdS(s�Iterate over the files in this directory.  Does not yield any
        result for the special paths '.' and '..'.

        :rtype: typing.Iterable[Path]
        R{s..N(R{s..(R�R�R�R�R(RxR9((spathlib_mate/pathlib2.pytiterdirWs	
	ccs�|stdj|���n|jj|�}|jj|f�\}}}|sZ|ritd��ntt|��}x|j|�D]}|Vq�WdS(s�Iterate over this subtree and yield all existing files (of any
        kind, including directories) matching the given relative pattern.

        :rtype: typing.Iterable[Path]
        sUnacceptable pattern: {0!r}s%Non-relative patterns are unsupportedN(	R
R<R#R�R�R�RRFR(RxtpatternR�R�R
tselectorR�((spathlib_mate/pathlib2.pytglobgsccs�|jj|�}|jj|f�\}}}|s<|rKtd��ntdt|��}x|j|�D]}|VqqWdS(s�Recursively yield all existing files (of any kind, including
        directories) matching the given relative pattern, anywhere in
        this subtree.

        :rtype: typing.Iterable[Path]
        s%Non-relative patterns are unsupporteds**N(s**(R#R�R�R�RRFR(RxR�R�R�R
R�R�((spathlib_mate/pathlib2.pytrglobwscCs_|jr|j�n|j�r&|S|jtj�g|jdt�}|jd|�|S(sReturn 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.

        :rtype: Path
        ROR�(	R�R�R�RCR8R�R6R�RN(Rxtobj((spathlib_mate/pathlib2.pytabsolute�s
	
%cs��jr�j�n�jj�d|�}|dkrt�fd�}d�}t||�t�j��}nt|�}�jjj	|�}�j
|fdt�}|jd��|S(s�
        Make the path absolute, resolving all symlinks on the way and also
        normalizing it (for example turning slashes into backslashes under
        Windows).
        R�cs�j�dS(N(R�((Rx(spathlib_mate/pathlib2.pyR��scSsdS(N((R5((spathlib_mate/pathlib2.pyR��sROR�N(
R�R�R#R�RR;R�R�R�tnormpathRCR�RN(RxR�R�R�R�tnormedR�((Rxspathlib_mate/pathlib2.pyR��s	
	
cCs|jj|�S(sh
        Return the result of the stat() system call on this path, like
        os.stat() does.
        (R�R�(Rx((spathlib_mate/pathlib2.pyR��scCs%ddl}|j|j�j�jS(s:
        Return the login name of the file owner.
        i����N(R�R�R�tst_uidtpw_name(RxR�((spathlib_mate/pathlib2.pytowner�scCs%ddl}|j|j�j�jS(s8
        Return the group name of the file gid.
        i����N(tgrptgetgrgidR�tst_gidtgr_name(RxR�((spathlib_mate/pathlib2.pytgroup�stri����c	Csv|jr|j�ntjdkrPtjt|�|||||d|j�Stjt|�|||||�SdS(s|
        Open the file pointed by this path and return a file object, as
        the built-in open() function does.
        itopenerN(ii(R�R�R.R/tioR�R�R�(RxR�t	bufferingtencodingterrorstnewline((spathlib_mate/pathlib2.pyR��s	

cCs)|jdd��}|j�SWdQXdS(sK
        Open the file in bytes mode, read it, and close the file.
        R�trbN(R�tread(RxRT((spathlib_mate/pathlib2.pyt
read_bytes�scCs5|jddd|d|��}|j�SWdQXdS(sJ
        Open the file in text mode, read it, and close the file.
        R�R�R�R�N(R�R�(RxR�R�RT((spathlib_mate/pathlib2.pyt	read_text�s!cCsct|tj�s7tdtjj|jjf��n|jdd��}|j|�SWdQXdS(sj
        Open the file in bytes mode, write to it, and close the file.

        :type data: bytes
        sdata must be %s, not %sR�twbN(R(R%tbinary_typeRKRJRER�twrite(RxtdataRT((spathlib_mate/pathlib2.pytwrite_bytes�ssutf-8cCsot|tj�s7tdtjj|jjf��n|jddd|d|��}|j|�SWdQXdS(s�
        Open the file in text mode, write to it, and close the file.

        :type data: str
        :type encoding: str, recommend to use "utf-8"
        sdata must be %s, not %sR�twR�R�N(R(R%R)RKRJRER�R�(RxR�R�R�RT((spathlib_mate/pathlib2.pyt
write_text�s!cCs5t|jddd|��}|j|�WdQXdS(s�
        An atomic write action for binary data.
        Either fully done or nothing happen.
        Preventing overwriting existing file with incomplete data.

        :type data: bytes
        :type overwrite: bool
        R�R�t	overwriteN(RtabspathR�(RxR�R�RT((spathlib_mate/pathlib2.pytatomic_write_bytess	cCs>t|jddd|��}|j|j|��WdQXdS(s
        An atomic write action for text. Either fully done or nothing happen.
        Preventing overwriting existing file with incomplete data.

        :type data: str
        :type encoding: str, recommend to use "utf-8"
        :type overwrite: bool
        :return:
        R�R�R�N(RR�R�R*(RxR�R�R�RT((spathlib_mate/pathlib2.pytatomic_write_texts
cCs�|jr|j�n|rNy|jj|d�Wntk
rFqNXdSntjtjB}|st|tj	O}n|j
||�}tj|�dS(sS
        Create this file with the given access mode, if it doesn't exist.
        N(R�R�R�RRReR8tO_CREATtO_WRONLYtO_EXCLR�tclose(RxR�texist_okRktfd((spathlib_mate/pathlib2.pyttouch s	

cs��jr�j�n��fd�}����fd�}yt||�Wn+tk
r~�su�j�r�qnXdS(s<
        Create a new directory at this given path.
        cs�jj���dS(N(R�R((R�Rx(spathlib_mate/pathlib2.pyR�>scsU�s�j�kr|�n�jjdtdt��j�dtd��dS(NRzR�(RyRR�R�(R5(R�R�RzRx(spathlib_mate/pathlib2.pyR�As	N(R�R�R;ReR(RxR�RzR�R�R�((R�R�RzRxspathlib_mate/pathlib2.pyR7s	

cCs-|jr|j�n|jj||�dS(sF
        Change the permissions of the path, like os.chmod().
        N(R�R�R�R(RxR�((spathlib_mate/pathlib2.pyROs	
cCs-|jr|j�n|jj||�dS(s�
        Like chmod(), except if the path points to a symlink, the symlink's
        permissions are changed, rather than its target's.
        N(R�R�R�R�(RxR�((spathlib_mate/pathlib2.pyR�Ws	
cCs*|jr|j�n|jj|�dS(sd
        Remove this file or link.
        If the path is a directory, use rmdir() instead.
        N(R�R�R�R(Rx((spathlib_mate/pathlib2.pyR`s	
cCs*|jr|j�n|jj|�dS(sF
        Remove this directory.  The directory must be empty.
        N(R�R�R�R(Rx((spathlib_mate/pathlib2.pyRis	
cCs&|jr|j�n|jj|�S(s�
        Like stat(), except if the path points to a symlink, the symlink's
        status information is returned, rather than its target's.
        (R�R�R�R�(Rx((spathlib_mate/pathlib2.pyR�qs	
cCs-|jr|j�n|jj||�dS(s5
        Rename this path to the given path.
        N(R�R�R�R(RxR�((spathlib_mate/pathlib2.pyRzs	
cCsKtjdkrtd��n|jr4|j�n|jj||�dS(so
        Rename this path to the given path, clobbering the existing
        destination if it exists.
        is5replace() is only available with Python 3.3 and laterN(ii(R.R/R�R�R�R�R~(RxR�((spathlib_mate/pathlib2.pyR~�s
	
cCs0|jr|j�n|jj|||�dS(s�
        Make this path a symlink pointing to the given path.
        Note the order of arguments (self, target) is the reverse of
        os.symlink's.
        N(R�R�R�R�(RxR�R�((spathlib_mate/pathlib2.pyt
symlink_to�s	
cCsLy|j�Wn7tk
r6}t|�s2�ntStk
rGtSXtS(s+
        Whether this path exists.
        (R�ReR#R�R
R�(RxR�((spathlib_mate/pathlib2.pyR�s
cCsUyt|j�j�SWn7tk
r?}t|�s;�ntStk
rPtSXdS(s3
        Whether this path is a directory.
        N(RR�tst_modeReR#R�R
(RxR�((spathlib_mate/pathlib2.pyR�s
cCsUyt|j�j�SWn7tk
r?}t|�s;�ntStk
rPtSXdS(sq
        Whether this path is a regular file (also True for symlinks pointing
        to regular files).
        N(R
R�R�ReR#R�R
(RxR�((spathlib_mate/pathlib2.pytis_file�s
cCs�|j�s|j�rtSt|j�}y|j�j}Wntk
rTtSX|j�j}||krttS|j�j	}|j�j	}||kS(s;
        Check if this path is a POSIX mount point
        (
RRR�RRyR�tst_devReR�tst_ino(RxRyt
parent_devtdevtinot
parent_ino((spathlib_mate/pathlib2.pytis_mount�s
cCsUyt|j�j�SWn7tk
r?}t|�s;�ntStk
rPtSXdS(s7
        Whether this path is a symbolic link.
        N(R	R�R�ReR#R�R
(RxR�((spathlib_mate/pathlib2.pyR*�s
cCsUyt|j�j�SWn7tk
r?}t|�s;�ntStk
rPtSXdS(s6
        Whether this path is a block device.
        N(RR�R�ReR#R�R
(RxR�((spathlib_mate/pathlib2.pytis_block_device�s
cCsUyt|j�j�SWn7tk
r?}t|�s;�ntStk
rPtSXdS(s:
        Whether this path is a character device.
        N(R
R�R�ReR#R�R
(RxR�((spathlib_mate/pathlib2.pytis_char_device�s
cCsUyt|j�j�SWn7tk
r?}t|�s;�ntStk
rPtSXdS(s.
        Whether this path is a FIFO.
        N(RR�R�ReR#R�R
(RxR�((spathlib_mate/pathlib2.pytis_fifos
cCsUyt|j�j�SWn7tk
r?}t|�s;�ntStk
rPtSXdS(s0
        Whether this path is a socket.
        N(RR�R�ReR#R�R
(RxR�((spathlib_mate/pathlib2.pyt	is_sockets
cCso|jp|jrk|jrk|jdd dkrk|jj|jdd�}|j|g|jd�S|S(sl Return a new path with expanded ~ and ~user constructs
        (as returned by os.path.expanduser)
        iit~(R4R5R6R#R�RC(Rxthomedir((spathlib_mate/pathlib2.pyt
expanduser.s
 (R�R�N(6RJRKR�R>RDRRNRR�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�RRR�RRR�RR~R�RRR�R�R*R�R�R�R�R�(((spathlib_mate/pathlib2.pyR�sd																			

																			cBseZdZdZRS(ssPath subclass for non-Windows systems.

    On a POSIX system, instantiating a Path should return this object.
    ((RJRKR�R>(((spathlib_mate/pathlib2.pyR:scBs/eZdZdZd�Zd�Zd�ZRS(sqPath subclass for Windows systems.

    On a Windows system, instantiating a Path should return this object.
    cCstd��dS(Ns*Path.owner() is unsupported on this system(R�(Rx((spathlib_mate/pathlib2.pyR�IscCstd��dS(Ns*Path.group() is unsupported on this system(R�(Rx((spathlib_mate/pathlib2.pyR�LscCstd��dS(Ns-Path.is_mount() is unsupported on this system(R�(Rx((spathlib_mate/pathlib2.pyR�Os((RJRKR�R>R�R�R�(((spathlib_mate/pathlib2.pyRBs
		(cttypingRXR!R�R�R�R8R�RR.RRRRRRRRtoperatorRR�RR	R
RRR
RR%tcollections.abcRtImportErrortcollectionsturllibRR�turllib.parseRR�t	NameErrorR�RR9RtgetwindowsversionR/RR�RRRtatomicwritesRt__all__R R!R#R-R6R;R@RoRtRMRuR�R�R�R�R�R�R�RRRRRRRR	R2RtPathLiketregisterRRtmate_attr_accessorR�tmate_hashes_methodsR�tmate_path_filtersR�tmate_mutate_methodsR�t
mate_tool_boxR�RRR(((spathlib_mate/pathlib2.pyt<module>s�"4




1	
					 		>	A�g		A		8����P