o
    X|Äj~  ã                   @   sœ   d Z ddlZddlZg d¢Zdd„ Zdd„ Zdd	„ Zd
d„ Zdd„ Zdd„ Z	dd„ Z
dd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ ZejG dd„ dƒƒZdS ) z˜
Path operations common to more than one OS
Do not use directly.  The OS specific modules import the appropriate
functions from this module themselves.
é    N)ÚcommonprefixÚexistsÚgetatimeÚgetctimeÚgetmtimeÚgetsizeÚisdirÚisfileÚsamefileÚsameopenfileÚsamestatÚALLOW_MISSINGc              	   C   s*   zt  | ¡ W dS  ttfy   Y dS w )zDTest whether a path exists.  Returns False for broken symbolic linksFT)ÚosÚstatÚOSErrorÚ
ValueError)Úpath© r   ú(/usr/local/lib/python3.10/genericpath.pyr      s   þÿr   c              	   C   ó4   zt  | ¡}W n ttfy   Y dS w t |j¡S )z%Test whether a path is a regular fileF)r   r   r   r   ÚS_ISREGÚst_mode)r   Ústr   r   r   r	      ó   ÿr	   c              	   C   r   )z<Return true if the pathname refers to an existing directory.F)r   r   r   r   ÚS_ISDIRr   )Úsr   r   r   r   r   '   r   r   c                 C   ó   t  | ¡jS )z1Return the size of a file, reported by os.stat().)r   r   Úst_size©Úfilenamer   r   r   r   0   ó   r   c                 C   r   )zCReturn the last modification time of a file, reported by os.stat().)r   r   Úst_mtimer   r   r   r   r   5   r    r   c                 C   r   )z=Return the last access time of a file, reported by os.stat().)r   r   Úst_atimer   r   r   r   r   :   r    r   c                 C   r   )zAReturn the metadata change time of a file, reported by os.stat().)r   r   Úst_ctimer   r   r   r   r   ?   r    r   c                 C   sl   | sdS t | d ttfƒstttj| ƒƒ} t| ƒ}t| ƒ}t|ƒD ]\}}||| kr3|d|…   S q!|S )zGGiven a list of pathnames, returns the longest common leading componentÚ r   N)	Ú
isinstanceÚlistÚtupleÚmapr   ÚfspathÚminÚmaxÚ	enumerate)ÚmÚs1Ús2ÚiÚcr   r   r   r   E   s   ÿr   c                 C   s   | j |j ko| j|jkS )z5Test whether two stat buffers reference the same file)Úst_inoÚst_dev)r.   r/   r   r   r   r   W   s   
ÿr   c                 C   ó   t  | ¡}t  |¡}t||ƒS )zÕTest whether two pathnames reference the same actual file or directory

    This is determined by the device number and i-node number and
    raises an exception if an os.stat() call on either pathname fails.
    )r   r   r   )Zf1Zf2r.   r/   r   r   r   r
   ^   s   


r
   c                 C   r4   )z:Test whether two open file objects reference the same file)r   Úfstatr   )Zfp1Zfp2r.   r/   r   r   r   r   k   s   


r   c                 C   s�   |   |¡}|r|   |¡}t||ƒ}|   |¡}||kr@|d }||k r@| ||d … |kr8| d|… | |d… fS |d7 }||k s"| | dd… fS )z¤Split the extension from a pathname.

    Extension is everything from the last dot to the end, ignoring
    leading dots.  Returns "(root, ext)"; ext may be empty.é   Nr   )Úrfindr+   )ÚpÚsepÚaltsepÚextsepZsepIndexZaltsepIndexZdotIndexZfilenameIndexr   r   r   Ú	_splitexty   s   



ýr<   c                 G   sb   d }}|D ]}t |tƒrd}qt |tƒrd}qt| › d|jj›�ƒd ‚|r-|r/tdƒd ‚d S d S )NFTz;() argument must be str, bytes, or os.PathLike object, not z.Can't mix strings and bytes in path components)r%   ÚstrÚbytesÚ	TypeErrorÚ	__class__Ú__name__)ZfuncnameÚargsZhasstrZhasbytesr   r   r   r   Ú_check_arg_types�   s   

ÿÿ
ÿrC   c                   @   s    e Zd ZdZdd„ Zdd„ ZdS )r   z$Special value for use in realpath().c                 C   s   dS )Nzos.path.ALLOW_MISSINGr   ©Úselfr   r   r   Ú__repr__¡   s   zALLOW_MISSING.__repr__c                 C   s   | j jS )N)r@   rA   rD   r   r   r   Ú
__reduce__£   s   zALLOW_MISSING.__reduce__N)rA   Ú
__module__Ú__qualname__Ú__doc__rF   rG   r   r   r   r   r   ž   s    r   )rJ   r   r   Ú__all__r   r	   r   r   r   r   r   r   r   r
   r   r<   rC   ÚobjectÚ__new__r   r   r   r   r   Ú<module>   s&    	