a XC?h@s2ddlZddlZddlZddlZddlZddlZddlZddlZddlm Z ddl m Z m Z m Z mZmZddlmZddlmZmZmZmZmZmZmZddlmZdZgdZd Zd Z d Z!e e eefZ"ee e!fZ#d d Z$ddZ%Gddde&Z'Gddde'Z(Gddde'Z)e(Z*e)Z+GdddZ,Gddde,Z-e-Z.ddZ/e0edrbe1e/Z/GdddZ2Gdd d Z3Gd!d"d"e2Z4Gd#d$d$e2Z5Gd%d&d&e2Z6Gd'd(d(e Z7Gd)d*d*e&Z8ej9:e8Gd+d,d,e8Z;Gd-d.d.e8ZGd3d4d4e=e<Z?dS)5N)Sequence)EINVALENOENTENOTDIREBADFELOOP) attrgetter)S_ISDIRS_ISLNKS_ISREGS_ISSOCKS_ISBLKS_ISCHRS_ISFIFO)quote_from_bytesT)PurePath PurePosixPathPureWindowsPathPath PosixPath WindowsPath{icCs t|ddtvpt|ddtvS)Nerrnowinerror)getattr_IGNORED_ERROS_IGNORED_WINERRORS)Z exceptionr,/opt/alt/python39/lib64/python3.9/pathlib.py _ignore_error(sr cCsd|vpd|vpd|vS)N*?[r)patrrr_is_wildcard_pattern-sr%c@s(eZdZdZddZddZddZdS) _FlavourzPA flavour implements a particular (platform-specific) set of path semantics.cCs|jj|_dSN)sepjoinselfrrr__init__7sz_Flavour.__init__c Csg}|j}|j}d}}t|}|D]}|s.q$|r>|||}||\}}} || vrt| |D] } | rd| dkrd|t| qdn| r| dkr|t| |s|r$|s|D]0}|sq|r|||}||d}|rqqqq$|s|r|||| |||fS)N.r) r(altsepreversedreplace splitrootsplitappendsysinternreverse) r+partsZparsedr(r/drvrootitpartZrelxrrr parse_parts:s@     z_Flavour.parse_partscCsz|r*|sp|rp||||g|ddfSnF|rb||ksJ||||krp||||ddfSn||||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+r9r:r8Zdrv2Zroot2Zparts2rrrjoin_parsed_parts`sz_Flavour.join_parsed_partsN)__name__ __module__ __qualname____doc__r,r>rArrrrr&3s&r&c@seZdZdZdZdZeZej dkZ e dZ dZ hddd d DBd d d DBZefd d ZddZddZddZe fddZddZddZddZdS)_WindowsFlavour\/TntZ4abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZz\\?\>ZPRNZCONZAUXzCONOUT$ZNULzCONIN$cCsh|] }d|qS)zCOM%sr.0crrr z_WindowsFlavour.u123456789¹²³cCsh|] }d|qS)zLPT%srrJrrrrMrNc Cs\|dd}|dd}||krP||krP||\}}|dd}|dd}nd}|dd}||kr||kr||kr||d}|dkr|||d}||dkr|dkrt|}|r||d||||ddfS|d||||ddfSd} } |dkr6||jvr6|dd} |dd}|}||krN|} ||}|| | |fS)Nrr?r-:)_split_extended_pathfindlen drive_letterslstrip) r+r<r(firstsecondprefixZthirdindexZindex2r9r:rrrr2s6      "    z_WindowsFlavour.splitrootcCs|Sr'lowerr+srrrr@sz_WindowsFlavour.casefoldcCsdd|DS)NcSsg|] }|qSrr\)rKprrr rNz2_WindowsFlavour.casefold_parts..rr+r8rrrcasefold_partssz_WindowsFlavour.casefold_partscCstt|tjjSr')recompilefnmatch translate IGNORECASE fullmatchr+patternrrrcompile_patternsz_WindowsFlavour.compile_patterncCsXd}||rP|dd}|dd}|drP||dd7}d|dd}||fS)Nr-zUNC\rPrG) startswith)r+r_Z ext_prefixrZrrrrSs    z$_WindowsFlavour._split_extended_pathcCsJ|sdS|ddrdS|dddddd}||jvS)NFrz\\rQr.rR )rn partitionrstripupperreserved_names)r+r8namerrr is_reserveds "z_WindowsFlavour.is_reservedcCsd|j}t|dkrJ|ddkrJ|ddd}d|t|dfSdt|dSdS)NrOr?rRrHz file:///%s/%szutf-8zfile:)driverUas_posixrWurlquote_from_bytesencode)r+pathrvrestrrrmake_urisz_WindowsFlavour.make_uricCsdtjvrtjd}nHdtjvrVztjd}WntyDd}Yn0|tjd}ntd|rtjd|kr||f\}}}|dtjdkrtd|||d<|s|r||||d d}n ||}|S) NZ USERPROFILEZHOMEPATHZ HOMEDRIVEr-zCan't determine home directoryZUSERNAMErQ%Can't determine home directory for %rr?)osenvironKeyError RuntimeErrorr>r))r+usernameuserhomer9r:r8rrr gethomedirs*      z_WindowsFlavour.gethomedirN)rBrCrDr(r/has_drvntpathpathmodr~rt is_supportedsetrVZext_namespace_prefixrsr2r@rcrlrSrur|rrrrrrFrs*    '   rFc@sbeZdZdZdZdZeZej dkZ efddZ ddZ d d Z d d Zd dZddZddZdS) _PosixFlavourrHr-FrIcCsV|rH|d|krH||}t|t|dkrz tjdWSty:ddl}|tjYS0n6ddl}z||jWStyrtd|Yn0dS)NHOMErr}) r~rrpwdgetpwuidgetuidpw_dirgetpwnamr)r+rrrrrr.s   z_PosixFlavour.gethomedirN)rBrCrDr(r/r posixpathrr~rtrr2r@rcrlrur|rrrrrrs  rc@seZdZdZdS) _AccessorzjAn accessor implements a particular (system-specific or not) way of accessing paths on the filesystem.N)rBrCrDrErrrrrBsrc@seZdZejZejZejZejZejZej Z e edr>ej Z nddZ ej Z ej Z e edrdejZn eddZejZejZejZe edrejZn dd d ZejZd d Zd dZddZejZeejjZeejjZdS)_NormalAccessorlchmodcCs tddS)Nz%lchmod() not available on this systemNotImplementedError)r+ZpathobjmoderrrrXsz_NormalAccessor.lchmodlinkcCs tddS)Nz&os.link() not available on this systemrr+targetrrrlink_tobsz_NormalAccessor.link_tosymlinkFcCs tddS)Nz)os.symlink() not available on this systemr)r+srcZdsttarget_is_directoryrrrrosz_NormalAccessor.symlinkcCs t|Sr')r~readlinkr+rzrrrrusz_NormalAccessor.readlinkcCs>zddl}|||jjWSty8tdYn0dS)Nrz*Path.owner() is unsupported on this system)rrstatst_uidZpw_name ImportErrorr)r+rzrrrrownerxs  z_NormalAccessor.ownercCs>zddl}|||jjWSty8tdYn0dS)Nrz*Path.group() is unsupported on this system)grpZgetgrgidrst_gidZgr_namerr)r+rzrrrrgroups  z_NormalAccessor.groupN)F)rBrCrDr~rlstatopenlistdirscandirchmodhasattrrmkdirunlinkrr staticmethodrmdirrenamer1rutimerrrgetcwdrz expanduserrealpathrrrrrGs8      rcCsR|d}|dd}|dkr"t}n$d|vr4tdnt|rBt}nt}||||S)Nrr?**z:Invalid pattern: '**' can only be an entire path component)_RecursiveWildcardSelector ValueErrorr%_WildcardSelector_PreciseSelector) pattern_partsflavourr$ child_partsclsrrr_make_selectors  r lru_cachec@s eZdZdZddZddZdS) _SelectorzYA selector matches a specific glob pattern part against the children of a given path.cCs0||_|rt|||_d|_nt|_d|_dS)NTF)rr successordironly_TerminatingSelector)r+rrrrrr,s  z_Selector.__init__cCs<t|}|j}|j}|jj}||s,tgS|||||S)zuIterate over all child paths of `parent_path` matched by this selector. This can contain parent_path itself.)typeis_direxists _accessorriter _select_from)r+ parent_pathZpath_clsrrrrrr select_fromsz_Selector.select_fromN)rBrCrDrEr,rrrrrrs rc@seZdZddZdS)rccs |VdSr'r)r+rrrrrrrrsz!_TerminatingSelector._select_fromN)rBrCrDrrrrrrsrc@seZdZddZddZdS)rcCs||_t|||dSr')rtrr,)r+rtrrrrrr,sz_PreciseSelector.__init__ccsZz@||j}|jr|n||r>|j||||D] }|Vq2WntyTYdS0dSr')_make_child_relpathrtrrrPermissionError)r+rrrrrzr`rrrrs   z_PreciseSelector._select_fromNrBrCrDr,rrrrrrsrc@seZdZddZddZdS)rcCs|||_t|||dSr')rlmatchrr,r+r$rrrrrr,s z_WildcardSelector.__init__c csz||}t|}Wdn1s(0Y|D]}|jrz|sNWq6Wn:ty}z"t|sjWYd}~q6WYd}~n d}~00|j} || r6|| } |j | |||D] } | Vqq6Wnt yYdS0dSr') listrrOSErrorr rtrrrrr) r+rrrr scandir_itentriesentryertrzr`rrrrs& &"   z_WildcardSelector._select_fromNrrrrrrsrc@s$eZdZddZddZddZdS)rcCst|||dSr')rr,rrrrr,sz#_RecursiveWildcardSelector.__init__c cs|Vz||}t|}Wdn1s.0Y|D]v}d}z |}Wn.ty~}zt|sjWYd}~n d}~00|r<|s<||j} || ||D] } | Vqq)formatrrBr*rrr__repr__7sz_PathParents.__repr__N) rBrCrDrE __slots__r,rrrrrrrrs rc@seZdZdZdZddZddZeddZed\d d Z ed]d d Z eddZ ddZ ddZ ddZddZddZddZddZddZed d!Zd"d#Zd$d%Zd&d'Zd(d)Zd*d+Zd,d-Zd.d/Zeed0d1d2Zeed3d4d2Zed5d6Z ed7d8Z!ed9d:Z"ed;d<Z#ed=d>Z$d?d@Z%dAdBZ&dCdDZ'dEdFZ(dGdHZ)edIdJZ*dKdLZ+dMdNZ,dOdPZ-edQdRZ.edSdTZ/dUdVZ0dWdXZ1dYdZZ2d[S)^ra|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. )rrr_str_hash_pparts_cached_cpartscGs$|turtjdkrtnt}||S)zConstruct 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. rI)rr~rtrr _from_parts)rargsrrr__new__IszPurePath.__new__cCs|jt|jfSr') __class__tuplerr*rrr __reduce__SszPurePath.__reduce__cCsdg}|D]N}t|tr"||j7}qt|}t|trF|t|qtdt|q|j |S)NzNargument should be a str object or an os.PathLike object returning str, not %r) isinstancerrr~fspathstrr4 TypeErrorr_flavourr>)rrr8arrr _parse_argsXs    zPurePath._parse_argsTcCs<t|}||\}}}||_||_||_|r8||Sr')objectrrrrr_init)rrinitr+r9r:r8rrrrls zPurePath._from_partscCs,t|}||_||_||_|r(||Sr')rrrrrr)rr9r:r8rr+rrrrys zPurePath._from_parsed_partscCs4|s|r$|||j|ddS|j|SdSr)rr))rr9r:r8rrr_format_parsed_partsszPurePath._format_parsed_partscCsdSr'rr*rrrrszPurePath._initcCs@||\}}}|j|j|j|j|||\}}}||||Sr')rrrArrrr)r+rr9r:r8rrr _make_childs  zPurePath._make_childcCs@z|jWSty:||j|j|jp,d|_|jYS0dS)z[Return the string representation of the path, suitable for passing to system calls.r.N)rAttributeErrorrrrrr*rrr__str__s  zPurePath.__str__cCst|Sr')rr*rrr __fspath__szPurePath.__fspath__cCs|j}t||jdS)zNReturn the string representation of the path with forward (/) slashes.rH)rrr1r(r+frrrrwszPurePath.as_posixcCs t|S)zaReturn the bytes representation of the path. This is only recommended to use under Unix.)r~fsencoder*rrr __bytes__szPurePath.__bytes__cCsd|jj|S)Nz{}({!r}))rrrBrwr*rrrrszPurePath.__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_absoluterrr|r*rrras_uriszPurePath.as_uricCs6z|jWSty0|j|j|_|jYS0dSr')rrrrcrr*rrr_cpartss  zPurePath._cpartscCs&t|tstS|j|jko$|j|juSr')rrNotImplementedr rr+otherrrr__eq__s zPurePath.__eq__cCs6z|jWSty0tt|j|_|jYS0dSr')rrhashrr r*rrr__hash__s  zPurePath.__hash__cCs&t|tr|j|jurtS|j|jkSr'rrrr r rrrr__lt__szPurePath.__lt__cCs&t|tr|j|jurtS|j|jkSr'rrrrr__le__szPurePath.__le__cCs&t|tr|j|jurtS|j|jkSr'rrrrr__gt__szPurePath.__gt__cCs&t|tr|j|jurtS|j|jkSr'rrrrr__ge__szPurePath.__ge__cCs|Sr'r)rrrrr__class_getitem__szPurePath.__class_getitem__rz.The drive prefix (letter or UNC path), if any.)docrzThe root of the path, if any.cCs|j|j}|S)z/The concatenation of the drive and root, or ''.)rr)r+anchorrrrrs zPurePath.anchorcCs.|j}t||js|jrdndkr&dS|dS)z!The final path component, if any.r?rr-rQ)rrUrrrbrrrrtsz PurePath.namecCsD|j}|d}d|kr,t|dkr.r?N)rtendswithrWr3r+rtrrrsuffixess   zPurePath.suffixescCsD|j}|d}d|kr,t|dkrr(r/rUrrrr)r+rtr9r:r8rrr with_names   zPurePath.with_namecCs|||jS)z(Return a new path with the stem changed.)r%r)r+r#rrr with_stem%szPurePath.with_stemcCs|j}|j|vs |jr.|j|vr.td|f|r<|drD|dkrPtd||j}|shtd|f|j}|s|||}n|dt| |}||j |j |j dd|gS)zReturn 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.r$NrQ) rr(r/rrnrtrrUrrrr)r+rrrtZ old_suffixrrr with_suffix)s   zPurePath.with_suffixc Gs|s td|j}|j}|j}|r8||g|dd}n|}||\}}}|rf||g|dd} n|} t| } |jj} | dkr|s|rn| |d| | | kr||||} t d t |t | | d| dkr|nd|| dS)zReturn 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-) rrrrrrUrrcrrrrr) r+rr8r9r:Z abs_partsZto_drvZto_rootZto_partsZ to_abs_partsncfZ formattedrrr relative_to>s, *  zPurePath.relative_tocGs*z|j|WdSty$YdS0dS)zFReturn True if the path is relative to another path or False. TFN)r*rrrrris_relative_to_s   zPurePath.is_relative_tocCs2z|jWSty,t|j|_|jYS0dS)zZAn object providing sequence-like access to the components in the filesystem path.N)rrrrr*rrrr8hs   zPurePath.partscGs ||S)zCombine 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+rrrrjoinpathtszPurePath.joinpathcCs*z||fWSty$tYS0dSr')rrr r+keyrrr __truediv__|s zPurePath.__truediv__cCs0z||g|jWSty*tYS0dSr')rrrr r-rrr __rtruediv__s zPurePath.__rtruediv__cCs@|j}|j}|j}t|dkr*|s&|r*|S||||ddS)zThe logical parent of the path.r?NrQ)rrrrUr)r+r9r:r8rrrparents zPurePath.parentcCst|S)z*A sequence of this path's logical parents.)rr*rrrparentsszPurePath.parentscCs|js dS|jj pt|jS)zSTrue if the path is absolute (has both a root and, if applicable, a drive).F)rrrboolrr*rrrr szPurePath.is_absolutecCs|j|jS)zaReturn True if the path contains one of the special names reserved by the system, if any.)rrurr*rrrruszPurePath.is_reservedc Cs|jj}||}|j|f\}}}|s0td|rF|||jkrFdS|r\|||jkr\dS|j}|sj|rt|t|kr~dS|dd}nt|t|krdStt |t |D]\}}t ||sdSqdS)zE Return True if this path matches the given pattern. z empty patternFr?NT) rr@r>rrrr rUzipr0rfZ fnmatchcase) r+Z path_patternr)r9r:Z pat_partsr8r<r$rrrrs( zPurePath.matchN)T)T)3rBrCrDrErrr classmethodrrrrrrrrrwr rr propertyr rrrrrrrrrvr:rrtrr"r#r%r&r'r*r+r8r,r/r0r1r2r rurrrrrr;s|             !    rc@seZdZdZeZdZdS)rzPurePath 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)rBrCrDrE_posix_flavourrrrrrrrsrc@seZdZdZeZdZdS)rzPurePath 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)rBrCrDrE_windows_flavourrrrrrrrsrc@seZdZdZdZddZddddZdd Zd d Zd d Z deddZ dfddZ e ddZ e ddZddZddZddZddZd d!Zdgd#d$Zd%d&Zd'd(Zd)d*Zdhd-d.Zd/d0Zdid1d2Zd3d4Zdjd5d6Zd7d8Zdkd:d;Zdldd?Z d@dAZ!dmdBdCZ"dDdEZ#dFdGZ$dHdIZ%dJdKZ&dndLdMZ'dNdOZ(dPdQZ)dRdSZ*dTdUZ+dVdWZ,dXdYZ-dZd[Z.d\d]Z/d^d_Z0d`daZ1dbdcZ2dS)oraPurePath 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. )rcOsL|turtjdkrtnt}|j|dd}|jjs@td|j f| |S)NrIFrz$cannot instantiate %r on your system) rr~rtrrrrrrrBr)rrkwargsr+rrrrsz Path.__new__NcCs|dur|j|_nt|_dSr')r_normal_accessor)r+templaterrrrs z Path._initcCs|j|g}||j|j|Sr')rrrr)r+r<r8rrrrs zPath._make_child_relpathcCs|Sr'rr*rrr __enter__szPath.__enter__cCsdSr'r)r+tvtbrrr__exit__s z Path.__exit__cCs|j|||Sr'rr)r+rtflagsrrrr_opener sz Path._openercCs|j|||S)zm Open the file pointed by this path and return a file descriptor, as os.open() does. rC)r+rDrrrr _raw_openszPath._raw_opencCs |tS)zjReturn a new path pointing to the current working directory (as returned by os.getcwd()). )r~rrrrrcwdszPath.cwdcCs||jdS)zrReturn a new path pointing to the user's home directory (as returned by os.path.expanduser('~')). N)rrrHrrrhome sz Path.homecCsB|}z |}Wnty2|j|}Yn0tj||S)zoReturn whether other_path is the same or not as this file (as returned by os.path.samefile()). )rrrr~rzsamestat)r+Z other_pathstZother_strrrsamefile's   z Path.samefileccs,|j|D]}|dvrq ||Vq dS)zyIterate over the files in this directory. Does not yield any result for the special paths '.' and '..'. >r.z..N)rrrr!rrriterdir2sz Path.iterdirccsntd|||s td||j|f\}}}|s<|rDtdtt||j}| |D] }|Vq^dS)zIterate 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) r5auditrrrr>rrrrr+rkr9r:rZselectorr`rrrglob<sz Path.globccs`td|||j|f\}}}|s*|r2tdtdt||j}||D] }|VqPdS)zRecursively yield all existing files (of any kind, including directories) matching the given relative pattern, anywhere in this subtree. zpathlib.Path.rglobrO)rN)r5rPrr>rrrrrQrrrrglobJsz Path.rglobcCs6|r |S|jtg|jdd}|j|d|S)aReturn an absolute version of this path. This function works even if the path doesn't point to anything. No normalization is done, i.e. all '.' and '..' will be kept along. Use resolve() to get the canonical path to a file. Fr9r<)r rr~rrr)r+objrrrabsoluteWs  z Path.absoluteFc Csdd}z|jj||d}Wn.tyJ}z||WYd}~n d}~00||f}|sz |Wn,ty}z||WYd}~n d}~00|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|tkr,td|jdS)NrrzSymlink loop from %r)rrr_WINERROR_CANT_RESOLVE_FILENAMErfilename)rrrrr check_eloopns z!Path.resolve..check_eloop)strictN)rrrrr)r+rZrYr_rr`rrrresolvegs  z Path.resolvecCs |j|S)zh Return the result of the stat() system call on this path, like os.stat() does. )rrr*rrrrsz Path.statcCs |j|S)z: Return the login name of the file owner. )rrr*rrrrsz Path.ownercCs |j|S)z8 Return the group name of the file gid. )rrr*rrrrsz Path.grouprrQc Cstj|||||||jdS)z| Open the file pointed by this path and return a file object, as the built-in open() function does. )Zopener)iorrE)r+r bufferingencodingerrorsnewlinerrrrsz Path.opencCs8|jdd}|WdS1s*0YdS)zK Open the file in bytes mode, read it, and close the file. rbrNrreadrrrr read_bytesszPath.read_bytescCs<|jd||d}|WdS1s.0YdS)zJ Open the file in text mode, read it, and close the file. r\rr_r`Nrd)r+r_r`rrrr read_textszPath.read_textcCsBt|}|jdd}||WdS1s40YdS)zO Open the file in bytes mode, write to it, and close the file. wbrcN) memoryviewrwrite)r+dataZviewrrrr write_bytesszPath.write_bytescCsXt|tstd|jj|jd||d}||WdS1sJ0YdS)zN Open the file in text mode, write to it, and close the file. zdata must be str, not %swrgN)rrrrrBrrk)r+rlr_r`rrrr write_texts  zPath.write_textcCs,|j|}|j|fdd}|j|d|S)zD Return the path to which the symbolic link points. Fr9rT)rrrr)r+rzrUrrrrs  z Path.readlinkTcCsb|r.z|j|dWnty(Yn0dStjtjB}|sH|tjO}|||}t|dS)zS Create this file with the given access mode, if it doesn't exist. N) rrrr~O_CREATO_WRONLYO_EXCLrGclose)r+rexist_okrDfdrrrtouchs    z Path.touchcCsxz|j||Wn`tyT|r.|j|kr0|jjddd|j|d|dYn tyr|rl|snYn0dS)z< Create a new directory at this given path. T)r2rtFN)rrFileNotFoundErrorr1rr)r+rr2rtrrrrs   z Path.mkdircCs|j||dS)zF Change the permissions of the path, like os.chmod(). N)rrr+rrrrrsz Path.chmodcCs|j||dS)z Like chmod(), except if the path points to a symlink, the symlink's permissions are changed, rather than its target's. N)rrrxrrrrsz Path.lchmodcCs.z|j|Wnty(|s$Yn0dS)zd Remove this file or link. If the path is a directory, use rmdir() instead. N)rrrw)r+Z missing_okrrrrs  z Path.unlinkcCs|j|dS)zF Remove this directory. The directory must be empty. N)rrr*rrrrsz Path.rmdircCs |j|S)z Like stat(), except if the path points to a symlink, the symlink's status information is returned, rather than its target's. )rrr*rrrr sz Path.lstatcCs|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. )rrrrrrrrs z Path.renamecCs|j||||S)aS Rename this path to the target path, overwriting if that path exists. The target path may be absolute or relative. Relative paths are interpreted relative to the current working directory, *not* the directory of the Path object. Returns the new Path instance pointing to the target path. )rr1rrrrrr1!s 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)rr)r+rrrrr symlink_to.szPath.symlink_tocCs|j||dS)aQ Make the target path a hard link pointing to this path. Note this function does not make this path a hard link to *target*, despite the implication of the function and argument names. The order of arguments (target, link) is the reverse of Path.symlink_to, but matches that of os.link. N)rrrrrrr5s z Path.link_toc CsTz |WnBty<}zt|s&WYd}~dSd}~0tyNYdS0dS)z+ Whether this path exists. NFT)rrr rr+rrrrrCs  z Path.existsc CsXzt|jWSty@}zt|s*WYd}~dSd}~0tyRYdS0dS)z3 Whether this path is a directory. NF)r rst_moderr rrzrrrrRs z Path.is_dirc CsXzt|jWSty@}zt|s*WYd}~dSd}~0tyRYdS0dS)zq Whether this path is a regular file (also True for symlinks pointing to regular files). NF)r rr{rr rrzrrris_filebs z Path.is_filecCsn|r|sdSz|jj}Wnty8YdS0|j}||krPdS|j}|jj}||kS)z; Check if this path is a POSIX mount point FT)rrr1rst_devrst_ino)r+Z parent_devZdevZinoZ parent_inorrris_mountss    z Path.is_mountc CsXzt|jWSty@}zt|s*WYd}~dSd}~0tyRYdS0dS)z7 Whether this path is a symbolic link. NF)r rr{rr rrzrrrrs zPath.is_symlinkc CsXzt|jWSty@}zt|s*WYd}~dSd}~0tyRYdS0dS)z6 Whether this path is a block device. NF)r rr{rr rrzrrris_block_devices zPath.is_block_devicec CsXzt|jWSty@}zt|s*WYd}~dSd}~0tyRYdS0dS)z: Whether this path is a character device. NF)rrr{rr rrzrrris_char_devices zPath.is_char_devicec CsXzt|jWSty@}zt|s*WYd}~dSd}~0tyRYdS0dS)z. Whether this path is a FIFO. NF)rrr{rr rrzrrris_fifos z Path.is_fifoc CsXzt|jWSty@}zt|s*WYd}~dSd}~0tyRYdS0dS)z0 Whether this path is a socket. NF)r rr{rr rrzrrr is_sockets zPath.is_socketcCs`|js\|js\|jr\|jddddkr\|j|jddd}||g|jddS|S)zl Return a new path with expanded ~ and ~user constructs (as returned by os.path.expanduser) rNr?~)rrrrrr)r+Zhomedirrrrrs zPath.expanduser)N)rB)rF)F)r\rQNNN)NN)NN)rBT)rFFF)F)F)3rBrCrDrErrrrr=rArErGr5rIrJrMrNrRrSrVr[rrrrrfrhrmrorrvrrrrrrrr1ryrrrr|rrrrrrrrrrrrsh                 rc@seZdZdZdZdS)rzsPath subclass for non-Windows systems. On a POSIX system, instantiating a Path should return this object. rN)rBrCrDrErrrrrrsrc@seZdZdZdZddZdS)rzqPath subclass for Windows systems. On a Windows system, instantiating a Path should return this object. rcCs tddS)Nz-Path.is_mount() is unsupported on this systemrr*rrrrszWindowsPath.is_mountN)rBrCrDrErrrrrrrsr)@rf functoolsr]rr~rrdr5_collections_abcrrrrrrroperatorrrr r r r r rrZ urllib.parserrxZsupports_symlinks__all__Z_WINERROR_NOT_READYZ_WINERROR_INVALID_NAMErWrrr r%rr&rFrr8r7rrr;rrrrrrrrrrPathLikeregisterrrrrrrrrrsp  $   ?9F  ,