HEX
Server: LiteSpeed
System: Linux php-prod-1.spaceapp.ru 5.15.0-157-generic #167-Ubuntu SMP Wed Sep 17 21:35:53 UTC 2025 x86_64
User: xnsbb3110 (1041)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //usr/local/lib/python3.10/dist-packages/setuptools/config/__pycache__/setupcfg.cpython-310.pyc
o

��h�g�@sUdZddlmZddlZddlZddlZddlmZddlm	Z	m
Z
ddlmZmZddl
mZmZmZmZmZmZmZddlmZdd	lmZmZdd
lmZmZddlmZdd
l m!Z!ddl"m#Z#m$Z$ddl%m&Z&ddlm'Z'er�ddl(m)Z)ddl*m+Z+ddl,m-Z-e.e/e0e/effZ1de2d<	e.e/e1fZ3de2d<	eddd�Z4	dLdMd#d$�Z5dNd&d'�Z6	(	dOdPd,d-�Z7dQd2d3�Z8dRd6d7�Z9	dSdTd:d;�Z:dUd@dA�Z;GdBdC�dCee4�Z<GdDdE�dEe<d�Z=GdFdG�dGe<d�Z>GdHdI�dIe&�Z?GdJdK�dKe&�Z@dS)Va<
Load setuptools configuration from ``setup.cfg`` files.

**API will be made private in the future**

To read project metadata, consider using
``build.util.project_wheel_metadata`` (https://pypi.org/project/build/).
For simple scenarios, you can also try parsing the file directly
with the help of ``configparser``.
�)�annotationsN)�defaultdict)�Iterable�Iterator)�partial�wraps)�
TYPE_CHECKING�Any�Callable�ClassVar�Generic�TypeVar�cast)�default_environment)�InvalidRequirement�Requirement)�InvalidVersion�Version�)�_static)�StrPath)�	FileError�OptionError)�SetuptoolsDeprecationWarning�)�expand)�	TypeAlias��Distribution)�DistributionMetadatar�SingleCommandOptions�AllCommandOptions�TargetrrF�filepathr�find_others�bool�ignore_option_errors�return�dictcCs8ddlm}|�}|r|��ng}t||||�}t|�S)a,Read given configuration file and returns options from it as a dict.

    :param str|unicode filepath: Path to configuration file
        to get options from.

    :param bool find_others: Whether to search for other configuration files
        which could be on in various places.

    :param bool ignore_option_errors: Whether to silently ignore
        options, values of which could not be resolved (e.g. due to exceptions
        in directives such as file:, attr:, etc.).
        If False exceptions are propagated as expected.

    :rtype: dict
    rr)�setuptools.distr�find_config_files�_apply�configuration_to_dict)r#r$r&r�dist�	filenames�handlers�r0�E/usr/local/lib/python3.10/dist-packages/setuptools/config/setupcfg.py�read_configuration2s
