Hacked By AnonymousFox

Current Path : /opt/cloudlinux/venv/lib64/python3.11/site-packages/setuptools/config/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib64/python3.11/site-packages/setuptools/config/__pycache__/expand.cpython-311.pyc

�

�܋f�<��0�dZddlmZddlZddlZddlZddlZddlZddlm	Z	ddl
mZddlm
Z
mZddlmZddlmZmZmZmZmZmZdd	lmZdd
lmZddlmZdd
lmZm Z ddl!m"Z"ddl#m$Z$erddl%m&Z&ed��Z'edd���Z(Gd�d��Z)	dWdXd�Z*	dWdYd!�Z+dZd$�Z,d[d'�Z-d\d)�Z.		d]d^d-�Z/d_d1�Z0d`d4�Z1dad6�Z2		d]dbd9�Z3		d]dcd=�Z4dddd>�dddA�Z5dedD�Z6dfdG�Z7dgdJ�Z8	dWdhdN�Z9didjdR�Z:GdS�dT��Z;GdU�dVee'e(f��Z<dS)kaiUtility functions to expand configuration directives or special values
(such glob patterns).

We can split the process of interpreting configuration files into 2 steps:

1. The parsing the file contents from strings to value objects
   that can be understand by Python (for example a string with a comma
   separated list of keywords into an actual Python list of strings).

2. The expansion (or post-processing) of these values according to the
   semantics ``setuptools`` assign to them (for example a configuration field
   with the ``file:`` directive should be expanded from a list of file paths to
   a single string with the contents of those files concatenated)

This module focus on the second step, and therefore allow sharing the expansion
functions among several configuration file formats.

**PRIVATE MODULE**: API reserved for setuptools internal usage only.
�)�annotationsN)�iglob)�ConfigParser)�
ModuleSpec�all_suffixes)�chain)�
TYPE_CHECKING�Callable�Iterable�Iterator�Mapping�TypeVar)�Path)�
ModuleType)�DistutilsOptionError�)�	same_path�StrPath)�find_package_path)�SetuptoolsWarning)�Distribution�_K�_VT)�	covariantc�(�eZdZdZdd�Zd
d	�Zd
�ZdS)�StaticModulez>Proxy to a module object that avoids executing arbitrary code.�name�str�specrc���tjtj|j�������}t
|���t����|`	dS�N)
�ast�parse�pathlibr�origin�
read_bytes�vars�update�locals�self)r*rr�modules    �O/opt/cloudlinux/venv/lib64/python3.11/site-packages/setuptools/config/expand.py�__init__zStaticModule.__init__;sP����7�<���4�4�?�?�A�A�B�B���T�
�
���&�(�(�#�#�#��I�I�I��return�!Iterator[tuple[ast.AST, ast.AST]]c#���K�|jjD]g�t�tj��r�fd��jD��Ed{V���6t�tj��r�jr�j�jfV��hdS)Nc3�*�K�|]
}|�jfV��dSr!)�value)�.0�target�	statements  �r,�	<genexpr>z1StaticModule._find_assignments.<locals>.<genexpr>Cs*�����V�V�&�V�Y�_�5�V�V�V�V�V�Vr.)	r+�body�
isinstancer"�Assign�targets�	AnnAssignr3r5)r*r6s @r,�_find_assignmentszStaticModule._find_assignments@s��������)�	:�	:�I��)�S�Z�0�0�
:�V�V�V�V�I�DU�V�V�V�V�V�V�V�V�V�V�V��I�s�}�5�5�
:�)�/�
:� �'���9�9�9�9��		:�	:r.c���	t�fd�|���D����S#t$r}t|j�d�����|�d}~wwxYw)zHAttempt to load an attribute "statically", via :func:`ast.literal_eval`.c3��K�|]@\}}t|tj��r!|j�k�*tj|��V��AdSr!)r9r"�Name�id�literal_eval)r4r5r3�attrs   �r,r7z+StaticModule.__getattr__.<locals>.<genexpr>Jsa�������!�F�E��f�c�h�/�/��5;�I��4E�4E�� ��'�'�4E�4E�4E�4E��r.z has no attribute N)�nextr=�	Exception�AttributeErrorr)r*rC�es ` r,�__getattr__zStaticModule.__getattr__Gs����	P������%)�%;�%;�%=�%=������
��
�	P�	P�	P� �D�I�!G�!G��!G�!G�H�H�a�O�����	P���s�,0�
A�A�AN)rrrr)r/r0)�__name__�
__module__�__qualname__�__doc__r-r=rH�r.r,rr8sV������H�H�����
:�:�:�:�	P�	P�	P�	P�	Pr.r�patterns�
Iterable[str]�root_dir�StrPath | Noner/�	list[str]c
����hd�}g}�ptj���|D]�t�fd�|D����r{tj�tj�������}|�t�fd�t|d���D��������tj�	�����
tjd��}|�|����|S)aExpand the list of glob patterns, but preserving relative paths.

    :param list[str] patterns: List of glob patterns
    :param str root_dir: Path to which globs should be relative
                         (current directory by default)
    :rtype: list
    >�*�?�[�]�{�}c3� �K�|]}|�vV��	dSr!rM)r4�charr3s  �r,r7z glob_relative.<locals>.<genexpr>bs'�����9�9��t�u�}�9�9�9�9�9�9r.c3��K�|]B}tj�|����tjd��V��CdS)�/N)�os�path�relpath�replace�sep�r4r_rPs  �r,r7z glob_relative.<locals>.<genexpr>fsY���������G�O�O�D�(�3�3�;�;�B�F�C�H�H������r.T)�	recursiver])
