grthtrhthjhtyjytjytkergtrhtrjytjerhrfh4:24 29/09/2026î £ fã¥ã@sSddlZddlZddlZddlZddlZddlZddlZddlZddlm Z ddl m Z ddl m Z mZmZddlmZddlmZmZmZmZmZmZmZddlmZdZejd krUddlZej ƒdd …d dfkrFdd 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,e d d!„ƒZ-d"d#„Z.e/ed$ƒrGej0ƒe.ƒZ.nGd%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/python34/lib64/python3.4/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__c Cs¨g}|j}|j}d}}t|ƒ}x@|D]8}|sGq5n|rb|j||ƒ}n|j|ƒ\}}} || krÔxvt| j|ƒƒD]1} | rœ| dkrœ|jtj| ƒƒqœqœWn+| rÿ| dkrÿ|jtj| ƒƒn|s |r5|sixU|D]J}|s*qn|rE|j||ƒ}n|j|ƒd}|rPqqWnPq5q5W|s}|r‘|j||ƒn|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@sKeZdZdZdZdZeZej dkZ e dd„e e dƒe dƒd ƒDƒƒe d 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&S)'Ú_WindowsFlavourú\ú/Trccs|]}t|ƒVqdS)N)Úchr)Ú.0r6rrrú wsz_WindowsFlavour.ÚaÚzr8ccs|]}t|ƒVqdS)N)rB)rCr6rrrrDxsÚAÚZz\\?\ZCONZPRNZAUXZNULcCsh|]}d|’qS)zCOM%dr)rCÚirrrú ~s z_WindowsFlavour.é cCsh|]}d|’qS)zLPT%dr)rCrIrrrrJs c Csé|dd…}|dd…}||krp||krp|j|ƒ\}}|dd…}|dd…}nd}|dd…}||krf||krf||krf|j|dƒ}|dkrf|j||dƒ}||dkrc|dkr t|ƒ}n|r8||d|…|||dd…fS|d|…|||dd…fSqcqfnd} } |dkr´||jkr´|dd…} |dd…}|}n||krØ|} |j|ƒ}n|| | |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ú ³s z2_WindowsFlavour.casefold_parts..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.resolvecCs|d}|j|ƒrr|dd…}|dd…}|jdƒrr||dd…7}d|dd…}qrn||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_uriN)r;r<r=r"r(Úhas_drvÚntpathÚpathmodr^ÚnameÚ is_supportedÚsetÚrangeÚordrRZext_namespace_prefixrgr+r9r\rbrOr`rhrnrrrrr?ks$ /3) '     r?c@s‚eZdZdZdZdZeZej dkZ edd„Z dd„Z d d „Z d d „Zd d„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$rYrrrr9üsz_PosixFlavour.casefoldcCs|S)Nr)r$r1rrrr\ÿsz_PosixFlavour.casefold_partscsj|j‰|j‰i‰‡‡‡‡fdd†‰|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|ƒ}Wn@tk r}z |jtkr÷‚n|}WYdd}~Xq(Xdˆ|<ˆ||ƒ}|ˆ|._resolver&)r"Ú _accessorÚ is_absoluter^r_r])r$raÚbaser)r�r‚rƒr"rrbs   %z_PosixFlavour.resolvecCsdS)NFr)r$r1rrrrh.sz_PosixFlavour.is_reservedcCst|ƒ}dt|ƒS)Nzfile://)Úbytesrk)r$raZbpathrrrrn1s z_PosixFlavour.make_uriN)r;r<r=r"r(roÚ posixpathrqr^rrrsr+r9r\rbrhrnrrrrrwås    , rwc@seZdZdZdS)Ú _AccessorzjAn accessor implements a particular (system-specific or not) way of accessing paths on the filesystem.N)r;r<r=r>rrrrr‰<s r‰c@sEeZdZdd„Zdd„ZeejƒZeejƒZeejƒZeej ƒZ eej ƒZ e edƒr�eej ƒZ n dd„Z eej ƒZ eejƒZeejƒZeejƒZeejƒZerereejƒZq&dd „Zned d „ƒZeejƒZd d „Zd S)Ú_NormalAccessorcs+tjˆƒ‡fdd†ƒ}t|ƒS)Ncsˆt|ƒ|ŒS)N)r])ÚpathobjÚargs)ÚstrfuncrrÚwrappedDsz._NormalAccessor._wrap_strfunc..wrapped)Ú functoolsÚwrapsÚ staticmethod)r�rŽr)r�rÚ _wrap_strfuncCs!z_NormalAccessor._wrap_strfunccs+tjˆƒ‡fdd†ƒ}t|ƒS)Ncsˆt|ƒt|ƒ|ŒS)N)r])ZpathobjAZpathobjBrŒ)r�rrrŽJsz5_NormalAccessor._wrap_binary_strfunc..wrapped)r�r�r‘)r�rŽr)r�rÚ_wrap_binary_strfuncIs!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Úsymlinkmsz_NormalAccessor.symlinkcCstjt|ƒt|ƒƒS)N)r^r™r])rEr—r˜rrrr™qscCs tj|ƒS)N)r^rz)r$rarrrrzxsz_NormalAccessor.readlinkN)r;r<r=r’r“r^ÚstatÚlstatÚopenÚlistdirÚchmodÚhasattrr”ÚmkdirÚunlinkÚrmdirÚrenamer*rÚsupports_symlinksr™r‘ÚutimerzrrrrrŠAs,    rŠc#sdyˆjˆVWnMtk r_i‰‡‡fdd†}d|_z |VWdˆjƒXYnXdS)Nc s=y ˆ|SWn*tk r8ˆ|Œ}ˆ|<|SYnXdS)N)ÚKeyError)rŒÚvalue)ÚcacheÚfuncrrÚwrapperŠs   z_cached..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)rrr¸r%)r$rrr´rrrr%Äs z_PreciseSelector.__init__c cs}y`||ƒsdS|j|jƒ}||ƒr_x+|jj||||ƒD] }|VqMWnWntk rxdSYnXdS)N)Ú_make_child_relpathrrr¹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}xo||ƒD]a}||ƒ}|jj|ƒr,|j|ƒ}x+|jj||||ƒD] } | Vq{Wq,q,WWntk rªdSYnXdS)N)Ú_flavourr9rÚmatchrÁr¹r¾rÂ) r$r¿r¼r½r�ÚcfrrZ 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__c cs�|Vykxd||ƒD]V}|j|ƒ}||ƒr|jƒ rx%|j|||ƒD] }|VqYWqqWWntk rˆdSYnXdS)N)rÁÚ is_symlinkÚ_iterate_directoriesrÂ)r$r¿r¼r�rrrarZrrrrËïs z/_RecursiveWildcardSelector._iterate_directoriesc csÎy±||ƒsdSt|ƒ��}tƒ}zq|jj}x^|j|||ƒD]G}x>|||||ƒD]'}||krl|V|j|ƒqlqlWqPWWd|jƒXWdQXWntk rÉdSYnXdS)N)r®rtr¹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%s  z_PathParents.__init__cCs4|js|jr#t|jƒdSt|jƒSdS)Nr8)rÏrÐrQrÑ)r$rrrÚ__len__sz_PathParents.__len__cCs[|dks|t|ƒkr-t|ƒ‚n|jj|j|j|jd| d…ƒS)Nrr8)rQÚ IndexErrorrÎÚ_from_parsed_partsrÏrÐrÑ)r$ÚidxrrrÚ __getitem__#sz_PathParents.__getitem__cCsdj|jjƒS)Nz <{}.parents>)ÚformatrÎr;)r$rrrÚ__repr__)sz_PathParents.__repr__N)z_pathclsz_drvz_rootz_parts) r;r<r=r>Ú __slots__r%rÒrÖrØrrrrrÍs    rÍc@s\eZdZdZdXZd d „Zd d „Zed d„ƒZeddd„ƒZ eddd„ƒZ edd„ƒZ dd„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_cpartscGs7|tkr*tjdkr!tnt}n|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^rrrrÚ _from_parts)rµrŒrrrÚ__new__9s zPurePath.__new__cCs|jt|jƒfS)N)Ú __class__ÚtuplerÑ)r$rrrÚ __reduce__CszPurePath.__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_argsHs zPurePath._parse_argsTcCsYtj|ƒ}|j|ƒ\}}}||_||_||_|rU|jƒn|S)N)ÚobjectrßrårÏrÐrÑÚ_init)rµrŒÚinitr$r2r3r1rrrrÞYs    zPurePath._from_partscCsAtj|ƒ}||_||_||_|r=|jƒn|S)N)rærßrÏrÐrÑrç)rµr2r3r1rèr$rrrrÔfs    zPurePath._from_parsed_partscCsB|s |r.|||jj|dd…ƒS|jj|ƒSdS)Nr8)rÇr#)rµr2r3r1rrrÚ_format_parsed_partsps "zPurePath._format_parsed_partscCsdS)Nr)r$rrrrçwszPurePath._initcCs^|j|ƒ\}}}|jj|j|j|j|||ƒ\}}}|j|||ƒS)N)rårÇr:rÏrÐrÑrÔ)r$rŒr2r3r1rrrÚ _make_child{s *zPurePath._make_childc CsRy |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ƒ‚n|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_uric CsCy |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__c CsCy |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$r1rrrrrÔs *z PurePath.namecCsT|j}|jdƒ}d|ko9t|ƒdknrL||d…SdSdS)z*The final component's last suffix, if any.r'rr8Nr&)rrÚrfindrQ)r$rrrIrrrÚ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)rCrýrrrr[ís z%PurePath.suffixes..r8N)rrÚendswithrSr,)r$rrrrrÚsuffixesæs  zPurePath.suffixescCsT|j}|jdƒ}d|ko9t|ƒdknrL|d|…S|SdS)z0The final path component, minus its last suffix.r'rr8N)rrrürQ)r$rrrIrrrÚstemïs  &z PurePath.stemcCsÄ|jstd|fƒ‚n|jj|fƒ\}}}| s„|d|jj|jjgks„|s„|s„t|ƒdkr—td|ƒ‚n|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) rrr°rÇr7r"r(rQrÔrÏrÐrÑ)r$rrr2r3r1rrrÚ with_nameùs )zPurePath.with_namecCs|j}|j|ks0|jrC|j|krCtd|ƒ‚n|rY|jdƒ se|dkrxtd|ƒ‚n|j}|s�td|fƒ‚n|j}|s¹||}n|dt|ƒ …|}|j|j |j |j dd…|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°rdrrrýrQrÔrÏrÐrÑ)r$rýrìrrZ old_suffixrrrÚ with_suffixs '"   zPurePath.with_suffixc GsW|stdƒ‚n|j}|j}|j}|rS||g|dd…}n|}|j|ƒ\}}}|r”||g|dd…} n|} t| ƒ} |jj} | dkrÊ|pé|n| |d| …ƒ| | ƒkr(|j|||ƒ} t dj t |ƒt | ƒƒƒ‚n|j d| dkrC|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_tos(      : zPurePath.relative_toc Cs=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$rrrr17s   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ÚjoinpathCszPurePath.joinpathcCs|j|fƒS)N)rê)r$ÚkeyrrrÚ __truediv__KszPurePath.__truediv__cCs|j|g|jƒS)N)rÞrÑ)r$rrrrÚ __rtruediv__NszPurePath.__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ÚparentQs    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ÇroÚ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$rrrrhgszPurePath.is_reservedc Cs/|jj}||ƒ}|jj|fƒ\}}}|sKtdƒ‚n|rj|||jƒkrjdS|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ÅZ fnmatchcase) r$Z path_patternrÉr2r3Z pat_partsr1r5rrrrrÈls(    (zPurePath.matchN)z_drvz_rootz_partsz_strz_hashz_ppartsz_cached_cparts)/r;r<r=r>rÙrßrâÚ classmethodrårÞrÔrérçrêrërjrîrØrïÚpropertyrðrórõrör÷rørùrrir3rûrrrýrÿrrrrr1rrrr r r…rhrÈrrrrr-s\                            c@seZdZeZfZdS)rN)r;r<r=Ú_posix_flavourrÇrÙrrrrr†s c@seZdZeZfZdS)rN)r;r<r=Ú_windows_flavourrÇrÙrrrrr‹s c@sóeZdZdRZdd„Zddd„Zdd „Zd d „Zd d „Zdd„Z ddd„Z ddd„Z e dd„ƒZ dd„Zdd„Zdd„Zdd„Zd d!„Zd"d#„Zd$d%„Zd&d'„Zd(dSdddd*d+„Zdd,d-d.„Zdd/d0d1„Zd2d3„Zd4d5„Zd6d7„Zd8d9„Zd:d;„Zd<d=„Zd>d?„Zd/d@dA„Z dBdC„Z!dDdE„Z"dFdG„Z#dHdI„Z$dJdK„Z%dLdM„Z&dNdO„Z'dPdQ„Z(dS)Trr„Ú_closedcOsr|tkr*tjdkr!tnt}n|j|ddƒ}|jjsdtd|j fƒ‚n|j ƒ|S)NrrèFz$cannot instantiate %r on your system) rr^rrrrrÞrÇrsr•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ƒn|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$rrÚflagsr–rrrÚ_opener¾sz Path._openeriÿcCs,|jr|jƒn|jj|||ƒS)zm Open the file pointed by this path and return a file descriptor, as os.open() does. )rrr„rœ)r$rr–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.cwdccsm|jr|jƒnxP|jj|ƒD]<}|dkrAq)n|j|ƒV|jr)|jƒq)q)WdS)zyIterate over the files in this directory. Does not yield any result for the special paths '.' and '..'. r'ú..N>rr')rrr„r�rÁ)r$rrrrrÚiterdirÔs    z Path.iterdirccs€|jj|ƒ}|jj|fƒ\}}}|s<|rKtdƒ‚ntt|ƒƒ}x|j|ƒD] }|VqmWdS)zˆIterate over this subtree and yield all existing files (of any kind, including directories) matching the given pattern. z%Non-relative patterns are unsupportedN)rÇr9r7r•r¶rárÀ)r$Úpatternr2r3r³ÚselectorrZrrrÚglobâs z Path.globccs„|jj|ƒ}|jj|fƒ\}}}|s<|rKtdƒ‚ntdt|ƒƒ}x|j|ƒD] }|VqqWdS)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)r$)rÇr9r7r•r¶rárÀ)r$r!r2r3r³r"rZrrrÚrglobîs z Path.rglobcCs_|jr|jƒn|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ƒn|jj|ƒ}|dkrS|jƒt|jƒƒ}n|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]r'rqÚnormpathrÞrç)r$rYZnormedr&rrrrb s    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š sz Path.statcCs%ddl}|j|jƒjƒjS)z: Return the login name of the file owner. rN)ÚpwdÚgetpwuidršÚst_uidZpw_name)r$r)rrrÚowner's z Path.ownercCs%ddl}|j|jƒjƒjS)z8 Return the group name of the file gid. rN)ÚgrpZgetgrgidršÚst_gidZgr_name)r$r-rrrÚgroup.s z Path.groupÚrr8c CsA|jr|jƒntjt|ƒ|||||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œ5s  !z Path.openTc Cs˜|jr|jƒn|rOy|jj|dƒWntk rGYqOXdSntjtjB}|su|tjO}n|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.touchFcCs°|jr|jƒn|s2|jj||ƒnzy|jj||ƒWn`tk r«}z@|jtkrs‚n|jjddƒ|jj||ƒWYdd}~XnXdS)Nr T)rrr„r r{r|rr )r$r–r r€rrrr Ws  z Path.mkdircCs-|jr|jƒn|jj||ƒdS)zF Change the permissions of the path, like os.chmod(). N)rrr„rž)r$r–rrrržes  z Path.chmodcCs-|jr|jƒn|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”ms  z Path.lchmodcCs*|jr|jƒn|jj|ƒdS)zd Remove this file or link. If the path is a directory, use rmdir() instead. N)rrr„r¡)r$rrrr¡vs  z Path.unlinkcCs*|jr|jƒn|jj|ƒdS)zF Remove this directory. The directory must be empty. N)rrr„r¢)r$rrrr¢s  z Path.rmdircCs&|jr|jƒn|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ƒn|jj||ƒdS)z5 Rename this path to the given path. N)rrr„r£)r$rrrrr£�s  z Path.renamecCs-|jr|jƒn|jj||ƒdS)zo Rename this path to the given path, clobbering the existing destination if it exists. N)rrr„r*)r$rrrrr*˜s  z Path.replacecCs0|jr|jƒn|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$rr˜rrrÚ symlink_to¡s  zPath.symlink_tocCsYy|jƒWnDtk rT}z$|jttfkr>‚ndSWYdd}~XnXdS)z+ Whether this path exists. FNT)ršr{r|rr)r$r€rrrr½¬sz Path.existscCsbyt|jƒjƒSWnDtk r]}z$|jttfkrG‚ndSWYdd}~XnXdS)z3 Whether this path is a directory. FN)rršÚst_moder{r|rr)r$r€rrrr¼¸s z Path.is_dircCsbyt|jƒjƒSWnDtk r]}z$|jttfkrG‚ndSWYdd}~XnXdS)zq Whether this path is a regular file (also True for symlinks pointing to regular files). FN)r ršr>r{r|rr)r$r€rrrÚis_fileÅs z Path.is_filecCsbyt|jƒjƒSWnDtk r]}z$|jttfkrG‚ndSWYdd}~XnXdS)z7 Whether this path is a symbolic link. FN)r r›r>r{r|rr)r$r€rrrrÊÓs zPath.is_symlinkcCsbyt|jƒjƒSWnDtk r]}z$|jttfkrG‚ndSWYdd}~XnXdS)z6 Whether this path is a block device. FN)r ršr>r{r|rr)r$r€rrrÚis_block_deviceßs zPath.is_block_devicecCsbyt|jƒjƒSWnDtk r]}z$|jttfkrG‚ndSWYdd}~XnXdS)z: Whether this path is a character device. FN)r ršr>r{r|rr)r$r€rrrÚis_char_deviceìs zPath.is_char_devicecCsbyt|jƒjƒSWnDtk r]}z$|jttfkrG‚ndSWYdd}~XnXdS)z. Whether this path is a FIFO. FN)rršr>r{r|rr)r$r€rrrÚis_fifoùs z Path.is_fifocCsbyt|jƒjƒSWnDtk r]}z$|jttfkrG‚ndSWYdd}~XnXdS)z0 Whether this path is a socket. FN)r ršr>r{r|rr)r$r€rrrÚ is_sockets zPath.is_socket)z _accessorz_closedrN))r;r<r=rÙrßrçrÁrrrrrr rr r#r%r'rbršr,r/rœr<r ržr”r¡r¢r›r£r*r=r½r¼r?rÊr@rArBrCrrrrr“sN                     c@seZdZfZdS)rN)r;r<r=rÙrrrrrs c@seZdZfZdS)rN)r;r<r=rÙrrrrrs )=rÅr�r1rpr^rˆrÃr.Ú collectionsrÚ contextlibrr|rrrÚoperatorrršrr r r r r rZ urllib.parserrkr¤rrrZgetwindowsversionrÚ__all__r rær!r?rwrrr‰rŠrr®r¶rŸr·r¸rºr²r±r¯rÍrrrrrrrrrrÚsd        4 "   ?zS  ;  'ÿZÿ‚