r2r-cCst||�|��|S)z`Apply the configuration from a ``setup.cfg`` file into an existing
    distribution object.
    )r+�_finalize_requires)r-r#r0r0r1�apply_configurationLs
r4r0�other_files�Iterable[StrPath]�2tuple[ConfigMetadataHandler, ConfigOptionsHandler]c	Cs�ddlm}tj�|�}tj�|�std|�d���t��}t�tj�	|��g|�|�}z |j
|ttt
|�d�t||j|d�}|��Wt�|�|St�|�w)zHRead configuration from ``filepath`` and applies to the ``dist`` object.r)�
_DistributionzConfiguration file z does not exist.)r.)r&)r)r8�os�path�abspath�isfiler�getcwd�chdir�dirname�parse_config_filesr�list�str�parse_configuration�command_options�_finalize_license_files)r-r#r5r&r8�current_directoryr.r/r0r0r1r+Us �

�r+�
target_obj�#Distribution | DistributionMetadata�keyrBcCs*d|��}t�t||�}t|||�}|�S)z�
    Given a target object and option key, get that option from
    the target object, either through a get_{key} method or
    from an attribute directly.
    �get_)�	functoolsr�getattr)rGrI�getter_name�by_attribute�getterr0r0r1�_get_optionts
rPr/�KIterable[ConfigHandler[Distribution] | ConfigHandler[DistributionMetadata]]cCs<tt�}|D]}|jD]}t|j|�}|||j|<qq|S)z�Returns configuration data gathered by given handlers as a dict.

    :param Iterable[ConfigHandler] handlers: Handlers list,
        usually from parse_configuration()

    :rtype: dict
    )rr(�set_optionsrPrG�section_prefix)r/�config_dict�handler�option�valuer0r0r1r,�s
�r,�distributionrDcCs�t�|��6}t||||�}|��|js|j|_t|j||||j|j�}|��|j�	|j|j�Wd�||fS1s>wY||fS)a�Performs additional parsing of configuration options
    for a distribution.

    Returns a list of used option handlers.

    :param Distribution distribution:
    :param dict command_options:
    :param bool ignore_option_errors: Whether to silently ignore
        options, values of which could not be resolved (e.g. due to exceptions
        in directives such as file:, attr:, etc.).
        If False exceptions are propagated as expected.
    :rtype: list
    N)
r�EnsurePackagesDiscovered�ConfigOptionsHandler�parse�package_dir�ConfigMetadataHandler�metadata�src_root�_referenced_files�update)rXrDr&�ensure_discovered�options�metar0r0r1rC�s4���
��rC�label�
orig_value�parsedrAc
s�d|vs
t��dkrdSt���}zt�d�}|j|vr)tj|�dd�WdSWdStyW}z t�fdd�|D��rLtj	|�dd�}t|�|�WYd}~dSd}~ww)amBecause users sometimes misinterpret this configuration:

    [options.extras_require]
    foo = bar;python_version<"4"

    It looks like one requirement with an environment marker
    but because there is no newline, it's parsed as two requirements
    with a semicolon as separator.

    Therefore, if:
        * input string does not contain a newline AND
        * parsed result contains two requirements AND
        * parsing of the two parts from the result ("<first>;<second>")
        leads in a valid Requirement with a valid marker
    a UserWarning is shown to inform the user about the possible problem.
    �
rNr)�field�reqc3s�|]
}�d�|�VqdS)rN��
startswith)�.0�marker�rgr0r1�	<genexpr>���z8_warn_accidental_env_marker_misconfig.<locals>.<genexpr>)
�len�
marker_env�keysr�name�_AmbiguousMarker�emitr�any�message)rerfrg�markersrj�ex�msgr0ror1�%_warn_accidental_env_marker_misconfig�s

�
���r}c@s�eZdZUdZded<	iZded<	d4dd�Zed5dd��Ze	dd��Z
d6dd�Zed7dd��Zedd��Z
edd��Zedd��Zd8d"d#�Zd9d%d&�Zed'd(��Zed)d*��Zed:d,d-��Zd6d.d/�Zd6d0d1�Zd2d3�Zd+S);�
ConfigHandlerz1Handles metadata supplied in configuration files.rBrSzClassVar[dict[str, str]]�aliasesrGr"rcr!rb�expand.EnsurePackagesDiscoveredr'�NonecCs8||_||_t|�|��|_g|_||_tt�|_	dS�N)
r&rGr(�_section_options�sectionsrRrb�setrBr`��selfrGrcr&rbr0r0r1�__init__�szConfigHandler.__init__�*Iterator[tuple[str, SingleCommandOptions]]ccs@�|��D]\}}|�|j�\}}}|rq|�d�|fVqdS)N�.)�items�	partitionrS�lstrip)�clsrc�	full_namerW�pre�_seprur0r0r1r�s��zConfigHandler._section_optionscCst|jj�d���)�.Metadata item name to parser function mapping.z must provide .parsers property)�NotImplementedError�	__class__�__name__�r�r0r0r1�parserss�zConfigHandler.parsersc	
Cs�|j}|j�||�}zt||�}Wnty"}zt|�|�d}~ww|r'dSz
|j�|dd��|�}Wntf|jyBYdSwt	�
|j|�}t|d|��|�}||�|j�
|�dS)NcSs|Sr�r0)�xr0r0r1�<lambda>&�z+ConfigHandler.__setitem__.<locals>.<lambda>�set_)rGr�getrL�AttributeError�KeyErrorr��	Exceptionr&rKr�__setattr__rR�append)	r��option_namerWrG�
current_value�erg�
simple_setter�setterr0r0r1�__setitem__s&
���zConfigHandler.__setitem__�,cCs8t|t�r|Sd|vr|��}n|�|�}dd�|D�S)z�Represents value as a list.

        Value is split either by separator (defaults to comma) or by lines.

        :param value:
        :param separator: List items separator character.
        :rtype: list
        rhcSsg|]
}|��r|���qSr0��strip)rm�chunkr0r0r1�
<listcomp>Bsz-ConfigHandler._parse_list.<locals>.<listcomp>)�
isinstancerA�
splitlines�split)r�rW�	separatorr0r0r1�_parse_list0s