r^�getcwd�anyr_�abspath�join�extend�sortedrr`rarb�append)rNrP�glob_characters�expanded_values�	glob_pathr_r3s `    @r,�
glob_relativeroSs ����5�4�4�O��O��&�2�9�;�;�H��)�)���9�9�9�9��9�9�9�9�9�
	)���������X�u�(E�(E�F�F�I��"�"������ %�i�4� @� @� @������
�
�
�
��7�?�?�5�(�3�3�;�;�B�F�C�H�H�D��"�"�4�(�(�(�(��r.�	filepaths�StrPath | Iterable[StrPath]rc���ddlm}tj��ptj������fd�||��D��}d��fd�t|��D����S)z�Return the content of the files concatenated using ``
`` as str

    This function is sandboxed and won't reach anything outside ``root_dir``

    (By default ``root_dir`` is the current directory).
    r)�always_iterablec3�X�K�|]$}tj��|��V��%dSr!�r^r_rhrcs  �r,r7zread_files.<locals>.<genexpr>�s3�����V�V�4�"�'�,�,�x��.�.�V�V�V�V�V�Vr.�
c3�V�K�|]#}t|����t|��V��$dSr!)�
_assert_local�
_read_filercs  �r,r7zread_files.<locals>.<genexpr>�sO����������x�(�(���4��������r.)� setuptools.extern.more_itertoolsrsr^r_rgrerh�_filter_existing_files)rprPrs�
_filepathss `  r,�
read_filesr}ts����A�@�@�@�@�@��w���x�6�2�9�;�;�7�7�H�V�V�V�V�?�?�9�;U�;U�V�V�V�J��9�9�����*�:�6�6������r.�Iterable[StrPath]�Iterator[StrPath]c#�K�|D]>}tj�|��r|V��&tjd|�d����?dS)NzFile z cannot be found)r^r_�isfiler�emit)rpr_s  r,r{r{�se�����E�E��
�7�>�>�$���	E��J�J�J�J��"�#C�4�#C�#C�#C�D�D�D�D�	E�Er.�filepath�bytes | StrPathc��t|d���5}|���cddd��S#1swxYwYdS)Nzutf-8)�encoding)�open�read)r��fs  r,ryry�s���	
�h��	)�	)�	)��Q��v�v�x�x���������������������s�3�7�7rc���ttj�|����ttj�|����jvrd|�d|�d�}t|���dS)NzCannot access z (or anything outside �)T)rr^r_rg�parentsr)r�rP�msgs   r,rxrx�sg���B�G�O�O�H�%�%�&�&�d�2�7�?�?�8�3L�3L�.M�.M�.U�U�U�N�x�N�N��N�N�N��"�3�'�'�'��4r.�	attr_desc�package_dir�Mapping[str, str] | Nonec��|ptj��}|����d��}|���}d�|��}|pd}t
|||��}t||��}	tt||��|��S#t$r#t||��}t||��cYSwxYw)a�Reads the value of an attribute from a module.

    This function will try to read the attributed statically first
    (via :func:`ast.literal_eval`), and only evaluate the module if it fails.

    Examples:
        read_attr("package.attr")
        read_attr("package.module.attr")

    :param str attr_desc: Dot-separated string describing how to reach the
        attribute (see examples above)
    :param dict[str, str] package_dir: Mapping of package names to their
        location in disk (represented by paths relative to ``root_dir``).
    :param str root_dir: Path to directory containing all the packages in
        ``package_dir`` (current directory by default).
    :rtype: str
    �.r-)r^re�strip�split�poprh�_find_module�
_find_spec�getattrrrE�
_load_spec)	r�r�rP�
attrs_path�	attr_name�module_namer_rr+s	         r,�	read_attrr��s���,�&�2�9�;�;�H����"�"�(�(��-�-�J���� � �I��(�(�:�&�&�K��+��K���[�(�;�;�D��k�4�(�(�D�*��|�K��6�6�	�B�B�B���*�*�*��D�+�.�.���v�y�)�)�)�)�)�*���s�B*�**C�Cr��module_pathrc��tj�||��}|ptj�|��}|�t	|���|Sr!)�	importlib�util�spec_from_file_location�	find_spec�ModuleNotFoundError)r�r�rs   r,r�r��sK���>�1�1�+�{�K�K�D��8�9�>�+�+�K�8�8�D��|�!�+�.�.�.��Kr.rrc��t|d|��}|tjvrtj|Stj�|��}|tj|<|j�|��|S)NrI)r��sys�modulesr�r��module_from_spec�loader�exec_module)rr�rr+s    r,r�r��si���4��[�1�1�D��s�{����{�4� � �
�^�
,�
,�T�
2�
2�F��C�K����K���F�#�#�#��Mr.�
str | Nonec���t||pi|���tj�fd�t��D����}t	d�|D��d��S)a�Find the path to the module named ``module_name``,
    considering the ``package_dir`` in the build configuration and ``root_dir``.

    >>> tmp = getfixture('tmpdir')
    >>> _ = tmp.ensure("a/b/c.py")
    >>> _ = tmp.ensure("a/b/d/__init__.py")
    >>> r = lambda x: x.replace(str(tmp), "tmp").replace(os.sep, "/")
    >>> r(_find_module("a.b.c", None, tmp))
    'tmp/a/b/c.py'
    >>> r(_find_module("f.g.h", {"": "1", "f": "2", "f.g": "3", "f.g.h": "a/b/d"}, tmp))
    'tmp/a/b/d/__init__.py'
    c3�j�K�|]-}��|��tj��d|����fV��.dS)r-Nru)r4�ext�
path_starts  �r,r7z_find_module.<locals>.<genexpr>�s`�����%�%��
�	��	�	�r�w�|�|�J�8H�3�8H�8H�I�I�J�%�%�%�%�%�%r.c3�XK�|]%}tj�|���!|V��&dSr!)r^r_r�)r4�xs  r,r7z_find_module.<locals>.<genexpr>�s5����<�<�q�"�'�.�.��*;�*;�<��<�<�<�<�<�<r.N)rr�
from_iterablerrD)r�r�rP�
candidatesr�s    @r,r�r��sx���#�;��0A�r�8�L�L�J��$�%�%�%�%��>�>�%�%�%���J��<�<�J�<�<�<�d�C�C�Cr.�qualified_class_namer
c��|ptj��}|�d��}||dzd�}|d|�}t|||��}t	t||��|��}t
||��S)z@Given a qualified class name, return the associated class objectr��N)r^re�rfindr�r�r�r�)r�r�rP�idx�
class_name�pkg_namer_r+s        r,�
resolve_classr��s����&�2�9�;�;�H�
�
$�
$�S�
)�
)�C�%�c�A�g�i�i�0�J�#�D�S�D�)�H���+�x�8�8�D�
�
�8�T�2�2�H�
=�
=�F��6�:�&�&�&r.�values�dict[str, str]�dict[str, Callable]c�H�����fd�|���D��S)z�Given a dictionary mapping command names to strings for qualified class
    names, apply :func:`resolve_class` to the dict values.
    c�:��i|]\}}|t|������SrM)r�)r4�k�vr�rPs   ��r,�
