403Webshell
Server IP : 127.0.0.1  /  Your IP : 216.73.216.109
Web Server : Apache/2.4.54 (Win64) OpenSSL/1.1.1q PHP/8.1.10
System : Windows NT DESKTOP-E5T4RUN 10.0 build 19045 (Windows 10) AMD64
User : SERVERWEB ( 0)
PHP Version : 8.1.10
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : OFF |  Perl : OFF |  Python : OFF |  Sudo : OFF |  Pkexec : OFF
Directory :  C:/cygwin64/lib/python3.9/site-packages/setuptools/config/__pycache__/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : C:/cygwin64/lib/python3.9/site-packages/setuptools/config/__pycache__/expand.cpython-39.pyc
a

��eH@�@sfdZddlZddlZddlZddlZddlZddlmZddlm	Z	ddl
mZddlm
Z
ddlmZmZmZmZmZmZmZmZmZmZmZmZddlmZdd	lmZdd
lmZddl m!Z"m#Z#dd
l$m%Z%er�ddl&m'Z'ddl(m)Z)ddl*m+Z+e
j,Z-ed�Z.eddd�Z/Gdd�d�Z0dOee1ee#ee1d�dd�Z2dPee1e3ee#fe1d�dd�Z4ee#ee#d�dd�Z5ee3e#fe1d�d d!�Z6e#e1d"�d#d$�Z7dQe1eee1e1fee#d%�d&d'�Z8e1ee#ed(�d)d*�Z9ee1ed+�d,d-�Z:e1eee1e1fe#ee#ee1e1fd.�d/d0�Z;dRe1eee1e1fee#ed1�d2d3�Z<dSee1e1feee1e1fee#ee1efd4�d5d6�Z=dddd7�eee1e1fee#ee1d8�d9d:�Z>e#e#e1d;�d<d=�Z?eeeee1e@fe1fe1d>�d?d@�ZAeBeBdA�dBdC�ZCdTeeDeBfee#eee1ee1fdD�dEdF�ZEdUe1ee1eBfdH�dIdJ�ZFGdKdL�dL�ZGGdMdN�dNee.e/f�ZHdS)VaiUtility 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.
�N)�iglob)�ConfigParser)�
ModuleSpec)�chain)�
TYPE_CHECKING�Callable�Dict�Iterable�Iterator�List�Mapping�Optional�Tuple�TypeVar�Union�cast)�Path)�
ModuleType)�DistutilsOptionError�)�	same_path�StrPath)�SetuptoolsWarning)�Distribution)�ConfigDiscovery)�DistributionMetadata�_K�_VT)�	covariantc@sFeZdZdZeed�dd�Zeee	j
e	j
fd�dd�Zdd	�Zd
S)�StaticModulez>Proxy to a module object that avoids executing arbitrary code.)�name�speccCs.t�t�|j����}t|��t��|`	dS�N)
�ast�parse�pathlibr�origin�
read_bytes�vars�update�locals�self)r+r r!�module�r-�</usr/lib/python3.9/site-packages/setuptools/config/expand.py�__init__AszStaticModule.__init__��returnc#sZ|jjD]L�t�tj�r4�fdd��jD�EdHqt�tj�r�jr�j�jfVqdS)Nc3s|]}|�jfVqdSr"��value)�.0�target�Z	statementr-r.�	<genexpr>I�z1StaticModule._find_assignments.<locals>.<genexpr>)	r,�body�
isinstancer#ZAssign�targetsZ	AnnAssignr3r5�r+r-r6r.�_find_assignmentsFs
zStaticModule._find_assignmentsc
s\zt�fdd�|��D��WStyV}z"t|j�d����|�WYd}~n
d}~00dS)zHAttempt to load an attribute "statically", via :func:`ast.literal_eval`.c3s2|]*\}}t|tj�r|j�krt�|�VqdSr")r:r#�Name�idZliteral_eval)r4r5r3��attrr-r.r7Ps�z+StaticModule.__getattr__.<locals>.<genexpr>z has no attribute N)�nextr=�	Exception�AttributeErrorr )r+rA�er-r@r.�__getattr__Ms�
zStaticModule.__getattr__N)
�__name__�
__module__�__qualname__�__doc__�strrr/r
rr#ZASTr=rFr-r-r-r.r>sr)�patterns�root_dirr1c	s�hd�}g}�pt���|D]x�t�fdd�|D��rrtj�tj�����}|�t�fdd�t|dd�D���qtj�	����
tjd�}|�|�q|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
    >�[�}�]�{�?�*c3s|]}|�vVqdSr"r-)r4�charr2r-r.r7hr8z glob_relative.<locals>.<genexpr>c3s&|]}tj�|���tjd�VqdS)�/N)�os�path�relpath�replace�sep�r4rW�rMr-r.r7ls�T)�	recursiverU)
rV�getcwd�anyrW�abspath�join�extend�sortedrrXrYrZ�append)rLrMZglob_charactersZexpanded_valuesZ	glob_pathrWr-)rMr3r.�
glob_relativeYs

��	re)�	filepathsr1csRddlm}tj��pt�����fdd�||�D�}d��fdd�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_iterablec3s|]}tj��|�VqdSr")rVrWrar[r\r-r.r7�r8zread_files.<locals>.<genexpr>�
c3s |]}t|��rt|�VqdSr")�
_assert_local�
_read_filer[r\r-r.r7�s
�)� setuptools.extern.more_itertoolsrgrVrWr`r^ra�_filter_existing_files)rfrMrgZ
_filepathsr-r\r.�
read_fileszs�rmccs4|D]*}tj�|�r|Vqt�d|�d��qdS)NzFile z cannot be found)rVrW�isfiler�emit)rfrWr-r-r.rl�srl)�filepathr1cCs8t|dd��}|��Wd�S1s*0YdS)Nzutf-8)�encoding)�open�read)rp�fr-r-r.rj�srj)rprMcCs@ttj�|��ttj�|��jvr<d|�d|�d�}t|��dS)NzCannot access z (or anything outside �)T)rrVrWr`�parentsr)rprM�msgr-r-r.ri�s"ri)�	attr_desc�package_dirrMc
Cs�|p
t��}|���d�}|��}d�|�}|p2d}t|||�\}}}t||�}ztt	||�|�WSt
y�t||�}	t|	|�YS0dS)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/N)rVr^�strip�split�popra�_find_module�
_find_spec�getattrrrC�
_load_spec)
rxryrMZ
attrs_pathZ	attr_name�module_name�_parent_pathrWr!r,r-r-r.�	read_attr�s


r�)r��module_pathr1cCs2tj�||�}|ptj�|�}|dur.t|��|Sr")�	importlib�util�spec_from_file_location�	find_spec�ModuleNotFoundError)r�r�r!r-r-r.r�s
r)r!r�r1cCsFt|d|�}|tjvr tj|Stj�|�}|tj|<|j�|�|S)NrG)r��sys�modulesr�r��module_from_spec�loader�exec_module)r!r�r r,r-r-r.r��s


r�)r�ryrMr1cCs�|}|�d�}|r�|d|vr|||d}|�dd�}t|�dkr^tj�||d�}|d}n|}d�|g|dd���}nd|vr�tj�||d�}tjj|g|�d��R�}t|�d�tj�|d�ft|�d	���}	td
d�|	D�d�}
||
|fS)a0Given a module (that could normally be imported by ``module_name``
    after the build is complete), find the path to the parent directory where
    it is contained and the canonical name that could be used to import it
    considering the ``package_dir`` in the build configuration and ``root_dir``
    rzrrU�N�z.pyz__init__.pyz.*css|]}tj�|�r|VqdSr")rVrWrn�r4�xr-r-r.r7�r8z_find_module.<locals>.<genexpr>)	r|�rsplit�lenrVrWrarrrB)r�ryrM�parent_pathZmodule_partsZcustom_path�parts�
parent_moduleZ
path_startZ
candidatesr�r-r-r.r~�s(

�r~)�qualified_class_nameryrMr1c
Cs^|p
t��}|�d�}||dd�}|d|�}t|||�\}}}tt||�|�}	t|	|�S)z@Given a qualified class name, return the associated class objectrzr�N)rVr^�rfindr~r�rr�)
r�ryrM�idx�
class_nameZpkg_namer�rWr�r,r-r-r.�
resolve_class�s
r�)�valuesryrMr1cs��fdd�|��D�S)z�Given a dictionary mapping command names to strings for qualified class
    names, apply :func:`resolve_class` to the dict values.
    csi|]\}}|t|����qSr-)r��r4�k�v�ryrMr-r.�
<dictcomp>r8zcmdclass.<locals>.<dictcomp>)�items)r�ryrMr-r�r.�cmdclass
sr�)�
namespaces�fill_package_dirrM)r�rMr1c
sddlm}ddlm}m}|r.ddlm}nddlm}|pBtj}|�	ddg�}g}	|durbin|}t
|||����t��d	kr�t�fd
d�d|fD��r�|�
d�d��D]Z}
t||
�}|j|fi|��}|	�|�|r�|�d�|
ks�tj�||�s�|�|||
��q�|	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_everseenrg)�PEP420PackageFinder)�
PackageFinder�whererzNr�c3s|]}t�d|�VqdS)rN)�
_same_pathr���searchr-r.r7>r8z find_packages.<locals>.<genexpr>r�)�setuptools.discoveryr�rkr�rgr�r�rV�curdirr}�listr��all�
setdefault�
_nest_path�findrb�getrW�samefiler))
r�r�rM�kwargsr�r�rgr�r�ZpackagesrW�package_pathZpkgsr-r�r.�
find_packagess.
&

��r�)�parentrWr1cCs&|dvr|ntj�||�}tj�|�S)N>r�rz)rVrWra�normpath)r�rWr-r-r.r�Msr�)r3r1cCsVt|�r|�}tttttf|�}t|t�sRt|d�rJd�t	t|��}nd|}|S)z`When getting the version directly from an attribute,
    it should be normalised to string.
    �__iter__rzz%s)
