
    b@h/C                     F   d Z dZdZdZdZdZdZdZdZddl	Z	ddl
Z
ddlZddlZdd	lT g d
Zd Zd Zd Zd Zd Zd Zej        j         e_         d Zd Zd Zd Zd Zd Zd Zdadad Z	 ddlm Z  d Z!n# e"$ r d Z!Y nw xY wd Z#dddZ$d  Z%e
j&        d!k    Z'd$d"Z(d# Z)dS )%a  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_MISSINGc                 4    t          | t                    rdS dS )N   /r   )
isinstancebytespaths      /home/conda/feedstock_root/build_artifacts/python-split_1749047345446/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib/python3.11/posixpath.py_get_sepr6   )   s    $ ts    c                 *    t          j        |           S )z6Normalize case of pathname.  Has no effect under Posixosfspath)ss    r5   r   r   4   s    9Q<<r7   c                 r    t          j        |           } t          |           }|                     |          S )zTest whether a path is absolute)r:   r;   r6   
startswith)r<   r$   s     r5   r	   r	   <   s,    
	!A
1++C<<r7   c                    t          j        |           } t          |           }| }	 |s|dd         |z    t          t           j        |          D ]?}|                    |          r|}|r|                    |          r||z  }7|||z   z  }@n/# t          t          t          f$ r t          j
        d| g|R    w xY w|S )zJoin 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.Nr   r
   )r:   r;   r6   mapr>   endswith	TypeErrorAttributeErrorBytesWarninggenericpath_check_arg_types)apr$   r4   bs        r5   r
   r
   G   s    
 		!A
1++CD 	!HsNNRY"" 	  	 A||C      T]]3//  	a	  ~|4   $VQ33333 Ks   A)B ,B=c                    t          j        |           } t          |           }|                     |          dz   }| d|         | |d         }}|r+||t	          |          z  k    r|                    |          }||fS )zSplit a pathname.  Returns tuple "(head, tail)" where "tail" is
    everything after the final slash.  Either part may be empty.   Nr:   r;   r6   rfindlenrstrip)rH   r$   iheadtails        r5   r   r   d   s     		!A
1++C	qA2A2!""$D  CII%%{{3:r7   c                     t          j        |           } t          | t                    rd}d}nd}d}t	          j        | |d |          S )Nr0      .r   r   )r:   r;   r1   r2   rE   	_splitext)rH   r$   r(   s      r5   r   r   u   sN    
	!A!U  Cv666r7   c                 B    t          j        |           } | dd         | fS )zJSplit a pathname into drive and path. On Posix, drive is always
    empty.Nr   r9   )rH   s    r5   r   r      s"     		!ARaR5!8Or7   c                     t          j        |           } t          |           }|                     |          dz   }| |d         S )z)Returns the final component of a pathnamerK   N)r:   r;   r6   rM   )rH   r$   rP   s      r5   r   r      s;    
	!A
1++C	qAQRR5Lr7   c                     t          j        |           } t          |           }|                     |          dz   }| d|         }|r+||t	          |          z  k    r|                    |          }|S )z-Returns the directory component of a pathnamerK   NrL   )rH   r$   rP   rQ   s       r5   r   r      sm    
	!A
1++C	qARaR5D  CII%%{{3Kr7   c                     	 t          j        |           }n# t          t          t          f$ r Y dS w xY wt          j        |j                  S )z&Test whether a path is a symbolic linkF)r:   lstatOSError
ValueErrorrC   statS_ISLNKst_mode)r4   sts     r5   r   r      sQ    Xd^^Z0   uu<
###s    22c                 b    	 t          j        |            n# t          t          f$ r Y dS w xY wdS )zCTest whether a path exists.  Returns True for broken symbolic linksFT)r:   rZ   r[   r\   r3   s    r5   r   r      sB    
Z    uu4s    ,,c                    	 t          j        |           }t          j        |j                  rdS n# t
          t          f$ r Y dS w xY wt          j        |           } t          | t                    rt          | d          }nt          | d          }t          |          }	 t          j        |          }n# t
          t          f$ r Y dS w xY w|j        }|j        }||k    rdS |j        }|j        }||k    rdS dS )z$Test whether a path is a mount pointF   ..r   T)r:   rZ   r]   r^   r_   r[   r\   r;   r1   r2   r
   r*   st_devst_ino)r4   s1parents2dev1dev2ino1ino2s           r5   r   r      s'   Xd^^ <