zConfigHandler._parse_listcCsRd}i}|�|�D]}|�|�\}}}||krtd|����|��||��<q	|S)zPRepresents value as a dict.

        :param value:
        :rtype: dict
        �=z&Unable to parse option value to dict: )r�r�rr�)r�rWr��result�linerI�sep�valr0r0r1�_parse_dictDszConfigHandler._parse_dictcCs|��}|dvS)zQRepresents value as boolean.

        :param value:
        :rtype: bool
        )�1�true�yes)�lower�r�rWr0r0r1�_parse_boolUszConfigHandler._parse_boolc��fdd�}|S)z�Returns a parser function to make sure field inputs
        are not files.

        Parses a value after getting the key so error messages are
        more informative.

        :param key:
        :rtype: callable
        cs(d}|�|�rtd��d���t�|�S)N�file:z"Only strings are accepted for the z field, files are not accepted)rl�
ValueErrorr�Str)rW�exclude_directive�rIr0r1�parserks

�
z3ConfigHandler._exclude_files_parser.<locals>.parserr0)r�rIr�r0r�r1�_exclude_files_parser_s	z#ConfigHandler._exclude_files_parser�root_dir�StrPath | NonecCshd}t|t�s	|S|�|�st�|�S|t|�d�}dd�|�d�D�}|j�|�t�t	�
||��S)aORepresents value as a string, allowing including text
        from nearest files using `file:` directive.

        Directive is sandboxed and won't reach anything outside
        directory with setup.py.

        Examples:
            file: README.rst, CHANGELOG.md, src/file.txt

        :param str value:
        :rtype: str
        r�NcSsg|]}|���qSr0r�)rmr:r0r0r1r���z-ConfigHandler._parse_file.<locals>.<listcomp>r�)r�rBrlrr�rrr�r`rar�
read_files)r�rWr��include_directive�spec�	filepathsr0r0r1�_parse_filevs


zConfigHandler._parse_filercCs@d}|�|�st�|�S|�|d�}|�|jj�t�|||�S)z�Represents value as a module attribute.

        Examples:
            attr: package.attr
            attr: package.module.attr

        :param str value:
        :rtype: str
        zattr:�)	rlrr��replacerarbr\r�	read_attr)r�rWr\r��attr_directive�	attr_descr0r0r1�_parse_attr�s


zConfigHandler._parse_attrcr�)z�Returns parser function to represents value as a list.

        Parses a value applying given methods one after another.

        :param parse_methods:
        :rtype: callable
        cs|}�D]}||�}q|Sr�r0)rWrg�method��
parse_methodsr0r1r[�s
z1ConfigHandler._get_parser_compound.<locals>.parser0)r�r�r[r0r�r1�_get_parser_compound�s
z"ConfigHandler._get_parser_compoundcCs,i}|��D]
\}\}}|||�||<q|S)aParses section options into a dictionary.

        Applies a given parser to each option in a section.

        :param dict section_options:
        :param callable values_parser: function with 2 args corresponding to key, value
        :rtype: dict
        )r�)r��section_options�
values_parserrWrI�_r�r0r0r1�_parse_section_to_dict_with_key�s
z-ConfigHandler._parse_section_to_dict_with_keyNcs$�r�fdd�ndd�}|�||�S)aParses section options into a dictionary.

        Optionally applies a given parser to each value.

        :param dict section_options:
        :param callable values_parser: function with 1 arg corresponding to option value
        :rtype: dict
        cs�|�Sr�r0�r��v�r�r0r1r��sz6ConfigHandler._parse_section_to_dict.<locals>.<lambda>cSs|Sr�r0r�r0r0r1r��r�)r�)r�r�r�r�r0r�r1�_parse_section_to_dict�s
z$ConfigHandler._parse_section_to_dictc	CsL|��D]\}\}}t�t��|||<Wd�n1swYqdS)zQParses configuration file section.

        :param dict section_options:
        N)r��
contextlib�suppressr�)r�r�rur�rWr0r0r1�
parse_section�s
���zConfigHandler.parse_sectioncCsl|j��D].\}}d}|rd|��}t|d|���dd�d�}|dur/td|j�d|�d���||�qdS)	zTParses configuration file items from one
        or more related sections.

        r�r�r�r��__Nz*Unsupported distribution option section: [�])r�r�rLr�rrS)r��section_namer��method_postfix�section_parser_methodr0r0r1r[�s&
����
�zConfigHandler.parsecst�����fdd��}|S)z�this function will wrap around parameters that are deprecated

        :param msg: deprecation message
        :param func: function to be wrapped around
        cs.��dd�tjd�fi����|i|��S)N�
stacklevelrz Deprecated config in `setup.cfg`)�
setdefault�_DeprecatedConfigrw)�args�kwargs��func�kwr|r0r1�config_handler�sz@ConfigHandler._deprecated_config_handler.<locals>.config_handler)r)r�r�r|r�r�r0r�r1�_deprecated_config_handler�sz(ConfigHandler._deprecated_config_handler)rGr"rcr!rbr�r'r�)rcr!r'r��r'r�)r�)r�r�)r�rr�)r��
__module__�__qualname__�__doc__�__annotations__rr��classmethodr��propertyr�r�r�r�r�r�r�r�r�r�r�r�r[r�r0r0r0r1r~�s>

	



	







r~csReZdZdZddddd�ZdZ	dejfd�fdd�
Ze	dd��Z
dd�Z�ZS)r]r^�url�description�classifiers�	platforms)�	home_page�summary�
classifier�platformFNrGrrcr!r&r%rbr�r\�dict | Noner�r�r'r�cs"t��||||�||_||_dSr�)�superr�r\r�)r�rGrcr&rbr\r��r�r0r1r�s	
zConfigMetadataHandler.__init__cCs�|�|jtj�}|�|jtj�}t|j|jd�}|j	}idtj
�dtj
�dtj
�dtj
�d|�d|�d|�d	|�d
|�||��d|d��d|�d
|�d|�dtj
�d|j�dtj
�d|�S)r��r��author�author_email�
maintainer�maintainer_emailr��keywords�provides�	obsoletesr��license�
license_filesr��long_description�long_description_content_type�versionr��project_urls)r�r�r�Listr��Dictrr�r�r�r��_parse_version)r��parse_list_static�parse_dict_static�
parse_file�exclude_files_parserr0r0r1r�%sN��������	�
���
�����zConfigMetadataHandler.parsersc
Cst|�||j�}||kr.|��}zt|�W|Sty-}ztd|�d|���|�d}~wwt�|�||j	|j��S)zSParses `version` option value.

        :param value:
        :rtype: str

        zVersion loaded from z does not comply with PEP 440: N)
r�r�r�rrrrrr�r\)r�rWrr�r0r0r1rAs"
������z$ConfigMetadataHandler._parse_version)rGrrcr!r&r%rbr�r\rr�r�r'r�)
r�r�r�rSr�strict_moder9�curdirr�r�r�r�
__classcell__r0r0rr1r]s��
r]cs�eZdZdZd*�fdd�Zed
d��Zdd�Zd+dd�Ze	dd��Z
dd�Zdd�Zdd�Z
d,dd�Zd d!�Zd,d"d#�Zd,d$d%�Zd,d&d'�Zd,d(d)�Z�ZS)-rZrcrGrr!r&r%rbr�r'r�cs$t��||||�|j|_i|_dSr�)rr�r_r�r\r�rr0r1r�^s
zConfigOptionsHandler.__init__cCs|j|dd�S)N�;)r�)r�r�r0r0r1�_parse_list_semicolonisz*ConfigOptionsHandler._parse_list_semicoloncCs|j||jd�S)Nr)r�r�)r�rWr0r0r1�_parse_file_in_rootmsz(ConfigOptionsHandler._parse_file_in_rootrerBrWcCs0|�|�|��}t|||�t�dd�|D��S)Ncss�|]
}|�d�s|VqdS)�#Nrk)rmr�r0r0r1rpvrqz@ConfigOptionsHandler._parse_requirements_list.<locals>.<genexpr>)rrr}rr)r�rerWrgr0r0r1�_parse_requirements_listpsz-ConfigOptionsHandler._parse_requirements_listcCsN|j}|j}|j}|||j||||�|d�t|jd�|j|j|j	|t
j|d�S)r�zeThe namespace_packages parameter is deprecated, consider using implicit namespaces instead (PEP 420).�install_requires)�zip_safe�include_package_datar\�scripts�eager_resources�dependency_links�namespace_packagesr!�setup_requires�packages�entry_points�
py_modules�python_requires�cmdclass)r�r��_parse_cmdclassr�r�rr r�_parse_packagesrr�SpecifierSet)r��
parse_list�
parse_bool�parse_cmdclassr0r0r1r�ys.���zConfigOptionsHandler.parserscCs|jj}t�|�|�||j�Sr�)rbr\rr-r�r�)r�rWr\r0r0r1r.�sz$ConfigOptionsHandler._parse_cmdclasscCsbddg}|��}||vr|�|�S|�|j�di��}|j||dk|j|jd�tj	di|��S)zTParses `packages` option value.

        :param value:
        :rtype: list
        zfind:zfind_namespace:z
packages.findr)�
namespacesr��fill_package_dirNr0)
r�r��parse_section_packages__findr�r�rar�r\r�
find_packages)r�rW�find_directives�
trimmed_value�find_kwargsr0r0r1r/�s
�
�z$ConfigOptionsHandler._parse_packagescsN|�||j�}gd���fdd�|��D�}|�d�}|dur%|d|d<|S)z�Parses `packages.find` configuration file section.

        To be used in conjunction with _parse_packages().

        :param dict section_options:
        )�where�include�excludecs"i|]
\}}|�vr|r||�qSr0r0)rm�kr���
valid_keysr0r1�
<dictcomp>�s"zEConfigOptionsHandler.parse_section_packages__find.<locals>.<dictcomp>r;Nr)r�r�r�r�)r�r��section_datar:r;r0r?r1r6�s
z1ConfigOptionsHandler.parse_section_packages__findcCs|�||j�}||d<dS)z`Parses `entry_points` configuration file section.

        :param dict section_options:
        r*N)r�r��r�r�rgr0r0r1�parse_section_entry_points�sz/ConfigOptionsHandler.parse_section_entry_pointscCs|�||j�}t�|�Sr�)r�r�r�canonic_package_data)r�r��package_datar0r0r1�_parse_package_data�s
