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: //proc/self/root/usr/local/lib/python3.10/dist-packages/wheel/__pycache__/metadata.cpython-310.pyc
o

��h�@s�dZddlmZddlZddlZddlZddlZddlZddl	m
Z
ddlmZddl
mZmZmZmZddlmZd3dd
�Zejd4dd��Ze�e�d5dd��Zd6dd�Zd7dd�Zd8dd �Zd9d#d$�Zd:d'd(�Zd;d,d-�Zd<d1d2�Z dS)=z2
Tools for converting old- to new-style metadata.
�)�annotationsN)�Message)�Parser)�	Generator�Iterable�Iterator�Literal�)�Requirement�str�return�bool | Literal['']cCs|o|�d�S)N�#)�
startswith)r�r�9/usr/local/lib/python3.10/dist-packages/wheel/metadata.py�	_nonblanksr�iterable�
Iterable[str]�
Iterator[str]cCstj�tt|��S)a�
    Yield valid lines of a string or iterable.
    >>> list(yield_lines(''))
    []
    >>> list(yield_lines(['foo', 'bar']))
    ['foo', 'bar']
    >>> list(yield_lines('foo\nbar'))
    ['foo', 'bar']
    >>> list(yield_lines('\nfoo\n#bar\nbaz #comment'))
    ['foo', 'baz #comment']
    >>> list(yield_lines(['foo\nbar', 'baz', 'bing\n\n\n']))
    ['foo', 'bar', 'baz', 'bing']
    )�	itertools�chain�
from_iterable�map�yield_lines)rrrrrsr�textcCsttttj|����S�N)�filterrrr�strip�
splitlines)rrrr�_)sr �s�str | Iterator[str]�3Generator[tuple[str | None, list[str]], None, None]ccsv�d}g}t|�D]*}|�d�r.|�d�r)|s|r||fV|dd���}g}q	td|��|�|�q	||fVdS)arSplit a string or iterable thereof into (section, content) pairs
    Each ``section`` is a stripped version of the section header ("[section]")
    and each ``content`` is a list of stripped lines excluding blank lines and
    comment-only lines.  If there are any such lines before the first section
    header, they're returned in a first ``section`` of ``None``.
    N�[�]r	���zInvalid section heading)rr�endswithr�
ValueError�append)r!�section�content�linerrr�split_sections.s�	



r-�extracCst�dd|���S)z�Convert an arbitrary string to a standard 'extra' name
    Any runs of non-alphanumeric characters are replaced with a single '_',
    and the result is always lowercased.
    z[^A-Za-z0-9.-]+r )�re�sub�lower)r.rrr�
safe_extraIsr2�namecCst�dd|�S)z�Convert an arbitrary string to a standard distribution name
    Any runs of non-alphanumeric/. characters are replaced with a single '-'.
    z[^A-Za-z0-9.]+�-)r/r0)r3rrr�	safe_nameQsr5�requirementr
cCsL|jrd|jSg}|jD]}|�|j|j�q
|r$dd�t|��SdS)zFReturn the version specifier for a requirement in PEP 345/566 fashion.z @ � �,�)�url�	specifierr)�operator�version�join�sorted)r6�
requires_dist�specrrr�requires_to_requires_distXs

rB�requirements�	list[str]ccs^�|D])}t|�}t|�}d�tdd�|jD���}|r"d|�d�}t|j�||VqdS)z=Yield Requires-Dist: strings for parsed requirements strings.r8css�|]}t|�VqdSr)r2)�.0�errr�	<genexpr>ls�z'convert_requirements.<locals>.<genexpr>r$r%N)r
rBr>r?�extrasr5r3)rC�req�parsed_requirementrArHrrr�convert_requirementsgs��rK�extras_require�dict[str | None, list[str]]�Iterator[tuple[str, str]]ccs��|��D]K\}}d}|pd}d|vr|�dd�\}}t|�}|r6d|fV|r.d|d}|d|�d�7}|r<d	|}t|�D]}tt||��}d
|fVq@qdS)a,
    Convert requirements from a setup()-style dictionary to
    ('Requires-Dist', 'requirement') and ('Provides-Extra', 'extra') tuples.

    extras_require is a dictionary of {extra: [requirements]} as passed to setup(),
    using the empty extra {'': [requirements]} to hold install_requires.
    r9�:r	�Provides-Extra�(z) and z
extra == '�'z ; �
Requires-DistN)�items�splitr2rKrr
)rLr.�depends�	condition�new_req�
canonical_reqrrr�generate_requirementsss&�

��rZ�
egg_info_path�pkginfo_pathrc
CsFt|dd��}t��|�}Wd�n1swY|�dd�|d=|d=tj�|d�}tj�|�rwt|dd��}|��}Wd�n1sJwYt	t
|�d	d
�d�}|D]\}}	t||	i�D]\}
}|
|f|��vru|||
<qeq[|d}|r�|d�
�}
d
�|
d��t�d
�|
dd���d
f�}|�|�|d=|S)zN
    Convert .egg-info directory with PKG-INFO to the Metadata 2.1 format
    zutf-8)�encodingNzMetadata-Versionz2.1rPrSzrequires.txtcSs|dpdS)Nrr9r)�xrrr�<lambda>�sz%pkginfo_to_metadata.<locals>.<lambda>)�key�Description�
rr	)�openr�parse�replace_header�os�pathr>�exists�readr?r-rZrTr�lstrip�textwrap�dedent�set_payload)r[r\�headers�pkg_info�
requires_path�
requires_file�requires�parsed_requirementsr.�reqsr`�value�description�description_lines�dedented_descriptionrrr�pkginfo_to_metadata�s<�
���
��
	ry)rrrr
)rrrr)rrrr)r!r"rr#)r.rrr)r3rrr)r6r
rr)rCrDrr)rLrMrrN)r[rr\rrr)!�__doc__�
__future__r�	functoolsr�os.pathrfr/rk�
email.messager�email.parserr�typingrrrr�vendored.packaging.requirementsr
r�singledispatchr�registerrr r-r2r5rBrKrZryrrrr�<module>s.