�callablerr	rrK�intr:�hasattrra�mapr2r-r-r.�versionRs

r�)�package_datar1cCsd|vr|�d�|d<|S)NrSr�)r})r�r-r-r.�canonic_package_datadsr�)�
data_filesrMr1cs$t|t�r|S�fdd�|��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.
    csg|]\}}|t|��f�qSr-)re)r4�destrLr\r-r.�
<listcomp>us�z&canonic_data_files.<locals>.<listcomp>)r:r�r�)r�rMr-r\r.�canonic_data_filesjs


�r��entry-points)�textr1cCsBtddd�}t|_|�||�dd�|��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_sectionZ
delimiterscSsi|]\}}|t|����qSr-)�dictr�r�r-r-r.r��r8z entry_points.<locals>.<dictcomp>)rrKZoptionxformZread_stringr�r}r�)r�Ztext_source�parser�groupsr-r-r.�entry_points{sr�c@sfeZdZdZdd�dd�Zdd�Zdd	�Zd
d�Zee	e	fd�d
d�Z
eee	e	fd�dd��ZdS)�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.
    r)�distributioncCs||_d|_dS)NF)�_dist�_called)r+r�r-r-r.r/�sz!EnsurePackagesDiscovered.__init__cCs|jsd|_|jjdd�dS)zBTrigger the automatic package discovery, if it is still necessary.TF)r N)r�r��set_defaultsr<r-r-r.�__call__�sz!EnsurePackagesDiscovered.__call__cCs|Sr"r-r<r-r-r.�	__enter__�sz"EnsurePackagesDiscovered.__enter__cCs|jr|jj��dSr")r�r�r�Zanalyse_name)r+Z	_exc_typeZ
