
    }cn                         d dl Z d dlZd dlZd dlZd dlmZmZmZmZ  ej	                    p ej
                    ZdefdZ e            Z G d de          ZdS )    N)IOAnyCallableListreturnc                  V    t          j        d          } t          j        |            | S )zGet current umask valuer   )osumask)r
   s    3lib/python3.11/site-packages/sphinx/testing/path.pygetumaskr   
   s!    HQKKEHUOOOL    c            	           e Zd ZdZed.d            ZdefdZd.dZde	fdZ
de	fdZde	fdZde	fd	Zde	fd
Zd/de	deddfdZd0dede	ddfdZdeddfdZeZd1dZdefdZdeddfdZd2dededefdZd3dedededdfdZd3dededefd Zdej        fd!Zd0d"ed#e	ddfd$Zde	fd%Z de	fd&Z!d4de"d(e	ddfd)Z#d*edd fd+Z$de%e         fd,Z&e$xZ'Z(def fd-Z) xZ*S )5pathz8
    Represents a path which behaves like a string.
    r   c                 f    |                      t          j                            |                     S )zH
        The name of the directory the file or directory is in.
        )	__class__r	   r   dirnameselfs    r   parentzpath.parent   s$    
 ~~bgood33444r   c                 @    t           j                            |           S N)r	   r   basenamer   s    r   r   zpath.basename!   s    w%%%r   c                 f    |                      t          j                            |                     S )z,
        Returns the absolute path.
        )r   r	   r   abspathr   s    r   r   zpath.abspath$   s$     ~~bgood33444r   c                 @    t           j                            |           S )z;
        Returns ``True`` if the path is absolute.
        )r	   r   isabsr   s    r   r   z