z(ConfigOptionsHandler._parse_package_datacC�|�|�|d<dS)z`Parses `package_data` configuration file section.

        :param dict section_options:
        rFN�rG�r�r�r0r0r1�parse_section_package_data��z/ConfigOptionsHandler.parse_section_package_datacCrH)zhParses `exclude_package_data` configuration file section.

        :param dict section_options:
        �exclude_package_dataNrIrJr0r0r1�"parse_section_exclude_package_data�rLz7ConfigOptionsHandler.parse_section_exclude_package_datacs&��|�fdd��}t�|��d<dS)zbParses `extras_require` configuration file section.

        :param dict section_options:
        cs��d|�d�|�S)Nzextras_require[r�)r )r>r�r�r0r1r��r�zCConfigOptionsHandler.parse_section_extras_require.<locals>.<lambda>�extras_requireN)r�rrrCr0r�r1�parse_section_extras_require�s

�z1ConfigOptionsHandler.parse_section_extras_requirecCs$|�||j�}t�||j�|d<dS)z^Parses `data_files` configuration file section.

        :param dict section_options:
        �
data_filesN)r�r�r�canonic_data_filesr�rCr0r0r1�parse_section_data_files�sz-ConfigOptionsHandler.parse_section_data_files)
rGrrcr!r&r%rbr�r'r�)rerBrWrBr�)r�r�r�rSr�r�rrr r�r�r.r/r6rDrGrKrNrPrSrr0r0rr1rZ[s$

	





rZc@s$eZdZdZdZdZedd��ZdS)rvzAmbiguous requirement marker.z�
    One of the parsed requirements in `{field}` looks like a valid environment marker:

        {req!r}

    Please make sure that the configuration file is correct.
    You can use dangling lines to avoid this problem.
    z'userguide/declarative_config.html#opt-2cKs"d|j��}|j|j|j||d�S)Nz%https://setuptools.pypa.io/en/latest/)�see_url�format_args)�	_SEE_DOCS�_format�_SUMMARY�_DETAILS)r�r��docsr0r0r1rysz_AmbiguousMarker.messageN)r�r�r�rXrYrVr�ryr0r0r0r1rv�srvc@seZdZdZdS)r�z!userguide/declarative_config.htmlN)r�r�r�rVr0r0r0r1r�sr�)FF)r#rr$r%r&r%r'r()r-rr#rr'r)r0F)
r-rr#rr5r6r&r%r'r7)rGrHrIrB)r/rQr'r()F)rXrrDr!r&r%r'r7)rerBrfrBrgrA)Ar��
__future__rr�rKr9�collectionsr�collections.abcrrrr�typingrr	r
rrr
r�packaging.markersrrs�packaging.requirementsrr�packaging.versionrrr�r�_pathr�errorsrr�warningsrr�typing_extensionsrr)r�distutils.distrr(rB�tupler r�r!r"r2r4r+rPr,rCr}r~r]rZrvr�r0r0r0r1�<module>sZ$�
�

�
. &S