_exc_valueZ
_tracebackr-r-r.�__exit__�sz!EnsurePackagesDiscovered.__exit__r0cCs|�|jj}|duriS|Sr")r�ry)r+Zpkg_dirr-r-r.�_get_package_dir�sz)EnsurePackagesDiscovered._get_package_dircCs
t|j�S)zCProxy to ``package_dir`` that may trigger auto-discovery when used.)�LazyMappingProxyr�r<r-r-r.ry�sz$EnsurePackagesDiscovered.package_dirN)
rGrHrIrJr/r�r�r�rrKr��propertyryr-r-r-r.r��s	r�c@steZdZdZegeeeffd�dd�Zeeefd�dd�Z	eed�d	d
�Z
ed�dd�Ze
ed�d
d�ZdS)r�a�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_valuecCs||_d|_dSr")�_obtain�_value)r+r�r-r-r.r/�szLazyMappingProxy.__init__r0cCs|jdur|��|_|jSr")r�r�r<r-r-r.�_target�s

zLazyMappingProxy._target)�keyr1cCs|��|Sr")r�)r+r�r-r-r.�__getitem__�szLazyMappingProxy.__getitem__cCst|���Sr")r�r�r<r-r-r.�__len__�szLazyMappingProxy.__len__cCst|���Sr")�iterr�r<r-r-r.r��szLazyMappingProxy.__iter__N)rGrHrIrJrrrrr/r�r�r�r�r
r�r-r-r-r.r��s
r�)N)N)NN)NN)NN)N)r�)IrJr#r�rVr%r��globrZconfigparserrZimportlib.machineryr�	itertoolsr�typingrrrr	r
rrr
rrrrr�typesrZdistutils.errorsr�_pathrr�r�warningsrZsetuptools.distrr�rZdistutils.distr�
from_iterableZ
chain_iterrrrrKre�bytesrmrlrjrir�rr�r~r�r�r�r�r�r�r�r�r�r�r�r�r�r-r-r-r.�<module>s�8��! 
��&
�$���

�
��5&��&

Youez - 2016 - github.com/yon3zu
LinuXploit