path.isabs*        w}}T"""r   c                 @    t           j                            |           S )z>
        Returns ``True`` if the path is a directory.
        )r	   r   isdirr   s    r   r   z
path.isdir0   r   r   c                 @    t           j                            |           S )z9
        Returns ``True`` if the path is a file.
        )r	   r   isfiler   s    r   r!   zpath.isfile6        w~~d###r   c                 @    t           j                            |           S )zB
        Returns ``True`` if the path is a symbolic link.
        )r	   r   islinkr   s    r   r$   zpath.islink<   r"   r   c                 @    t           j                            |           S )z@
        Returns ``True`` if the path is a mount point.
        )r	   r   ismountr   s    r   r&   zpath.ismountB   s     wt$$$r   FNignore_errorsonerrorc                 4    t          j        | ||           dS )al  
        Removes the file or directory and any files or directories it may
        contain.

        :param ignore_errors:
            If ``True`` errors are silently ignored, otherwise an exception
            is raised in case an error occurs.

        :param onerror:
            A callback which gets called with the arguments `func`, `path` and
            `exc_info`. `func` is one of :func:`os.listdir`, :func:`os.remove`
            or :func:`os.rmdir`. `path` is the argument to the function which
            caused it to fail and `exc_info` is a tuple as returned by
            :func:`sys.exc_info`.
        )r'   r(   N)shutilrmtree)r   r'   r(   s      r   r+   zpath.rmtreeH   s!      	d-IIIIIIr   destinationsymlinksc                 j   t          j        | ||           t          j                            d          rzt          j        |          D ]g\  }}}t          j        |dt           z             |D ]>}t          j        t          j        	                    ||          dt           z             ?fdS dS )a~  
        Recursively copy a directory to the given `destination`. If the given
        `destination` does not exist it will be created.

        :param symlinks:
            If ``True`` symbolic links in the source tree result in symbolic
            links in the destination tree otherwise the contents of the files
            pointed to by the symbolic links are copied.
        )r-   SPHINX_READONLY_TESTDIRi  i  N)
r*   copytreer	   environgetwalkchmodUMASKr   join)r   r,   r-   root_dirsfilesnames          r   r0   zpath.copytreeZ   s     	kH====:>>344 		G ')gk&:&: G G"eUuv~...! G GDHRW\\$55uv~FFFFG		G 		GG Gr   c                 0    t          j        | |           dS )z
        Recursively move the file or directory to the given `destination`
        similar to the  Unix "mv" command.

        If the `destination` is a file it may be overwritten depending on the
        :func:`os.rename` semantics.
        N)r*   move)r   r,   s     r   movetreezpath.movetreep   s     	D+&&&&&r   c                 .    t          j        |            dS )z!
        Removes a file.
        N)r	   unlinkr   s    r   r?   zpath.unlink|   s     		$r   c                 *    t          j        |           S )z-
        Returns a stat of the file.
        )r	   statr   s    r   rA   z	path.stat   s     wt}}r   argc                 0    t          j        | |           d S r   )r	   utime)r   rB   s     r   rD   z
path.utime   s    
sr   rmodekwargsc                     t          | |fi |S r   )open)r   rF   rG   s      r   rI   z	path.open   s    D$))&)))r   utf-8textencodingc                     t          | dfd|i|5 }|                    |           ddd           dS # 1 swxY w Y   dS )z6
        Writes the given `text` to the file.
        wrL   NrI   write)r   rK   rL   rG   fs        r   
write_textzpath.write_text   s     $99h9&99 	QGGDMMM	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s   488c                 |    t          | fd|i|5 }|                                cddd           S # 1 swxY w Y   dS )z/
        Returns the text in the file.
        rL   NrI   read)r   rL   rG   rQ   s       r   	read_textzpath.read_text   s     $444V44 	6688	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s   155c                     t          | d          5 }|                                cddd           S # 1 swxY w Y   dS )z0
        Returns the bytes in the file.
        rbrF   NrT   )r   rQ   s     r   
read_byteszpath.read_bytes   s     $T""" 	a6688	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s   377bytesappendc                     |rd}nd}t          | |          5 }|                    |           ddd           dS # 1 swxY w Y   dS )z
        Writes the given `bytes` to the file.

        :param append:
            If ``True`` given `bytes` are added at the end of the file.
        abwbrY   NrO   )r   r[   r\   rF   rQ   s        r   write_byteszpath.write_bytes   s      	DDD$T""" 	aGGENNN	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s   <A A c                 @    t           j                            |           S )z5
        Returns ``True`` if the path exist.
        )r	   r   existsr   s    r   rb   zpath.exists   r"   r   c                 @    t           j                            |           S )zb
        Returns ``True`` if the path exists unless it is a broken symbolic
        link.
        )r	   r   lexistsr   s    r   rd   zpath.lexists   s    
 wt$$$r     exist_okc                 4    t          j        | ||           dS )z1
        Recursively create directories.
        )rf   N)r	   makedirs)r   rF   rf   s      r   rh   zpath.makedirs   s!     	D$222222r   argsc           	      |    |                      t          j        j        | gt	          | j         |          R            S )zP
        Joins the path with the argument given and returns the result.
        )r   r	   r   r6   map)r   ri   s     r   joinpathzpath.joinpath   s6     ~~bgl4L#dnd2K2KLLLMMMr   c                 *    t          j        |           S r   )r	   listdirr   s    r   rn   zpath.listdir   s    z$r   c                 d    | j         j        dt                                                      dS )N())r   __name__super__repr__)r   r   s    r   rt   zpath.__repr__   s/    >222EGG4D4D4F4F4F4FGGr   )r   r   )FN)F)r   N)rE   )rJ   )re   F)+rr   
__module____qualname____doc__propertyr   strr   r   boolr   r   r!   r$   r&   r   r+   r0   r=   r<   r?   r   rA   rD   r   rI   rR   rV   builtinsr[   rZ   r`   rb   rd   intrh   rl   r   rn   __div____truediv__rt   __classcell__)r   s   @r   r   r      s         5 5 5 X5&# & & & &5 5 5 5#t # # # ##t # # # #$ $ $ $ $$ $ $ $ $% % % % %J JD J8 Jt J J J J$G GC G4 GD G G G G,'C 'D ' ' ' ' D   c         * * *c *b * * * * s c s t     # 3 3    HN      d t    $ $ $ $ $% % % % %3 3S 3D 3T 3 3 3 3Nc Nf N N N N c         %$GkH# H H H H H H H H H Hr   r   )r{   r	   r*   systypingr   r   r   r   getfilesystemencodinggetdefaultencodingFILESYSTEMENCODINGr|   r   r5   ry   r    r   r   <module>r      s     				  



 * * * * * * * * * * * *.S.00L4JC4J4L4L #     	

{H {H {H {H {H3 {H {H {H {H {Hr   