HEX
Server: Apache
System: Linux pdx1-shared-a1-38 6.6.104-grsec-jammy+ #3 SMP Tue Sep 16 00:28:11 UTC 2025 x86_64
User: mmickelson (3396398)
PHP: 8.1.31
Disabled: NONE
Upload Files
File: //usr/lib/python3/dist-packages/sphinx/testing/__pycache__/path.cpython-310.pyc
o


$�a��@s�dZddlZddlZddlZddlZddlZddlmZmZm	Z	m
Z
ddlmZe�
�p/e��Zdefdd�Ze�ZGdd	�d	e�ZdS)
z�
    sphinx.testing.path
    ~~~~~~~~~~~~~~~~~~~

    :copyright: Copyright 2007-2021 by the Sphinx team, see AUTHORS.
    :license: BSD, see LICENSE for details.
�N)�IO�Any�Callable�List)�RemovedInSphinx50Warning�returncCst�d�}t�|�|S)zGet current umask valuer)�os�umask)r	�r
�5/usr/lib/python3/dist-packages/sphinx/testing/path.py�getumasks

rc	s�eZdZdZedKdd��Zdefdd�ZdKdd�Zde	fd	d
�Z
de	fdd�Zde	fd
d�Zde	fdd�Z
de	fdd�ZdLde	deddfdd�ZdMdede	ddfdd�Zdeddfdd�ZeZdNdd �Zdefd!d"�Zd#eddfd$d%�ZdOd'ed(edefd)d*�ZdPd,ed-ed(eddfd.d/�ZdPd-ed(edefd0d1�ZdPd-ed(edefd2d3�Zdejfd4d5�Zdejfd6d7�ZdMd8ed9e	ddfd:d;�Z de	fd<d=�Z!de	fd>d?�Z"dQd'e#dAe	ddfdBdC�Z$dDeddfdEdF�Z%de&efdGdH�Z'e%Z(Z)def�fdIdJ�Z*�Z+S)R�pathz8
    Represents a path which behaves like a string.
    rcC�|�tj�|��S)zH
        The name of the directory the file or directory is in.
        )�	__class__rr
�dirname��selfr
r
r�parent%szpath.parentcC�tj�|�S�N)rr
�basenamerr
r
rr,sz
path.basenamecCr)z,
        Returns the absolute path.
        )rrr
�abspathrr
r
rr/szpath.abspathcCr)z;
        Returns ``True`` if the path is absolute.
        )rr
�isabsrr
r
rr5�z
path.isabscCr)z>
        Returns ``True`` if the path is a directory.
        )rr
�isdirrr
r
rr;rz
path.isdircCr)z9
        Returns ``True`` if the path is a file.
        )rr
�isfilerr
r
rrArzpath.isfilecCr)zB
        Returns ``True`` if the path is a symbolic link.
        )rr
�islinkrr
r
rrGrzpath.islinkcCr)z@
        Returns ``True`` if the path is a mount point.
        )rr
�ismountrr
r
rrMrzpath.ismountFN�
ignore_errors�onerrorcC�tj|||d�dS)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`.
        )rrN)�shutil�rmtree)rrrr
r
rr"Sszpath.rmtree�destination�symlinkscCsrtj|||d�tj�d�r5t�|�D]#\}}}t�|dt@�|D]}t�tj�	||�dt@�q#qdSdS)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)rr#r$�root�dirs�files�namer
r
rr&es
��z
path.copytreecCst�||�dS)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)rr#r
r
r�movetree{sz
path.movetreecCst�|�dS)z!
        Removes a file.
        N)r�unlinkrr
r
rr3�szpath.unlinkcC�
t�|�S)z-
        Returns a stat of the file.
        )r�statrr
r
rr5�s
z	path.stat�argcCst�||�dSr)r�utime)rr6r
r
rr7�sz
path.utime�r�mode�kwargscKst||fi|��Sr)�open)rr9r:r
r
rr;�sz	path.open�utf-8�text�encodingcKsFt|dfd|i|���}|�|�Wd�dS1swYdS)z6
        Writes the given `text` to the file.
        �wr>N�r;�write)rr=r>r:�fr
r
r�
write_text�s"�zpath.write_textcKs"tjdtdd�|j|fi|��S)�/
        Returns the text in the file.
        z;Path.text() is deprecated.  Please use read_text() instead.���
stacklevel)�warnings�warnr�	read_text)rr>r:r
r
rr=�s�z	path.textcKs@t|fd|i|���}|��Wd�S1swYdS)rDr>N�r;�read)rr>r:rBr
r
rrJ�s$�zpath.read_textcCstjdtdd�|��S)�0
        Returns the bytes in the file.
        z=Path.bytes() is deprecated.  Please use read_bytes() instead.rErF)rHrIr�
read_bytesrr
r
r�bytes�s�z
path.bytescCs8t|dd��}|��Wd�S1swYdS)rM�rb�r9NrK)rrBr
r
rrN�s$�zpath.read_bytesrO�appendcCsJ|rd}nd}t||d��}|�|�Wd�dS1swYdS)z�
        Writes the given `bytes` to the file.

        :param append:
            If ``True`` given `bytes` are added at the end of the file.
        �ab�wbrQNr@)rrOrRr9rBr
r
r�write_bytes�s"�zpath.write_bytescCr)z5
        Returns ``True`` if the path exist.
        )rr
�existsrr
r
rrV�rzpath.existscCr)zb
        Returns ``True`` if the path exists unless it is a broken symbolic
        link.
        )rr
�lexistsrr
r
rrW�szpath.lexists��exist_okcCr )z1
        Recursively create directories.
        )rYN)r�makedirs)rr9rYr
r
rrZ�sz
path.makedirs�argscGs"|�tjj|gt|j|��R��S)zP
        Joins the path with the argument given and returns the result.
        )rrr
r,�map)rr[r
r
r�joinpath�s"z
path.joinpathcCr4r)r�listdirrr
r
rr^�s
zpath.listdircsd|jjt���fS)Nz%s(%s))r�__name__�super�__repr__r�rr
rra�sz
path.__repr__)rr
)FN)F)rN)r8)r<)rXF),r_�
__module__�__qualname__�__doc__�propertyr�strrr�boolrrrrrrr"r&r2r1r3rr5r7rr;rCr=rJ�builtinsrOrNrUrVrW�intrZr]rr^�__div__�__truediv__ra�
__classcell__r
r
rbrr
 s@


r
)rerirr!�sysrH�typingrrrr�sphinx.deprecationr�getfilesystemencoding�getdefaultencoding�FILESYSTEMENCODINGrjrr+rgr
r
r
r
r�<module>s