grthtrhthjhtyjytjytkergtrhtrjytjerhrfh4:24 29/09/2026î   fˆ4ã%@súdZddlZddlZddlZddlZddlTdddddd d d d d ddddddddddddddddddd d!d"d#d$d%d&d'd(g%Zd)Zd*Zd)Zd+Z d,Z d-Z dZ d.Z d/d0„Zd1d„Zd2d„Zd3d„Zd4d„Zd5d „Zejje_d6d„Zd7d „Zd8d „Zd9d„Zd:d„Zd;d„Zd<d„Zdadad=d„Zd>d„Zd?d„Z d@d&„Z!dAdB„Z"ej#dCkZ$ddDd(„Z%dS)EaçCommon operations on Posix pathnames. Instead of importing this module directly, import os and refer to this module as os.path. The "os.path" name is an alias for this module on Posix systems; on other systems (e.g. Mac, Windows), os.path provides the same operations in a manner specific to that platform, and is an alias to another module (e.g. macpath, ntpath). Some of this can actually be useful on non-Posix systems too, e.g. for manipulation of the pathname component of URLs. éN)Ú*ÚnormcaseÚisabsÚjoinÚ splitdriveÚsplitÚsplitextÚbasenameÚdirnameÚ commonprefixÚgetsizeÚgetmtimeÚgetatimeÚgetctimeÚislinkÚexistsÚlexistsÚisdirÚisfileÚismountÚ expanduserÚ expandvarsÚnormpathÚabspathÚsamefileÚ sameopenfileÚsamestatÚcurdirÚpardirÚsepÚpathsepÚdefpathÚaltsepÚextsepÚdevnullÚrealpathÚsupports_unicode_filenamesÚrelpathÚ.z..ú/ú:z:/bin:/usr/binz /dev/nullcCst|tƒrdSdSdS)Nó/r))Ú isinstanceÚbytes)Úpath©r/ú./opt/alt/python34/lib64/python3.4/posixpath.pyÚ_get_sep&sr1cCs7t|ttfƒs3tdj|jjƒƒ‚n|S)z6Normalize case of pathname. Has no effect under Posixz2normcase() argument must be str or bytes, not '{}')r,r-ÚstrÚ TypeErrorÚformatÚ __class__Ú__name__)Úsr/r/r0r1s cCst|ƒ}|j|ƒS)zTest whether a path is absolute)r1Ú startswith)r7rr/r/r0r<s c Gs¾t|ƒ}|}y^xW|D]O}|j|ƒr:|}q| sP|j|ƒr]||7}q|||7}qWWnGtk r¹tdd„|f|Dƒƒr²tdƒd‚n‚YnX|S)zæJoin two or more pathname components, inserting '/' as needed. If any component is an absolute path, all previous path components will be discarded. An empty last part will result in a path that ends with a separator.css$|]}t|ttfƒVqdS)N)r,r2r-)Ú.0r7r/r/r0ú Vszjoin..z.Can't mix strings and bytes in path componentsN)r1r8Úendswithr3Úall)ÚaÚprr.Úbr/r/r0rFs        cCsxt|ƒ}|j|ƒd}|d|…||d…}}|rn||t|ƒkrn|j|ƒ}n||fS)z€Split a pathname. Returns tuple "(head, tail)" where "tail" is everything after the final slash. Either part may be empty.éN)r1ÚrfindÚlenÚrstrip)r>rÚiÚheadÚtailr/r/r0rcs  !cCs@t|tƒrd}d}n d}d}tj||d|ƒS)Nr+ó.r)r()r,r-Ú genericpathÚ _splitext)r>rr#r/r/r0rss  cCs|dd…|fS)zJSplit a pathname into drive and path. On Posix, drive is always empty.Nrr/)r>r/r/r0r€scCs-t|ƒ}|j|ƒd}||d…S)z)Returns the final component of a pathnamer@N)r1rA)r>rrDr/r/r0r ˆs cCsat|ƒ}|j|ƒd}|d|…}|r]||t|ƒkr]|j|ƒ}n|S)z-Returns the directory component of a pathnamer@N)r1rArBrC)r>rrDrEr/r/r0r ‘s  c CsBytj|ƒ}Wnttfk r1dSYnXtj|jƒS)z&Test whether a path is a symbolic linkF)ÚosÚlstatÚOSErrorÚAttributeErrorÚstatÚS_ISLNKÚst_mode)r.Ústr/r/r0ržs  c Cs.ytj|ƒWntk r)dSYnXdS)zCTest whether a path exists. Returns True for broken symbolic linksFT)rJrKrL)r.r/r/r0r¨s   cCsæytj|ƒ}Wntk r+dSYnXtj|jƒrBdSt|tƒrct|dƒ}nt|dƒ}ytj|ƒ}Wntk r�dSYnX|j }|j }||krÀdS|j }|j }||krâdSdS)z$Test whether a path is a mount pointFs..z..T) rJrKrLrNrOrPr,r-rÚst_devÚst_ino)r.Ús1ÚparentÚs2Údev1Údev2Úino1Úino2r/r/r0r´s,          c Cs‚t|tƒrd}nd}|j|ƒs1|St|ƒ}|j|dƒ}|dkrjt|ƒ}n|dkr¼dtjkr¬ddl}|j tj ƒƒj }q.tjd}nrddl}|d|…}t|tƒrùt |dƒ}ny|j |ƒ}Wntk r$|SYnX|j }t|tƒrUtj|ƒ}d}nd }|j|ƒ}|||d…p�|S) zOExpand ~ and ~user constructions. If user or $HOME is unknown, do nothing.ó~ú~r@rÚHOMENÚASCIIr+r))r,r-r8r1ÚfindrBrJÚenvironÚpwdÚgetpwuidÚgetuidÚpw_dirr2ÚgetpwnamÚKeyErrorÚfsencoderC) r.ÚtilderrDraÚuserhomeÚnameÚpwentÚrootr/r/r0rÝs:          c CsÛt|tƒrsd|kr|StsIddl}|jd|jƒantj}d}d}ttddƒ}nXd|krƒ|St s­ddl}|jd |jƒa nt j}d }d }tj }d}x|||ƒ}|síPn|j dƒ\}}|j d ƒ} | j |ƒrB| j|ƒrB| d d …} ny<|dkrstjtj tj| ƒƒ} n || } Wntk r˜|}YqÔX||d…} |d|…| }t|ƒ}|| 7}qÔW|S)zZExpand shell variables of form $var and ${var}. Unknown variables are left unchanged.ó$rNs\$(\w+|\{[^}]*\})ó{ó}Úenvironbú$z\$(\w+|\{[^}]*\})ú{ú}r@éÿÿÿÿ)r,r-Ú _varprogbÚreÚcompiler^ÚsearchÚgetattrrJÚ_varprogr`ÚspanÚgroupr8r;rgÚfsdecoderfrB) r.rvrxÚstartÚendr`rDÚmÚjrjÚvaluerFr/r/r0r sN        "   c Cs^t|tƒr*d}d}d}d}nd}d}d}d}||krR|S|j|ƒ}|r—|j|d ƒr—|j|d ƒ r—d }n|j|ƒ}g}xy|D]q}|||fkrÑq³n||ks| rë| s|r|d |kr|j|ƒq³|r³|jƒq³q³W|}|j|ƒ}|rT|||}n|p]|S) z0Normalize path, eliminating double slashes, etc.r+órGs..r)Úr(z..éér@rt)r,r-r8rÚappendÚpopr) r.rÚemptyÚdotÚdotdotÚinitial_slashesÚcompsÚ new_compsÚcompr/r/r0r>s<  '  cCsRt|ƒsHt|tƒr*tjƒ}n tjƒ}t||ƒ}nt|ƒS)zReturn an absolute path.)rr,r-rJÚgetcwdbÚgetcwdrr)r.Úcwdr/r/r0rcs   cCs,t|dd…|iƒ\}}t|ƒS)zlReturn the canonical path of the specified filename, eliminating any symbolic links encountered in the path.Nr)Ú _joinrealpathr)Úfilenamer.Úokr/r/r0r%qs"c Cs§t|tƒr$d}d}d}nd}d}d}t|ƒr[|dd…}|}nx?|rœ|j|ƒ\}}}| s^||kr•q^n||kré|rÝt|ƒ\}}||krãt|||ƒ}qãq^|}q^nt||ƒ}t|ƒs|}q^n||krK||}|dk r8q^nt||ƒdfSd||Às zrelpath..cSsg|]}|r|‘qSr/r/)r9r�r/r/r0ržÁs )Ú ValueErrorr,r-rrrBr r) r.r~rrrÚ start_listÚ path_listrDÚrel_listr/r/r0r'®s$   ""%)&Ú__doc__rJÚsysrNrHÚ__all__rrr#rr r!r"r$r1rrrrrrIrr r rrrrrzrurrrr%r“Úplatformr&r'r/r/r/r0Ú sV           ) * 4 %   3