## 	5	 Z    uu 9T??D$ "dE""dD!!fFXfZ    uu 9D9Dt||t9D9Dt||t5s!   2 AA$B9 9CCc                    t          j        |           } t          | t                    rd}nd}|                     |          s| S t          |           }|                     |d          }|dk     rt          |           }|dk    rxdt           j        vrW	 ddl	}n# t          $ r | cY S w xY w	 |                    t          j                              j        }n# t          $ r | cY S w xY wt           j        d         }nw	 ddl	}n# t          $ r | cY S w xY w| d|         }t          |t                    rt          |d          }	 |                    |          }n# t          $ r | cY S w xY w|j        }|t"          j        dk    r| S t          | t                    rt          j        |          }d	}nd
}|                    |          }|| |d         z   p|S )zOExpand ~ and ~user constructions.  If user or $HOME is unknown,
    do nothing.   ~~rK   r   HOMENASCIIvxworksr0   r   )r:   r;   r1   r2   r>   r6   findrN   environpwdImportErrorgetpwuidgetuidpw_dirKeyErrorstrgetpwnamsysplatformfsencoderO   )	r4   tilder$   rP   ru   userhomenamepwentroots	            r5   r   r      s3    9T??D$ ??5!! 
4..C		#qA1uuIIAvv##



   <<	44;    
 z&)HH	JJJJ 	 	 	KKK	 AaCydE"" 	&tW%%D	LL&&EE 	 	 	 KKK	 <CLI55$ ;x((t$$HtABBx(D(sH   B B)(B)-+C C('C(?D DDE E+*E+c                 v   t          j        |           } t          | t                    rSd| vr| S t          sddl}|                    d|j                  at          j        }d}d}t          t           dd          }nHd| vr| S t          sddl}|                    d	|j                  a
t          j        }d
}d}t           j        }d}	  || |          }|sn|                    d          \  }}|                    d          }	|	                    |          r|	                    |          r
|	dd         }		 |7t          j        t           j        t          j        |	                             }
n||	         }
| |d         }| d|         |
z   } t%          |           }| |z  } n# t&          $ r |}Y nw xY w| S )zZExpand shell variables of form $var and ${var}.  Unknown variables
    are left unchanged.   $r   Ns   \$(\w+|\{[^}]*\})   {   }environb$z\$(\w+|\{[^}]*\}){}TrK   )r:   r;   r1   r2   	_varprogbrecompilerq   searchgetattr_varprogrt   spangroupr>   rA   r   fsdecoderN   rz   )r4   r   r   startendrt   rP   mjr   valuerR   s               r5   r   r   %  s    9T??D$ tK 	DIII

#8"(CCI!"j$//d??K 	BIIIzz"6AAH*	AF4OO 	vvayy1wwqzz??5!! 	dmmC&8&8 	":D	BJr{4/@/@$ABB 8D8e#DD		ADLDD  	 	 	AAA	( Ks   9AF& &F54F5)_path_normpathc                     t          j        |           } t          | t                    r5t          j        t          t          j        |                               pdS t          |           pdS )0Normalize path, eliminating double slashes, etc.rT   r   )r:   r;   r1   r2   r   r   r   r3   s    r5   r   r     s\    ydE"" 	J;~bk$.?.?@@AAITId##*s*r7   c                 0   t          j        |           } t          | t                    r	d}d}d}d}nd}d}d}d}| |k    r|S |                     |          }|r2|                     |d	z            r|                     |d
z            sd	}|                     |          }g }|D ]M}|||fv r	||k    s|s|r|r"|d         |k    r|                    |           7|r|                                 N|}|                    |          } |r||z  | z   } | p|S )r   r0   r7   rT   rc   r    r   r         r   )	r:   r;   r1   r2   r>   r   appendpopr
   )	r4   r$   emptydotdotdotinitial_slashescomps	new_compscomps	            r5   r   r   ^  sh   ydE"" 		CECFFCECF5==J//#..  	 OOCE""	 +/??3q5+A+A	 O