<dictcomp>zcmdclass.<locals>.<dictcomp>s+���R�R�R�4�1�a�A�}�Q��X�6�6�R�R�Rr.)�items)r�r�rPs ``r,�cmdclassr��s,����S�R�R�R�R�6�<�<�>�>�R�R�R�Rr.)�
namespaces�fill_package_dirrPr��dict[str, str] | Nonec��
�ddlm}ddlm}m}|rddlm}nddlm}|ptj}|�	ddg��}g}	|�in|}t|||�������
t�
��d	kr9t�
fd
�d|fD����r|�
d�
d���
D]�}
t||
��}|j|fi|��}|	�|��|rX|�d��|
ks?tj�||��s|�|||
������|	S)aWorks similarly to :func:`setuptools.find_packages`, but with all
    arguments given as keyword arguments. Moreover, ``where`` can be given
    as a list (the results will be simply concatenated).

    When the additional keyword argument ``namespaces`` is ``True``, it will
    behave like :func:`setuptools.find_namespace_packages`` (i.e. include
    implicit namespaces as per :pep:`420`).

    The ``where`` argument will be considered relative to ``root_dir`` (or the current
    working directory when ``root_dir`` is not given).

    If the ``fill_package_dir`` argument is passed, this function will consider it as a
    similar data structure to the ``package_dir`` configuration parameter add fill-in
    any missing package location.

    :rtype: list
    r)�construct_package_dir)�unique_everseenrs)�PEP420PackageFinder)�
PackageFinder�wherer�Nr�c3�F�K�|]}t�d|��V��dS)rN)�
_same_path)r4r��searchs  �r,r7z find_packages.<locals>.<genexpr>/s4�����V�V��J�v�a�y�!�$<�$<� <�V�V�V�V�V�Vr.�)�setuptools.discoveryr�rzr�rsr�r�r^�curdirr��list�len�all�
setdefault�
_nest_path�findri�getr_�samefiler()r�r�rP�kwargsr�r�rsr�r��packagesr_�package_path�pkgsr�s             @r,�
find_packagesr�	s����0;�:�:�:�:�:�Q�Q�Q�Q�Q�Q�Q�Q��7�M�M�M�M�M�M�M�6�6�6�6�6�6��$�2�9�H��J�J�w���&�&�E��H�-�5�r�r�;K��
�/�/�/�/�%�"8�"8�9�9�
:�
:�F�
�6�{�{�a���C�V�V�V�V�s�H�o�V�V�V�V�V���#�#�B��q�	�2�2�2��G�G��!�(�D�1�1��!�}�!�,�9�9�&�9�9����������	G�� � ��$�$��,�,���0@�0@��x�0X�0X�,��#�#�$9�$9�$��$E�$E�F�F�F���Or.�parentr_c��|dvr|ntj�||��}tj�|��S)N>r�r�)r^r_rh�normpath)r�r_s  r,r�r�>s;���Y�&�&�6�6�B�G�L�L���,F�,F�D�
�7���D�!�!�!r.r3�$Callable | Iterable[str | int] | strc���t|��r
|��n|}t|t��r|St|d��r(d�tt|����Sd|zS)z`When getting the version directly from an attribute,
    it should be normalised to string.
    �__iter__r�z%s)�callabler9r�hasattrrh�map)r3�_values  r,�versionr�Csm��!����
2�U�U�W�W�W�U�F��&�#�����
��v�z�"�"�*��x�x��C��(�(�)�)�)��&�=�r.�package_data�dictc�>�d|vr|�d��|d<|S)NrTr�)r�)r�s r,�canonic_package_datar�Ps+��
�l���'�+�+�C�0�0��R���r.�
data_files�list | dict�list[tuple[str, list[str]]]c�r��t|t��r|S�fd�|���D��S)z�For compatibility with ``setup.py``, ``data_files`` should be a list
    of pairs instead of a dict.

    This function also expands glob patterns.
    c�:��g|]\}}|t|���f��SrM)ro)r4�destrNrPs   �r,�
<listcomp>z&canonic_data_files.<locals>.<listcomp>as<�������D�(�
�}�X�x�0�0�1���r.)r9r�r�)r�rPs `r,�canonic_data_filesr�VsT����*�d�#�#��������(�.�.�0�0����r.�entry-points�text�dict[str, dict]c���tdd���}t|_|�||��d�|���D��}|�|jd��|S)a?Given the contents of entry-points file,
    process it into a 2-level dictionary (``dict[str, dict[str, str]]``).
    The first level keys are entry-point groups, the second level keys are
    entry-point names, and the second level values are references to objects
    (that correspond to the entry-point value).
    N)�=)�default_section�
delimitersc�X�i|]'\}}|t|�������(SrM)r�r�)r4r�r�s   r,r�z entry_points.<locals>.<dictcomp>qs,��
<�
<�
<�T�Q��a��a�g�g�i�i���
<�
<�
<r.)rr�optionxform�read_stringr�r�r�)r��text_source�parser�groupss    r,�entry_pointsrgsk���$�6�
B�
B�
B�F��F��
���t�[�)�)�)�
<�
<�V�\�\�^�^�
<�
<�
<�F�
�J�J�v�%�t�,�,�,��Mr.c�L�eZdZdZd
d�Zd�Zd�Zd�Zdd
�Ze	dd���Z
dS)�EnsurePackagesDiscovereda�Some expand functions require all the packages to already be discovered before
    they run, e.g. :func:`read_attr`, :func:`resolve_class`, :func:`cmdclass`.

    Therefore in some cases we will need to run autodiscovery during the evaluation of
    the configuration. However, it is better to postpone calling package discovery as
    much as possible, because some parameters can influence it (e.g. ``package_dir``),
    and those might not have been processed yet.
    �distributionrc�"�||_d|_dS)NF)�_dist�_called)r*r	s  r,r-z!EnsurePackagesDiscovered.__init__�s��!��
�����r.c�\�|js$d|_|j�d���dSdS)zBTrigger the automatic package discovery, if it is still necessary.TF)rN)rr�set_defaults�r*s r,�__call__z!EnsurePackagesDiscovered.__call__�s<���|�	0��D�L��J�#�#��#�/�/�/�/�/�	0�	0r.c��|Sr!rMrs r,�	__enter__z"EnsurePackagesDiscovered.__enter__�s���r.c�T�|jr |jj���dSdSr!)rrr�analyse_name)r*�	_exc_type�
_exc_value�
_tracebacks    r,�__exit__z!EnsurePackagesDiscovered.__exit__�s3���<�	3��J�#�0�0�2�2�2�2�2�	3�	3r.r/�Mapping[str, str]c�:�|��|jj}|�in|Sr!)rr�)r*�pkg_dirs  r,�_get_package_dirz)EnsurePackagesDiscovered._get_package_dir�s%��������*�(���_�r�r�'�1r.c�*�t|j��S)zCProxy to ``package_dir`` that may trigger auto-discovery when used.)�LazyMappingProxyrrs r,r�z$EnsurePackagesDiscovered.package_dir�s�� �� 5�6�6�6r.N)r	r)r/r)rIrJrKrLr-rrrr�propertyr�rMr.r,rrvs�������������0�0�0����3�3�3�2�2�2�2�
�7�7�7��X�7�7�7r.rc�:�eZdZdZdd�Zdd�Zdd�Zdd
�Zdd�ZdS)ra�Mapping proxy that delays resolving the target object, until really needed.

    >>> def obtain_mapping():
    ...     print("Running expensive function!")
    ...     return {"key": "value", "other key": "other value"}
    >>> mapping = LazyMappingProxy(obtain_mapping)
    >>> mapping["key"]
    Running expensive function!
    'value'
    >>> mapping["other key"]
    'other value'
    �obtain_mapping_value�Callable[[], Mapping[_K, _V]]c�"�||_d|_dSr!)�_obtainr�)r*r!s  r,r-zLazyMappingProxy.__init__�s��+���.2����r.r/�Mapping[_K, _V]c�P�|j�|���|_|jSr!)r�r$rs r,�_targetzLazyMappingProxy._target�s!���;���,�,�.�.�D�K��{�r.�keyrrc�6�|���|Sr!)r')r*r(s  r,�__getitem__zLazyMappingProxy.__getitem__�s���|�|�~�~�c�"�"r.�intc�D�t|�����Sr!)r�r'rs r,�__len__zLazyMappingProxy.__len__�s���4�<�<�>�>�"�"�"r.�Iterator[_K]c�D�t|�����Sr!)�iterr'rs r,r�zLazyMappingProxy.__iter__�s���D�L�L�N�N�#�#�#r.N)r!r")r/r%)r(rr/r)r/r+)r/r.)	rIrJrKrLr-r'r*r-r�rMr.r,rr�s���������3�3�3�3�����
#�#�#�#�#�#�#�#�$�$�$�$�$�$r.rr!)rNrOrPrQr/rR)rprqrPrQr/r)rpr~r/r)r�r�r/r)r�rrPr)NN)r�rr�r�rPrQ)r�rr�rQr/r)rrr�rr/r)r�rr�r�rPrr/r�)r�rr�r�rPrQr/r
)r�r�r�r�rPrQr/r�)r�r�rPrQr/rR)r�rr_rr/r)r3r�r/r)r�r�r/r�)r�r�rPrQr/r�)r�)r�rr/r�)=rL�
__future__rr"r�r^r$r��globr�configparserr�importlib.machineryrr�	itertoolsr�typingr	r
rrr
rr�typesr�distutils.errorsr�_pathrr�r�	discoveryr�warningsr�setuptools.distrrrrror}r{ryrxr�r�r�r�r�r�r�r�r�r�r�rrrrMr.r,�<module>r=s�����(#�"�"�"�"�"�
�
�
�
�����	�	�	�	�����
�
�
�
�������%�%�%�%�%�%�8�8�8�8�8�8�8�8�����������������������������������1�1�1�1�1�1�4�4�4�4�4�4�4�4�)�)�)�)�)�)�(�(�(�(�(�(��-�,�,�,�,�,�,��W�T�]�]���W�T�T�"�"�"��P�P�P�P�P�P�P�P�89=������DHL������(E�E�E�E�����
����-1�#�#*�#*�#*�#*�#*�L��������D�D�D�D�2-1�#�
'�
'�
'�
'�
'�$-1�#�S�S�S�S�S��.2�#�	2�2�2�2�2�2�j"�"�"�"�

�
�
�
�����9=������"�����#7�#7�#7�#7�#7�#7�#7�#7�L$�$�$�$�$�w�r�2�v��$�$�$�$�$r.

Hacked By AnonymousFox1.0, Coded By AnonymousFox