grthtrhthjhtyjytjytkergtrhtrjytjerhrfh4:24 29/09/2026U iÛf =ã&@s^dZdZdZdZdZdZdZdZdZddl Z ddl Z ddl Z ddl Z dd l Td d d d ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/g&Z d0d1„Zd2d „Zd3d „Zd4d „Zd5d„Zd6d„Ze jje_d7d „Zd8d„Zd9d„Zd:d„Zd;d„Zdd„Zd?d„Zd@d „Z dAd,„Z!dBdC„Z"e j#dDkZ$dGdEd.„Z%dFd/„Z&dS)HaÙ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. Windows), os.path provides the same operations in a manner specific to that platform, and is an alias to another module (e.g. ntpath). Some of this can actually be useful on non-Posix systems too, e.g. for manipulation of the pathname component of URLs. Ú.ú..ú/ú:z /bin:/usr/binNz /dev/nullé)Ú*Ú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Ú commonpathcCst|tƒrdSdSdS)Nó/r)Ú isinstanceÚbytes©Úpath©r2ú./opt/alt/python38/lib64/python3.8/posixpath.pyÚ_get_sep)s r4cCs t |¡S)z6Normalize case of pathname. Has no effect under Posix©ÚosÚfspath)Úsr2r2r3r4scCst |¡}t|ƒ}| |¡S)zTest whether a path is absolute)r6r7r4Ú startswith)r8r#r2r2r3r<s c Gs¨t |¡}t|ƒ}|}z^|s,|dd…|ttj|ƒD]8}| |¡rL|}q8|rZ| |¡rd||7}q8|||7}q8Wn.tttfk r¢t j d|f|žŽ‚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.Nrr ) r6r7r4Úmapr9ÚendswithÚ TypeErrorÚAttributeErrorÚ BytesWarningÚ genericpathÚ_check_arg_types)ÚaÚpr#r1Úbr2r2r3r Gs    cCs`t |¡}t|ƒ}| |¡d}|d|…||d…}}|rX||t|ƒkrX| |¡}||fS)z€Split a pathname. Returns tuple "(head, tail)" where "tail" is everything after the final slash. Either part may be empty.éN©r6r7r4ÚrfindÚlenÚrstrip)rBr#ÚiÚheadÚtailr2r2r3r ds  cCs6t |¡}t|tƒrd}d}nd}d}t ||d|¡S)Nr-ó.rr)r6r7r.r/r?Ú _splitext)rBr#r'r2r2r3r us  cCst |¡}|dd…|fS)zJSplit a pathname into drive and path. On Posix, drive is always empty.Nrr5)rBr2r2r3r ƒs cCs,t |¡}t|ƒ}| |¡d}||d…S)z)Returns the final component of a pathnamerDN)r6r7r4rF)rBr#rIr2r2r3r Œs cCsNt |¡}t|ƒ}| |¡d}|d|…}|rJ||t|ƒkrJ| |¡}|S)z-Returns the directory component of a pathnamerDNrE)rBr#rIrJr2r2r3r–s   c Cs8zt |¡}Wntttfk r*YdSXt |j¡S)z&Test whether a path is a symbolic linkF)r6ÚlstatÚOSErrorÚ ValueErrorr=ÚstatÚS_ISLNKÚst_mode)r1Ústr2r2r3r¤s c Cs.zt |¡Wnttfk r(YdSXdS)zCTest whether a path exists. Returns True for broken symbolic linksFT)r6rNrOrPr0r2r2r3r®s c CsÀzt |¡}Wnttfk r(YdSXt |j¡r:dSt|tƒrPt |dƒ}n t |dƒ}t |ƒ}zt |¡}Wnttfk rŠYdSX|j }|j }||kr¤dS|j }|j }||kr¼dSdS)z$Test whether a path is a mount pointFó..rT) r6rNrOrPrQrRrSr.r/r r)Úst_devÚst_ino)r1Ús1ÚparentÚs2Údev1Údev2Úino1Úino2r2r2r3rºs.    c Cs<t |¡}t|tƒrd}nd}| |¡s,|St|ƒ}| |d¡}|dkrPt|ƒ}|dkr¦dtjkršddl }z|  t  ¡¡j }Wq¤t k r–|YSXn tjd}nVddl }|d|…}t|tƒrÎt|dƒ}z| |¡}Wnt k rô|YSX|j }t|tƒ�rt |¡}d}nd }| |¡}|||d…�p:|S) zOExpand ~ and ~user constructions. If user or $HOME is unknown, do nothing.ó~ú~rDrÚHOMENÚASCIIr-r)r6r7r.r/r9r4ÚfindrGÚenvironÚpwdÚgetpwuidÚgetuidÚpw_dirÚKeyErrorÚstrÚgetpwnamÚfsencoderH) r1Útilder#rIreÚuserhomeÚnameÚpwentÚrootr2r2r3räsB              c CsZt |¡}t|tƒrVd|kr |Sts:ddl}| d|j¡atj}d}d}t tddƒ}n:d|krb|St s|ddl}| d |j¡a t j}d }d }tj }d}|||ƒ}|s¦�qV|  d¡\}}|  d ¡} |  |¡rÞ|  |¡rÞ| d d …} z.|dk�rt tj t | ¡¡} n|| } Wntk �r&|}Yq”X||d…} |d|…| }t|ƒ}|| 7}q”|S)zZExpand shell variables of form $var and ${var}. Unknown variables are left unchanged.ó$rNs\$(\w+|\{[^}]*\})ó{ó}Úenvironbú$z\$(\w+|\{[^}]*\})ú{ú}rDéÿÿÿÿ)r6r7r.r/Ú _varprogbÚreÚcompilerbÚsearchÚgetattrÚ_varprogrdÚspanÚgroupr9r;rlÚfsdecoderirG) r1r{r}ÚstartÚendrdrIÚmÚjroÚvaluerKr2r2r3rsN          c Csôt |¡}t|tƒr&d}d}d}d}nd}d}d}d}||krB|S| |¡}|rp| |d ¡rp| |d ¡spd }| |¡}g}|D]J}|||fkr”q‚||ks´|s¤|r´|rÀ|d |krÀ| |¡q‚|r‚| ¡q‚|}| |¡}|rì|||}|pò|S) z0Normalize path, eliminating double slashes, etc.r-órLrUrÚrrééry) r6r7r.r/r9r ÚappendÚpopr ) r1r#ÚemptyÚdotÚdotdotÚinitial_slashesÚcompsÚ new_compsÚcompr2r2r3rNsJ    ÿ ÿ  ÿ ÿ    cCs@t |¡}t|ƒs8t|tƒr&t ¡}nt ¡}t||ƒ}t|ƒS)zReturn an absolute path.) r6r7rr.r/ÚgetcwdbÚgetcwdr r)r1Úcwdr2r2r3rts    cCs*t |¡}t|dd…|iƒ\}}t|ƒS)zlReturn the canonical path of the specified filename, eliminating any symbolic links encountered in the path.Nr)r6r7Ú _joinrealpathr)Úfilenamer1Úokr2r2r3r)ƒs c Cst|tƒrd}d}d}n d}d}d}t|ƒr<|dd…}|}|�r| |¡\}}}|r<||kr`q<||kr”|rŽt|ƒ\}}||kr’t|||ƒ}q<|}q×szrelpath..cSsg|] }|r|‘qSr2r2r¢r2r2r3r¥Øsr+)rPr6r7r.r/rr rGrr r<r=r>ÚDeprecationWarningr?r@) r1rƒr!r#r"Ú start_listÚ path_listrIÚrel_listr2r2r3r+Ás0    c s2|s tdƒ‚tttj|ƒƒ}t|dtƒr4d‰d‰nd‰d‰zƇfdd„|Dƒ}zt‡fd d „|Dƒƒ\}Wntk rŠtd ƒd ‚YnX‡fd d„|Dƒ}t|ƒ}t |ƒ}|}t |ƒD]$\}}|||krº|d |…}qàqº|rèˆn ˆd d…}|ˆ  |¡WSt t fk �r,tjd|žŽ‚YnXd S)zDGiven a sequence of path names, returns the longest common sub-path.z%commonpath() arg is an empty sequencerr-rLrrcsg|]}| ˆ¡‘qSr2)r )r£r1©r#r2r3r¥ùszcommonpath..c3s|]}|dd…ˆkVqdS)NrDr2)r£rBrªr2r3Ú üszcommonpath..z%Can't mix absolute and relative pathsNcsg|]}‡fdd„|Dƒ‘qS)csg|]}|r|ˆkr|‘qSr2r2)r£Úc©r!r2r3r¥sz)commonpath...r2)r£r8r­r2r3r¥sr,)r,)rPÚtupler:r6r7r.r/ÚsetÚminÚmaxÚ enumerater r<r=r?r@) ÚpathsÚ split_pathsrrXrZÚcommonrIr¬Úprefixr2)r!r#r3r,ês6  )N)'Ú__doc__r!r"r'r#r$r%r&r(r6ÚsysrQr?Ú__all__r4rrr r r rMr r rrrrrrrzrrrr)r˜Úplatformr*r+r,r2r2r2r3ÚsŽ ù        *25& 3  )