grthtrhthjhtyjytjytkergtrhtrjytjerhrfh4:24 29/09/2026a XC?h¾Çã@s2ddlZddlZddlZddlZddlZddlZddlZddlZddlm Z ddl m Z m Z m Z mZmZddlmZddlmZmZmZmZmZmZmZddlmZdZgd¢Zd Zd Z d Z!e e eefZ"ee e!fZ#d d „Z$dd„Z%Gdd„de&ƒZ'Gdd„de'ƒZ(Gdd„de'ƒZ)e(ƒZ*e)ƒZ+Gdd„dƒZ,Gdd„de,ƒZ-e-ƒZ.dd„Z/e0edƒ�rbe 1¡e/ƒZ/Gdd„dƒZ2Gdd „d ƒZ3Gd!d"„d"e2ƒZ4Gd#d$„d$e2ƒZ5Gd%d&„d&e2ƒZ6Gd'd(„d(e ƒZ7Gd)d*„d*e&ƒZ8ej9 :e8¡Gd+d,„d,e8ƒZ;Gd-d.„d.e8ƒZGd3d4„d4e=e<ƒZ?dS)5éN)ÚSequence)ÚEINVALÚENOENTÚENOTDIRÚEBADFÚELOOP)Ú attrgetter)ÚS_ISDIRÚS_ISLNKÚS_ISREGÚS_ISSOCKÚS_ISBLKÚS_ISCHRÚS_ISFIFO)Úquote_from_bytesT)ÚPurePathÚ PurePosixPathÚPureWindowsPathÚPathÚ PosixPathÚ WindowsPathéé{i�cCs t|ddƒtvpt|ddƒtvS)NÚerrnoÚwinerror)ÚgetattrÚ_IGNORED_ERROSÚ_IGNORED_WINERRORS)Z exception©rú,/opt/alt/python39/lib64/python3.9/pathlib.pyÚ _ignore_error(sÿr cCsd|vpd|vpd|vS)NÚ*ú?ú[r)ÚpatrrrÚ_is_wildcard_pattern-sr%c@s(eZdZdZdd„Zdd„Zdd„ZdS) Ú_FlavourzPA flavour implements a particular (platform-specific) set of path semantics.cCs|jj|_dS©N)ÚsepÚjoin©ÚselfrrrÚ__init__7sz_Flavour.__init__c Csg}|j}|j}d}}t|ƒ}|D]Æ}|s.q$|r>| ||¡}| |¡\}}} || vrˆt|  |¡ƒD] } | rd| dkrd| t | ¡¡qdn| r¤| dkr¤| t | ¡¡|s¬|r$|sæ|D]0}|s¾q´|rÎ| ||¡}| |¡d}|r´qæq´qìq$|sö|�r| ||¡|  ¡|||fS)NÚÚ.r) r(ÚaltsepÚreversedÚreplaceÚ splitrootÚsplitÚappendÚsysÚinternÚreverse) r+ÚpartsZparsedr(r/ÚdrvÚrootÚitÚpartZrelÚxrrrÚ parse_parts:s@     z_Flavour.parse_partscCsz|r*|sp|rp||||g|dd…fSnF|rb||ksJ| |¡| |¡krp||||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+r9r:r8Zdrv2Zroot2Zparts2rrrÚjoin_parsed_parts`sz_Flavour.join_parsed_partsN)Ú__name__Ú __module__Ú __qualname__Ú__doc__r,r>rArrrrr&3s&r&c@sžeZdZdZdZdZeZej dkZ e dƒZ dZ hd£dd „d DƒBd d „d DƒBZefd d „Zdd„Zdd„Zdd„Ze fdd„Zdd„Zdd„Zdd„ZdS)Ú_WindowsFlavourú\ú/TÚntZ4abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZz\\?\>ZPRNZCONZAUXzCONOUT$ZNULzCONIN$cCsh|] }d|’qS)zCOM%sr©Ú.0ÚcrrrÚ ‚óz_WindowsFlavour.u123456789¹²³cCsh|] }d|’qS)zLPT%srrJrrrrMƒrNc Cs\|dd…}|dd…}||krP||krP| |¡\}}|dd…}|dd…}nd}|dd…}||krü||krü||krü| |d¡}|dkrü| ||d¡}||dkrü|dkr¸t|ƒ}|rÞ||d|…|||dd…fS|d|…|||dd…fSd} } |dk�r6||jv�r6|dd…} |dd…}|}||k�rN|} | |¡}|| | |fS)Nrr?ér-ééÿÿÿÿú:)Ú_split_extended_pathÚfindÚlenÚ drive_lettersÚlstrip) r+r<r(ÚfirstÚsecondÚprefixZthirdÚindexZindex2r9r:rrrr2•s6      "    z_WindowsFlavour.splitrootcCs| ¡Sr'©Úlower©r+Úsrrrr@¼sz_WindowsFlavour.casefoldcCsdd„|DƒS)NcSsg|] }| ¡‘qSrr\)rKÚprrrÚ ÀrNz2_WindowsFlavour.casefold_parts..r©r+r8rrrÚcasefold_parts¿sz_WindowsFlavour.casefold_partscCst t |¡tj¡jSr')ÚreÚcompileÚfnmatchÚ translateÚ IGNORECASEÚ fullmatch©r+ÚpatternrrrÚcompile_patternÂsz_WindowsFlavour.compile_patterncCsXd}| |¡rP|dd…}|dd…}| d¡rP||dd…7}d|dd…}||fS)Nr-ézUNC\rPrG)Ú startswith)r+r_Z ext_prefixrZrrrrSÅs    z$_WindowsFlavour._split_extended_pathcCsJ|sdS|d d¡rdS|d d¡d d¡d d¡}| ¡|jvS)NFrz\\rQr.rRú )rnÚ partitionÚrstripÚupperÚreserved_names)r+r8ÚnamerrrÚ is_reservedÏs "z_WindowsFlavour.is_reservedcCsd|j}t|ƒdkrJ|ddkrJ| ¡dd… d¡}d|t| d¡ƒfSdt| ¡ d¡ƒSdS)NrOr?rRrHz file:///%s/%szutf-8zfile:)ÚdriverUÚas_posixrWÚurlquote_from_bytesÚencode)r+ÚpathrvÚrestrrrÚmake_uriÜsÿz_WindowsFlavour.make_uricCsÚdtjvrtjd}nHdtjvrVztjd}WntyDd}Yn0|tjd}ntdƒ‚|rÖtjd|krÖ| |f¡\}}}|dtjdkr td|ƒ‚||d<|s°|rÌ||| |d d…¡}n | |¡}|S) NZ USERPROFILEZHOMEPATHZ HOMEDRIVEr-zCan't determine home directoryZUSERNAMErQú%Can't determine home directory for %rr?)ÚosÚenvironÚKeyErrorÚ RuntimeErrorr>r))r+ÚusernameÚuserhomer9r:r8rrrÚ gethomedirès*     ÿ z_WindowsFlavour.gethomedirN)rBrCrDr(r/Úhas_drvÚntpathÚpathmodr~rtÚ is_supportedÚsetrVZext_namespace_prefixrsr2r@rcrlrSrur|r„rrrrrFrs*  ÿ þÿ '   rFc@sbeZdZdZdZdZeZej dkZ efdd„Z dd„Z d d „Z d d „Zd d„Zdd„Zdd„ZdS)Ú _PosixFlavourrHr-FrIcCsV|rH|d|krH| |¡}t|ƒt|ƒdkrz tjdWSty:ddl}| t ¡¡jYS0n6ddl}z| |¡jWStyrtd|ƒ‚Yn0dS)NÚHOMErr}) r~rr€ÚpwdÚgetpwuidÚgetuidÚpw_dirÚgetpwnamr�)r+r‚rŽrrrr„.s   ÿz_PosixFlavour.gethomedirN)rBrCrDr(r/r…Ú posixpathr‡r~rtrˆr2r@rcrlrur|r„rrrrrŠs  rŠc@seZdZdZdS)Ú _AccessorzjAn accessor implements a particular (system-specific or not) way of accessing paths on the filesystem.N)rBrCrDrErrrrr”Bsr”c@sÞeZdZejZejZejZejZejZej Z e edƒr>ej Z ndd„Z ej Z ej Z e edƒrdejZn edd„ƒZejZejZejZe edƒr”ejZn dd d „ZejZd d „Zd d„Zdd„ZejZeejjƒZeejjƒZdS)Ú_NormalAccessorÚlchmodcCs tdƒ‚dS)Nz%lchmod() not available on this system©ÚNotImplementedError)r+ZpathobjÚmoderrrr–Xsz_NormalAccessor.lchmodÚlinkcCs tdƒ‚dS)Nz&os.link() not available on this systemr—©r+ÚtargetrrrÚlink_tobsz_NormalAccessor.link_toÚsymlinkFcCs tdƒ‚dS)Nz)os.symlink() not available on this systemr—)r+ÚsrcZdstÚtarget_is_directoryrrrržosz_NormalAccessor.symlinkcCs t |¡Sr')r~Úreadlink©r+rzrrrr¡usz_NormalAccessor.readlinkcCs>zddl}| | |¡j¡jWSty8tdƒ‚Yn0dS)Nrz*Path.owner() is unsupported on this system)rŽr�ÚstatÚst_uidZpw_nameÚ ImportErrorr˜)r+rzrŽrrrÚownerxs  z_NormalAccessor.ownercCs>zddl}| | |¡j¡jWSty8tdƒ‚Yn0dS)Nrz*Path.group() is unsupported on this system)ÚgrpZgetgrgidr£Úst_gidZgr_namer¥r˜)r+rzr§rrrÚgroups  z_NormalAccessor.groupN)F)rBrCrDr~r£ÚlstatÚopenÚlistdirÚscandirÚchmodÚhasattrr–ÚmkdirÚunlinkršr�Ú staticmethodÚrmdirÚrenamer1ržÚutimer¡r¦r©ÚgetcwdrzÚ expanduserÚrealpathrrrrr•Gs8      r•cCsR|d}|dd…}|dkr"t}n$d|vr4tdƒ‚nt|ƒrBt}nt}||||ƒS)Nrr?ú**z:Invalid pattern: '**' can only be an entire path component)Ú_RecursiveWildcardSelectorÚ ValueErrorr%Ú_WildcardSelectorÚ_PreciseSelector)Ú pattern_partsÚflavourr$Ú 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.cCs0||_|rt||ƒ|_d|_ntƒ|_d|_dS)NTF)rÀrÂÚ successorÚdironlyÚ_TerminatingSelector)r+rÀr¿rrrr,©s  z_Selector.__init__cCs<t|ƒ}|j}|j}|jj}||ƒs,tgƒS| ||||¡S)zuIterate over all child paths of `parent_path` matched by this selector. This can contain parent_path itself.)ÚtypeÚis_dirÚexistsÚ _accessorr­ÚiterÚ _select_from)r+Ú parent_pathZpath_clsrÉrÊr­rrrÚ select_from²sz_Selector.select_fromN)rBrCrDrEr,rÏrrrrrÄ¥s rÄc@seZdZdd„ZdS)rÇccs |VdSr'r)r+rÎrÉrÊr­rrrrÍÀsz!_TerminatingSelector._select_fromN)rBrCrDrÍrrrrrǾsrÇc@seZdZdd„Zdd„ZdS)r½cCs||_t |||¡dSr')rtrÄr,)r+rtrÀr¿rrrr,Æsz_PreciseSelector.__init__ccsZz@| |j¡}|jr|n||ƒr>|j ||||¡D] }|Vq2WntyTYdS0dSr')Ú_make_child_relpathrtrÆrÅrÍÚPermissionError)r+rÎrÉrÊr­rzr`rrrrÍÊs   z_PreciseSelector._select_fromN©rBrCrDr,rÍrrrrr½Äsr½c@seZdZdd„Zdd„ZdS)r¼cCs| |¡|_t |||¡dSr')rlÚmatchrÄr,©r+r$rÀr¿rrrr,Ös z_WildcardSelector.__init__c csâzÈ||ƒ�}t|ƒ}Wdƒn1s(0Y|D]Ž}|jrŒz| ¡sNWq6Wn:tyŠ}z"t|ƒsj‚WYd}~q6WYd}~n d}~00|j} | | ¡r6| | ¡} |j  | |||¡D] } | Vq¸q6Wnt yÜYdS0dSr') ÚlistrÆrÉÚOSErrorr rtrÓrÐrÅrÍrÑ) r+rÎrÉrÊr­Ú scandir_itÚentriesÚentryÚertrzr`rrrrÍÚs& &"   z_WildcardSelector._select_fromNrÒrrrrr¼Ôsr¼c@s$eZdZdd„Zdd„Zdd„ZdS)rºcCst |||¡dSr')rÄr,rÔrrrr,õsz#_RecursiveWildcardSelector.__init__c csÐ|Vz°||ƒ�}t|ƒ}Wdƒn1s.0Y|D]v}d}z | ¡}Wn.ty~}zt|ƒsj‚WYd}~n d}~00|r<| ¡s<| |j¡} | | ||¡D] } | Vq¦q)ÚformatràrBr*rrrÚ__repr__7sz_PathParents.__repr__N) rBrCrDrEÚ __slots__r,rårérërrrrrßs rßc@s´eZdZdZdZdd„Zdd„Zedd„ƒZed\d d „ƒZ ed]d d „ƒZ edd„ƒZ dd„Z dd„Z dd„Zdd„Zdd„Zdd„Zdd„Zdd„Zed d!„ƒZd"d#„Zd$d%„Zd&d'„Zd(d)„Zd*d+„Zd,d-„Zd.d/„Zeed0ƒd1d2�Zeed3ƒd4d2�Zed5d6„ƒZ ed7d8„ƒZ!ed9d:„ƒZ"ed;d<„ƒZ#ed=d>„ƒZ$d?d@„Z%dAdB„Z&dCdD„Z'dEdF„Z(dGdH„Z)edIdJ„ƒZ*dKdL„Z+dMdN„Z,dOdP„Z-edQdR„ƒZ.edSdT„ƒZ/dUdV„Z0dWdX„Z1dYdZ„Z2d[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. )rárârãÚ_strÚ_hashÚ_ppartsÚ_cached_cpartscGs$|turtjdkrtnt}| |¡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. rI)rr~rtrrÚ _from_parts)rÁÚargsrrrÚ__new__IszPurePath.__new__cCs|jt|jƒfSr')Ú __class__Útuplerãr*rrrÚ __reduce__SszPurePath.__reduce__cCsdg}|D]N}t|tƒr"||j7}qt |¡}t|tƒrF| t|ƒ¡qtdt|ƒƒ‚q|j   |¡S)NzNargument should be a str object or an os.PathLike object returning str, not %r) Ú isinstancerrãr~ÚfspathÚstrr4Ú TypeErrorrÈÚ_flavourr>)rÁròr8ÚarrrÚ _parse_argsXs    þÿzPurePath._parse_argsTcCs<t |¡}| |¡\}}}||_||_||_|r8| ¡|Sr')ÚobjectrórýrárârãÚ_init)rÁròÚinitr+r9r:r8rrrrñls zPurePath._from_partscCs,t |¡}||_||_||_|r(| ¡|Sr')rþrórárârãrÿ)rÁr9r:r8rr+rrrrçys zPurePath._from_parsed_partscCs4|s|r$|||j |dd…¡S|j |¡SdSrä)rûr))rÁr9r:r8rrrÚ_format_parsed_partsƒszPurePath._format_parsed_partscCsdSr'rr*rrrrÿŠszPurePath._initcCs@| |¡\}}}|j |j|j|j|||¡\}}}| |||¡Sr')rýrûrArárârãrç)r+ròr9r:r8rrrÚ _make_childŽs ÿ zPurePath._make_childcCs@z|jWSty:| |j|j|j¡p,d|_|jYS0dS)z[Return the string representation of the path, suitable for passing to system calls.r.N)ríÚAttributeErrorrrárârãr*rrrÚ__str__”s  ÿÿzPurePath.__str__cCst|ƒSr')rùr*rrrÚ __fspath__žszPurePath.__fspath__cCs|j}t|ƒ |jd¡S)zNReturn the string representation of the path with forward (/) slashes.rH)rûrùr1r(©r+Úfrrrrw¡szPurePath.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}))rêrôrBrwr*rrrrë¬szPurePath.__repr__cCs| ¡stdƒ‚|j |¡S)z Return the path as a 'file' URI.z.relative path can't be expressed as a file URI)Ú is_absoluter»rûr|r*rrrÚas_uri¯szPurePath.as_uricCs6z|jWSty0|j |j¡|_|jYS0dSr')rðrrûrcrãr*rrrÚ_cpartsµs  zPurePath._cpartscCs&t|tƒstS|j|jko$|j|juSr')r÷rÚNotImplementedr rû©r+ÚotherrrrÚ__eq__¾s zPurePath.__eq__cCs6z|jWSty0tt|jƒƒ|_|jYS0dSr')rîrÚhashrõr r*rrrÚ__hash__Ãs  zPurePath.__hash__cCs&t|tƒr|j|jurtS|j|jkSr'©r÷rrûr r rrrrÚ__lt__ÊszPurePath.__lt__cCs&t|tƒr|j|jurtS|j|jkSr'rrrrrÚ__le__ÏszPurePath.__le__cCs&t|tƒr|j|jurtS|j|jkSr'rrrrrÚ__gt__ÔszPurePath.__gt__cCs&t|tƒr|j|jurtS|j|jkSr'rrrrrÚ__ge__ÙszPurePath.__ge__cCs|Sr'r)rÁrÈrrrÚ__class_getitem__ÞszPurePath.__class_getitem__ráz.The drive prefix (letter or UNC path), if any.)ÚdocrâzThe root of the path, if any.cCs|j|j}|S)z/The concatenation of the drive and root, or ''.)rárâ)r+Úanchorrrrrçs zPurePath.anchorcCs.|j}t|ƒ|js|jrdndkr&dS|dS)z!The final path component, if any.r?rr-rQ)rãrUrárârbrrrrtísz PurePath.namecCsD|j}| d¡}d|kr,t|ƒdkr.r?N)rtÚendswithrWr3©r+rtrrrÚsuffixess   zPurePath.suffixescCsD|j}| d¡}d|kr,t|ƒdkrr(r/rUrçrárârã)r+rtr9r:r8rrrÚ with_namesÿÿ ÿ  ÿzPurePath.with_namecCs| ||j¡S)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<| d¡rD|dkrPtd|ƒ‚|j}|shtd|fƒ‚|j}|s|||}n|dt|ƒ …|}| |j |j |j dd…|g¡S)zÀReturn a new path with the file suffix changed. If the path has no suffix, add given suffix. If the given suffix is an empty string, remove the suffix from the path. zInvalid suffix %rr.r$NrQ) rûr(r/r»rnrtrrUrçrárârã)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¤|rÊn| |d| …ƒ| | ƒkrÊ| |||¡} t d  t |ƒt | ƒ¡ƒ‚|  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 argumentr?NrzU{!r} is not in the subpath of {!r} OR one path is relative and the other is absolute.r-) rúrãrárârýrUrûrcrr»rêrùrç) r+rr8r9r:Z abs_partsZto_drvZto_rootZto_partsZ to_abs_partsÚnÚcfZ 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*r»rrrrÚis_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)rïrrõrãr*rrrr8hs   zPurePath.partscGs | |¡S)zîCombine this path with one or several arguments, and return a new path representing either a subpath (if all arguments are relative paths) or a totally different path (if one of the arguments is anchored). )r)r+ròrrrÚjoinpathtszPurePath.joinpathcCs*z| |f¡WSty$tYS0dSr')rrúr ©r+ÚkeyrrrÚ __truediv__|s zPurePath.__truediv__cCs0z| |g|j¡WSty*tYS0dSr')rñrãrúr r-rrrÚ __rtruediv__‚s zPurePath.__rtruediv__cCs@|j}|j}|j}t|ƒdkr*|s&|r*|S| |||dd…¡S)zThe logical parent of the path.r?NrQ)rárârãrUrç)r+r9r:r8rrrÚparentˆs zPurePath.parentcCst|ƒS)z*A sequence of this path's logical parents.)rßr*rrrÚparents’szPurePath.parentscCs|js dS|jj pt|jƒS)zSTrue if the path is absolute (has both a root and, if applicable, a drive).F)rârûr…Úboolrár*rrrr —szPurePath.is_absolutecCs|j |j¡S)zaReturn True if the path contains one of the special names reserved by the system, if any.)rûrurãr*rrrružszPurePath.is_reservedc CsÒ|jj}||ƒ}|j |f¡\}}}|s0tdƒ‚|rF|||jƒkrFdS|r\|||jƒkr\dS|j}|sj|rŒt|ƒt|ƒkr~dS|dd…}nt|ƒt|ƒkr dStt |ƒt |ƒƒD]\}}t   ||¡s²dSq²dS)zE Return True if this path matches the given pattern. z empty patternFr?NT) rûr@r>r»rárâr rUÚzipr0rfZ fnmatchcase) r+Z path_patternr)r9r:Z pat_partsr8r<r$rrrrÓ£s( zPurePath.matchN)T)T)3rBrCrDrErìróröÚ classmethodrýrñrçrrÿrrrrwr rër Úpropertyr rrrrrrrrrvr:rrtrr"r#r%r&r'r*r+r8r,r/r0r1r2r rurÓrrrrr;s|       ÿÿ      !    rc@seZdZdZeZdZdS)rz¼PurePath subclass for non-Windows systems. On a POSIX system, instantiating a PurePath should return this object. However, you can also instantiate it directly on any system. rN)rBrCrDrEÚ_posix_flavourrûrìrrrrrÁsrc@seZdZdZeZdZdS)rzºPurePath subclass for Windows systems. On a Windows system, instantiating a PurePath should return this object. However, you can also instantiate it directly on any system. rN)rBrCrDrEÚ_windows_flavourrûrìrrrrrËsrc@sšeZdZdZdZdd„Zdddd„Zdd „Zd d „Zd d „Z dedd„Z dfdd„Z e dd„ƒZ e dd„ƒZdd„Zdd„Zdd„Zdd„Zd d!„Zdgd#d$„Zd%d&„Zd'd(„Zd)d*„Zdhd-d.„Zd/d0„Zdid1d2„Zd3d4„Zdjd5d6„Zd7d8„Zdkd:d;„Zdldd?„Z d@dA„Z!dmdBdC„Z"dDdE„Z#dFdG„Z$dHdI„Z%dJdK„Z&dndLdM„Z'dNdO„Z(dPdQ„Z)dRdS„Z*dTdU„Z+dVdW„Z,dXdY„Z-dZd[„Z.d\d]„Z/d^d_„Z0d`da„Z1dbdc„Z2dS)ora¡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ËcOsL|turtjdkrtnt}|j|dd�}|jjs@td|j fƒ‚|  ¡|S)NrIF©rz$cannot instantiate %r on your system) rr~rtrrrñrûrˆr˜rBrÿ)rÁròÚkwargsr+rrrróåsÿz Path.__new__NcCs|dur|j|_nt|_dSr')rËÚ_normal_accessor)r+Útemplaterrrrÿïs z Path._initcCs|j|g}| |j|j|¡Sr')rãrçrárâ)r+r<r8rrrrÐøs zPath._make_child_relpathcCs|Sr'rr*rrrÚ __enter__þszPath.__enter__cCsdSr'r)r+ÚtÚvÚtbrrrÚ__exit__s z Path.__exit__é¶cCs|j |||¡Sr'©rËr«)r+rtÚflagsr™rrrÚ_opener sz Path._openeréÿcCs|j |||¡S)zm Open the file pointed by this path and return a file descriptor, as os.open() does. rC)r+rDr™rrrÚ _raw_openszPath._raw_opencCs |t ¡ƒS)zjReturn a new path pointing to the current working directory (as returned by os.getcwd()). )r~r¶©rÁrrrÚcwdszPath.cwdcCs||ƒj d¡ƒS)zrReturn a new path pointing to the user's home directory (as returned by os.path.expanduser('~')). N)rûr„rHrrrÚhome 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()). )r£rrËr~rzÚsamestat)r+Z other_pathÚstZother_strrrÚsamefile'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)rËr¬rÐr!rrrÚiterdir2sz Path.iterdirccsnt d||¡|s td |¡ƒ‚|j |f¡\}}}|s<|rDtdƒ‚tt|ƒ|jƒ}|  |¡D] }|Vq^dS)z‘Iterate over this subtree and yield all existing files (of any kind, including directories) matching the given relative pattern. zpathlib.Path.globzUnacceptable pattern: {!r}ú%Non-relative patterns are unsupportedN) r5Úauditr»rêrûr>r˜rÂrõrÏ©r+rkr9r:r¾Zselectorr`rrrÚglob<sz Path.globccs`t d||¡|j |f¡\}}}|s*|r2tdƒ‚tdt|ƒ|jƒ}| |¡D] }|VqPdS)z¡Recursively yield all existing files (of any kind, including directories) matching the given relative pattern, anywhere in this subtree. zpathlib.Path.rglobrO)r¹N)r5rPrûr>r˜rÂrõrÏrQrrrÚrglobJsz Path.rglobcCs6| ¡r |S|jt ¡g|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. Fr9©r<)r rñr~r¶rãrÿ)r+ÚobjrrrÚabsoluteWs  z Path.absoluteFc Csšdd„}z|jj||d�}Wn.tyJ}z||ƒ‚WYd}~n d}~00| |f¡}|s–z | ¡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|jƒ‚dS)NrrzSymlink loop from %r)rrrÚ_WINERROR_CANT_RESOLVE_FILENAMEr�Úfilename)rÚrrrrÚ check_eloopns z!Path.resolve..check_eloop)ÚstrictN)rËr¸rÖrñr£)r+rZrYr_rÚr`rrrÚresolvegs  z Path.resolvecCs |j |¡S)zh Return the result of the stat() system call on this path, like os.stat() does. )rËr£r*rrrr£ƒsz Path.statcCs |j |¡S)z: Return the login name of the file owner. )rËr¦r*rrrr¦Šsz Path.ownercCs |j |¡S)z8 Return the group name of the file gid. )rËr©r*rrrr©�sz Path.groupÚrrQc Cstj|||||||jd�S)z| Open the file pointed by this path and return a file object, as the built-in open() function does. )Zopener)Úior«rE)r+r™Ú bufferingÚencodingÚerrorsÚnewlinerrrr«–sÿz Path.opencCs8|jdd��}| ¡WdƒS1s*0YdS)zK Open the file in bytes mode, read it, and close the file. Úrb©r™N©r«ÚreadrrrrÚ read_bytesŸszPath.read_bytescCs<|jd||d��}| ¡WdƒS1s.0YdS)zJ Open the file in text mode, read it, and close the file. r\©r™r_r`Nrd)r+r_r`rrrrÚ read_text¦szPath.read_textcCsBt|ƒ}|jdd��}| |¡WdƒS1s40YdS)zO Open the file in bytes mode, write to it, and close the file. ÚwbrcN)Ú memoryviewr«Úwrite)r+ÚdataZviewrrrrÚ write_bytes­szPath.write_bytescCsXt|tƒstd|jjƒ‚|jd||d��}| |¡WdƒS1sJ0YdS)zN Open the file in text mode, write to it, and close the file. zdata must be str, not %sÚwrgN)r÷rùrúrôrBr«rk)r+rlr_r`rrrrÚ write_text¶s  ÿzPath.write_textcCs,|j |¡}|j|fdd�}|j|d�|S)zD Return the path to which the symbolic link points. Fr9rT)rËr¡rñrÿ)r+rzrUrrrr¡Às  z Path.readlinkTcCsb|r.z|j |d¡Wnty(Yn0dStjtjB}|sH|tjO}| ||¡}t |¡dS)zS Create this file with the given access mode, if it doesn't exist. N) rËrµrÖr~ÚO_CREATÚO_WRONLYÚO_EXCLrGÚclose)r+r™Úexist_okrDÚfdrrrÚtouchÉs    z Path.touchcCsxz|j ||¡Wn`tyT|r.|j|kr0‚|jjddd�|j|d|d�Yn tyr|rl| ¡sn‚Yn0dS)z< Create a new directory at this given path. T)r2rtFN)rËr°ÚFileNotFoundErrorr1rÖrÉ)r+r™r2rtrrrr°Þs   z Path.mkdircCs|j ||¡dS)zF Change the permissions of the path, like os.chmod(). N)rËr®©r+r™rrrr®ïsz 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)rËr–rxrrrr–õsz Path.lchmodcCs.z|j |¡Wnty(|s$‚Yn0dS)zd Remove this file or link. If the path is a directory, use rmdir() instead. N)rËr±rw)r+Z missing_okrrrr±üs  z Path.unlinkcCs|j |¡dS)zF Remove this directory. The directory must be empty. N)rËr³r*rrrr³sz 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. )rËrªr*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. )rËr´rôr›rrrr´s 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. )rËr1rôr›rrrr1!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)rËrž)r+rœr rrrÚ 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)rËr�r›rrrr�5s z Path.link_toc CsTz | ¡WnBty<}zt|ƒs&‚WYd}~dSd}~0tyNYdS0dS)z+ Whether this path exists. NFT)r£rÖr r»©r+rÚrrrrÊCs  z Path.existsc CsXzt| ¡jƒWSty@}zt|ƒs*‚WYd}~dSd}~0tyRYdS0dS)z3 Whether this path is a directory. NF)r r£Úst_moderÖr r»rzrrrrÉRs z Path.is_dirc CsXzt| ¡jƒWSty@}zt|ƒs*‚WYd}~dSd}~0tyRYdS0dS)zq Whether this path is a regular file (also True for symlinks pointing to regular files). NF)r r£r{rÖr r»rzrrrÚis_filebs z Path.is_filecCsn| ¡r| ¡sdSz|j ¡j}Wnty8YdS0| ¡j}||krPdS| ¡j}|j ¡j}||kS)z; Check if this path is a POSIX mount point FT)rÊrÉr1r£Úst_devrÖÚst_ino)r+Z parent_devZdevZinoZ parent_inorrrÚis_mountss    z Path.is_mountc CsXzt| ¡jƒWSty@}zt|ƒs*‚WYd}~dSd}~0tyRYdS0dS)z7 Whether this path is a symbolic link. NF)r rªr{rÖr r»rzrrrrÛ‡s zPath.is_symlinkc CsXzt| ¡jƒWSty@}zt|ƒs*‚WYd}~dSd}~0tyRYdS0dS)z6 Whether this path is a block device. NF)r r£r{rÖr r»rzrrrÚis_block_device–s zPath.is_block_devicec CsXzt| ¡jƒWSty@}zt|ƒs*‚WYd}~dSd}~0tyRYdS0dS)z: Whether this path is a character device. NF)rr£r{rÖr r»rzrrrÚis_char_device¦s zPath.is_char_devicec CsXzt| ¡jƒWSty@}zt|ƒs*‚WYd}~dSd}~0tyRYdS0dS)z. Whether this path is a FIFO. NF)rr£r{rÖr r»rzrrrÚis_fifo¶s z Path.is_fifoc CsXzt| ¡jƒWSty@}zt|ƒs*‚WYd}~dSd}~0tyRYdS0dS)z0 Whether this path is a socket. NF)r r£r{rÖr r»rzrrrÚ is_socketÆs zPath.is_socketcCs`|js\|js\|jr\|jddd…dkr\|j |jddd…¡}| |g|jdd…¡S|S)zl Return a new path with expanded ~ and ~user constructs (as returned by os.path.expanduser) rNr?ú~)rárârãrûr„rñ)r+Zhomedirrrrr·Ös ÿÿzPath.expanduser)N)rB)rF)F)r\rQNNN)NN)NN)rBT)rFFF)F)F)3rBrCrDrErìrórÿrÐr=rArErGr5rIrJrMrNrRrSrVr[r£r¦r©r«rfrhrmror¡rvr°r®r–r±r³rªr´r1ryr�rÊrÉr|rrÛr€r�r‚rƒr·rrrrrØsh þ         ÿ        rc@seZdZdZdZdS)rzsPath subclass for non-Windows systems. On a POSIX system, instantiating a Path should return this object. rN)rBrCrDrErìrrrrrâsrc@seZdZdZdZdd„ZdS)rzqPath subclass for Windows systems. On a Windows system, instantiating a Path should return this object. rcCs tdƒ‚dS)Nz-Path.is_mount() is unsupported on this systemr—r*rrrrðszWindowsPath.is_mountN)rBrCrDrErìrrrrrrésr)@rfÚ functoolsr]r†r~r“rdr5Ú_collections_abcrrrrrrrÚoperatorrr£r r r r r rrZ urllib.parserrxZsupports_symlinksÚ__all__Z_WINERROR_NOT_READYZ_WINERROR_INVALID_NAMErWrrr r%rþr&rFrŠr8r7r”r•r;rÂr¯rÃrÄrÇr½r¼rºrßrÚPathLikeÚregisterrrrrrrrrrÚsp  $   ý?9F  ,