grthtrhthjhtyjytjytkergtrhtrjytjerhrfh4:24 29/09/2026o ®û|jµ?ã@s dZdZdZdZdZdZdZdZdZddl Z ddl Z ddl Z ddl Z dd l Tgd ¢Z d d „Zd d„Zdd„Zdd„Zdd„Zdd„Ze jje_dd„Zdd„Zdd„Zdd„Zdd „Zd!d"„Zd#d$„Zd%Zdadad&d'„Zd(d)„Z d*d+„Z!d,d-œd.d/„Z"d0d1„Z#e j$d2kZ%d7d3d4„Z&d5d6„Z'dS)8aÙ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Ú commonpathÚ ALLOW_MISSINGcCst|tƒrdSdS)Nó/r)Ú isinstanceÚbytes©Úpath©r3ú0/opt/alt/python310/lib64/python3.10/posixpath.pyÚ_get_sep)s r5cCs t |¡S)z6Normalize case of pathname. Has no effect under Posix©ÚosÚfspath)Úsr3r3r4r4s rcCst |¡}t|ƒ}| |¡S)zTest whether a path is absolute)r7r8r5Ú startswith)r9r#r3r3r4r<s  rc Gs¢t |¡}t|ƒ}|}z0|s|dd…|ttj|ƒD]}| |¡r&|}q|r-| |¡r2||7}q|||7}qW|StttfyPt j d|g|¢RŽ‚w)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 ) r7r8r5Úmapr:ÚendswithÚ TypeErrorÚAttributeErrorÚ BytesWarningÚ genericpathÚ_check_arg_types)ÚaÚpr#r2Úbr3r3r4r Gs$   ú ýþr cCs`t |¡}t|ƒ}| |¡d}|d|…||d…}}|r,||t|ƒkr,| |¡}||fS)z€Split a pathname. Returns tuple "(head, tail)" where "tail" is everything after the final slash. Either part may be empty.éN©r7r8r5ÚrfindÚlenÚrstrip)rCr#ÚiÚheadÚtailr3r3r4r ds  r cCs6t |¡}t|tƒrd}d}nd}d}t ||d|¡S)Nr.ó.rr)r7r8r/r0r@Ú _splitext)rCr#r'r3r3r4r us  r cCst |¡}|dd…|fS)zJSplit a pathname into drive and path. On Posix, drive is always empty.Nrr6)rCr3r3r4r ƒs r cCs,t |¡}t|ƒ}| |¡d}||d…S)z)Returns the final component of a pathnamerEN)r7r8r5rG)rCr#rJr3r3r4r Œs  r cCsNt |¡}t|ƒ}| |¡d}|d|…}|r%||t|ƒkr%| |¡}|S)z-Returns the directory component of a pathnamerENrF)rCr#rJrKr3r3r4r–s   rc Cs6zt |¡}Wn tttfyYdSwt |j¡S)z&Test whether a path is a symbolic linkF)r7ÚlstatÚOSErrorÚ ValueErrorr>ÚstatÚS_ISLNKÚst_mode)r2Ústr3r3r4r¤s ÿ rc Cs*zt |¡WdSttfyYdSw)zCTest whether a path exists. Returns True for broken symbolic linksFT)r7rOrPrQr1r3r3r4r®s  þÿrc CsÆzt |¡}Wn ttfyYdSwt |j¡rdSt |¡}t|t ƒr,t |dƒ}nt |dƒ}t |ƒ}zt |¡}Wn ttfyHYdSw|j }|j }||krUdS|j }|j }||kradSdS)z$Test whether a path is a mount pointFó..rT)r7rOrPrQrRrSrTr8r/r0r r)Úst_devÚst_ino)r2Ús1ÚparentÚs2Údev1Údev2Úino1Úino2r3r3r4rºs4þ     ÿrc CsHt |¡}t|tƒr d}nd}| |¡s|St|ƒ}| |d¡}|dkr(t|ƒ}|dkrQdtjvrKddl }z |  t  ¡¡j }Wn;t yJ|YSwtjd}n*ddl }|d|…}t|tƒret|dƒ}z| |¡}Wn t yw|YSw|j }|dur†tjdkr†|St|tƒr“t |¡}d }nd }| |¡}|||d…p£|S) zOExpand ~ and ~user constructions. If user or $HOME is unknown, do nothing.ó~ú~rErÚHOMENÚASCIIÚvxworksr.r)r7r8r/r0r:r5ÚfindrHÚenvironÚpwdÚgetpwuidÚgetuidÚpw_dirÚKeyErrorÚstrÚgetpwnamÚsysÚplatformÚfsencoderI) r2Útilder#rJrgÚuserhomeÚnameÚpwentÚrootr3r3r4råsJ      ý     ý   rz\$(\w+|\{[^}]*\}?)cs®t |¡}t|tƒr-d|vr|Sts ddl}| t ¡|j ¡j at}d‰d‰t tddƒ‰nd|vr3|St sAddl}| t|j ¡j a t }d‰d ‰tj ‰‡‡‡fd d „}|||ƒS) zZExpand shell variables of form $var and ${var}. Unknown variables are left unchanged.ó$rNó{ó}Úenvironbú$ú{ú}cs~|d}| ˆ¡r| ˆ¡s|dS|dd…}zˆdur+t tjt |¡¡}W|Sˆ|}W|Sty>|dYSw)NrEréÿÿÿÿ)r:r<r7rprfÚfsdecoderk)ÚmrsÚvalue©ÚendrfÚstartr3r4Úrepl8s    ü ý ÿzexpandvars..repl)r7r8r/r0Ú_varsubbÚreÚcompileÚ _varpatternÚencodercÚsubÚgetattrÚ_varsubrf)r2r†rŠr„r3r�r4rs,   rc Csôt |¡}t|tƒrd}d}d}d}nd}d}d}d}||kr!|S| |¡}|r8| |d ¡r8| |d ¡s8d }| |¡}g}|D]%}|||fvrJqA||ksZ|sR|rZ|r`|d |kr`| |¡qA|rf| ¡qA|}| |¡}|rv|||}|py|S) z0Normalize path, eliminating double slashes, etc.r.órMrVrÚrréér}) r7r8r/r0r:r ÚappendÚpopr ) r2r#ÚemptyÚdotÚdotdotÚinitial_slashesÚcompsÚ new_compsÚcompr3r3r4rOsJ    ÿ ÿ  ÿ  €  rcCs@t |¡}t|ƒst|tƒrt ¡}nt ¡}t||ƒ}t|ƒS)zReturn an absolute path.) r7r8rr/r0ÚgetcwdbÚgetcwdr r)r2Úcwdr3r3r4rvs    rF)ÚstrictcCs,t |¡}t|dd…||iƒ\}}t|ƒS)zlReturn the canonical path of the specified filename, eliminating any symbolic links encountered in the path.Nr)r7r8Ú _joinrealpathr)Úfilenamer�r2Úokr3r3r4r)…s r)cCs|t|tƒr d}d}d}n d}d}d}tj}|turt}n|r!d}nt}d} t|ƒr1|dd…}|}|rº| |¡\} } }| rA| |krBq1| |kr\|rYt |ƒ\}} | |krXt |||ƒ}n|}q1t || ƒ} zt  | ¡} Wn |ysd }Ynwt   | j¡}|s| }q1| |vr›|| }|durŒq1|r”t  | ¡nt | |ƒd fSd|| <t|t | ¡||ƒ\}}|s´t ||ƒd fS||| <|s3|d fS) Nr.rMrVrrrr3rEFT)r/r0r7r›r-ÚFileNotFoundErrorrPrÚ partitionr r rOrRrSrTržÚreadlink)r2Úrestr�Úseenr#r!r"r›Ú ignored_errorÚmaxlinksrsÚ_ÚnewpathrUÚis_linkr r3r3r4ržŽsj     €  ÿ  Ö,ržÚdarwinc Csì|stdƒ‚t |¡}t|tƒrd}d}d}nd}d}d}|dur$|}nt |¡}z9d d „t|ƒ |¡Dƒ}d d „t|ƒ |¡Dƒ}tt||gƒƒ}|gt|ƒ|||d…}|s^|WSt |ŽWSt t t t fyut d ||¡‚w) z#Return a relative version of a pathzno path specifiedrMr.rVrrrNcSóg|]}|r|‘qSr3r3©Ú.0Úxr3r3r4Ú ìózrelpath..cSr¬r3r3r­r3r3r4r°ír±r+)rQr7r8r/r0rr rHrr r=r>r?ÚDeprecationWarningr@rA) r2rƒr!r#r"Ú start_listÚ path_listrJÚrel_listr3r3r4r+Ös2    þr+c s$|stdƒ‚tttj|ƒƒ}t|dtƒrd‰d‰nd‰d‰z`‡fdd„|Dƒ}zt‡fd d „|Dƒƒ\}Wn tyBtd ƒd ‚w‡fd d„|Dƒ}t|ƒ}t |ƒ}|}t |ƒD]\}}|||krl|d |…}nqZ|rqˆnˆd d…}|ˆ  |¡WSt t fy‘tjdg|¢RŽ‚w)zDGiven a sequence of path names, returns the longest common sub-path.z%commonpath() arg is an empty sequencerr.rMrrcsg|]}| ˆ¡‘qSr3)r )r®r2©r#r3r4r°szcommonpath..c3s �|] }|dd…ˆkVqdS)NrEr3)r®rCr¶r3r4Ú s€zcommonpath..z%Can't mix absolute and relative pathsNcsg|] }‡fdd„|Dƒ‘qS)csg|] }|r|ˆkr|‘qSr3r3)r®Úc©r!r3r4r°sz)commonpath...r3)r®r9r¹r3r4r°sr,)rQÚtupler;r7r8r/r0ÚsetÚminÚmaxÚ enumerater r=r>r@rA) ÚpathsÚ split_pathsrrYr[ÚcommonrJr¸Úprefixr3)r!r#r4r,ÿs<  ÿ  þþr,)N)(Ú__doc__r!r"r'r#r$r%r&r(r7rnrRr@Ú__all__r5rrr r r rNr r rrrrrrˆrŒr…rrrr)ržror*r+r,r3r3r3r4ÚsP        +51' F  )