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: //lib/python3/dist-packages/sphinx/util/__pycache__/fileutil.cpython-310.pyc
o

�$�a��@s�dZddlZddlZddlmZmZmZddlmZddl	m
Z
mZddlm
Z
er0ddlmZ	dded	ed
eddd
df
dd�Zdd�dddfded	ede
d
edddeeegdfd
dfdd�ZdS)z�
    sphinx.util.fileutil
    ~~~~~~~~~~~~~~~~~~~~

    File utility functions for Sphinx.

    :copyright: Copyright 2007-2021 by the Sphinx team, see AUTHORS.
    :license: BSD, see LICENSE for details.
�N)�
TYPE_CHECKING�Callable�Dict)�
relative_path)�copyfile�	ensuredir)�PathMatcher)�BaseRenderer�source�destination�context�rendererr	�returnc	Cstj�|�sdStj�|�rtj�|tj�|��}|���d�r�|dur�|dur1ddlm	}|�}t
|dd��@}|���d�rE|dd�}t
|ddd��}|�|�|�
�|��Wd�n1sbwYWd�dSWd�dS1szwYdSt||�dS)	a�Copy an asset file to destination.

    On copying, it expands the template variables if context argument is given and
    the asset is a template file.

    :param source: The path to source file
    :param destination: The path to destination file or directory
    :param context: The template variables.  If not given, template files are simply copied
    :param renderer: The template engine.  If not given, SphinxRenderer is used by default
    N�_tr��SphinxRendererzutf-8)�encoding����w)�os�path�exists�isdir�join�basename�lower�endswith�sphinx.util.templater�open�write�
render_string�readr)r
rrr
r�fsrc�fdst�r$�6/usr/lib/python3/dist-packages/sphinx/util/fileutil.py�copy_asset_files$��"�r&cCsdS)NFr$)rr$r$r%�<lambda>9sr'�excluded�onerrorcCs4tj�|�sdS|durddlm}|�}t|�tj�|�r(t||||�dStj|dd�D]h\}}}	t	||�}
|dd�D]}|t
�|
|��rO|�|�q?tt
�||
|��q?|	D];}|t
�|
|��s�ztt
�||�t
�||
�||�Wq[t
y�}
z|r�|t
�||�|
�n�WYd}
~
q[d}
~
wwq[q/dS)aMCopy asset files to destination recursively.

    On copying, it expands the template variables if context argument is given and
    the asset is a template file.

    :param source: The path to source file or directory
    :param destination: The path to destination directory
    :param excluded: The matcher to determine the given path should be copied or not
    :param context: The template variables.  If not given, template files are simply copied
    :param renderer: The template engine.  If not given, SphinxRenderer is used by default
    :param onerror: The error handler.
    NrrT)�followlinks)rrrrrr�isfiler&�walkr�	posixpathr�remove�	Exception)r
rr(rr
r)r�root�dirs�files�reldir�dir�filename�excr$r$r%�
copy_asset9s@

�������r7)NN)�__doc__rr-�typingrrr�docutils.utilsr�sphinx.util.osutilrr�sphinx.util.typingrrr	�strr&r/r7r$r$r$r%�<module>s:
���
�!�����