3	 	  	 Ds|##y  )" 7 7  &&&&  xx 	.&-D{sr7   c                     t          j        |           } t          |           sLt          | t                    rt          j                    }nt          j                    }t          ||           } t          |           S )zReturn an absolute path.)	r:   r;   r	   r1   r2   getcwdbgetcwdr
   r   )r4   cwds     r5   r   r     s`    9T??D;; dE"" 	*,,CC)++CCD>>r7   F)strictc                    t          j        |           } t          | dd         | |i           \  }}t          |          S )zlReturn the canonical path of the specified filename, eliminating any
symbolic links encountered in the path.Nr   )r:   r;   _joinrealpathr   )filenamer   r4   oks       r5   r*   r*     s>     y""HXbqb\8VR@@HD"4==r7   c                 0   t          | t                    rd}d}d}nd}d}d}t          j        }|t          u rt
          }n|rd}nt          }d }	t          |          r|dd          }|} |r(|                    |          \  }
}}|
r|
|k    r%|
|k    r/| r*t          |           \  } }
|
|k    rt          | ||          } n|} Zt          | |
          }	 t          j        |          }t          j        |j                  }n# |$ r d	}Y nw xY w|s|} ||v r4||         } | |rt          j        |           nt          ||          d	fS d ||<   t          | t          j        |          ||          \  } }|st          | |          d	fS | ||<   |(| d
fS )Nr0   rT   rc   r   r   r    rK   FT)r1   r2   r:   r   r.   FileNotFoundErrorr[   r	   	partitionr   r
   rZ   r]   r^   r_   r   readlink)r4   restr   seenr$   r"   r#   r   ignored_errormaxlinksr   _newpathr`   is_linkr   s                   r5   r   r     s    $ )	  HT{{ ABBx
 *s++a 	tv~~6>> "4[[
d6>>ff55DtT""	/'""B l2:..GG  	 	 	GGG	  	Dd??=D 2     GT**E11W r{7';';VTJJb 	+d##U**WU  *X :s   D DDdarwinc                 |   | st          d          t          j        |           } t          | t                    rd}d}d}nd}d}d}||}nt          j        |          }	 d	 t          |                              |          D             }d
 t          |                               |          D             }t          t          ||g                    }|gt          |          |z
  z  ||d         z   }|s|S t          | S # t          t          t          t          f$ r t          j        d| |            w xY w)z#Return a relative version of a pathzno path specifiedrT   r0   rc   r   r   r   Nc                     g | ]}||S r   r   .0xs     r5   
<listcomp>zrelpath.<locals>.<listcomp>  s    @@@Aa@a@@@r7   c                     g | ]}||S r   r   r   s     r5   r   zrelpath.<locals>.<listcomp>  s    >>>1A>Q>>>r7   r,   )r\   r:   r;   r1   r2   r   r   rN   r   r
   rB   rC   rD   DeprecationWarningrE   rF   )	r4   r   r"   r$   r#   
start_list	path_listrP   rel_lists	            r5   r,   r,     sZ     .,---9T??D$ }	%  @@!5!5c!:!:@@@
>> 3 3C 8 8>>>	j)455668s:q01IabbMA 	MX~|5GH   $Ye<<<s   "BD =D 5D;c                   	
 | st          d          t          t          t          j        |                     } t          | d         t                    rd
d	nd
d		 
fd| D             }	 t          
fd| D                       \  }n# t           $ r t          d	          d
w xY w	fd|D             }t          |          }t          |          }|}t          |          D ]\  }}|||         k    r|d
|         } n|r
n	
d
d         }|
                    |          z   S # t          t          f$ r t          j        dg| R    w xY w)zDGiven a sequence of path names, returns the longest common sub-path.z%commonpath() arg is an empty sequencer   r0   rT   r   r   c                 :    g | ]}|                               S r   )r   )r   r4   r$   s     r5   r   zcommonpath.<locals>.<listcomp>%  s#    9994tzz#999r7   c              3   4   K   | ]}|d d         k    V  d S )NrK   r   )r   rH   r$   s     r5   	<genexpr>zcommonpath.<locals>.<genexpr>(  s/      55!2A2#555555r7   z%Can't mix absolute and relative pathsNc                 ,    g | ]}fd |D             S )c                 $    g | ]}||k    
|S r   r   )r   cr"   s     r5   r   z)commonpath.<locals>.<listcomp>.<listcomp>,  s#    :::a:a6kkkkkr7   r   )r   r<   r"   s     r5   r   zcommonpath.<locals>.<listcomp>,  s.    PPPq::::1:::PPPr7   r-   )r\   tupler@   r:   r;   r1   r2   setminmax	enumerater
   rB   rC   rE   rF   )pathssplit_pathsr	   rf   rh   commonrP   r   prefixr"   r$   s            @@r5   r-   r-     s     B@AAA#bi''((E%(E"" 99995999	P5555u55555FEE 	P 	P 	PDEE4O	P QPPPKPPPbMM 	 	DAqBqEzzBQB  *3rr7((((~&   $\:E::::s%    D, /B D, B((BD, ,%E)N)*__doc__r"   r#   r(   r$   r%   r&   r'   r)   r:   r}   r]   rE   __all__r6   r   r	   r
   r   r   rU   r   r   r   r   r   r   r   r   r   r   posixr   r   rv   r   r*   r   r~   r+   r,   r-   r   r7   r5   <module>r      sO  
 
 
			

	
 				 



         * * *        :	 	 	"7 7 7 (0 
      $ $ $    V6) 6) 6)z 	. . .j0+$$$$$$T+ + + +Q  % % %$ $ $ $ $%`	 	 	 "'     C C CL "lh6 ! ! ! !R# # # # #s   +A5 5B ?B 