HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //usr/local/lib/python3.7/site-packages/wheel/__pycache__/metadata.cpython-37.pyc
B

O��g��@s�dZddlmZddlZddlZddlZddlZddlZddl	m
Z
ddlmZddl
mZddlmZd	d
�Zejdd��Ze�e�d
d��Zdd�Zdd�Zdd�Zddd�dd�Zddd�dd�Zdd d!�d"d#�Zddd$d%�d&d'�ZdS)(z2
Tools for converting old- to new-style metadata.
�)�annotationsN)�Message)�Parser)�Iterator�)�RequirementcCs|o|�d�S)N�#)�
startswith)�str�r�2/tmp/pip-unpacked-wheel-f1gdtpe6/wheel/metadata.py�	_nonblanksr
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)�iterablerrrrsrcCsttttj|����S)N)�filterr
rr
�strip�
splitlines)�textrrr�_(srccszd}g}xbt|�D]V}|�d�r^|�d�rR|s2|r<||fV|dd���}g}qhtd|��q|�|�qW||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)�s�section�content�linerrr�split_sections-s


r#cCst�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)�extrarrr�
safe_extraFsr(cCst�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$r%)�namerrr�	safe_nameNsr+rr
)�requirement�returncCsZt|dd�rd|jSg}x |jD]}|�|j|j�q"W|rRdd�t|��SdSdS)zFReturn the version specifier for a requirement in PEP 345/566 fashion.�urlNz @ � �,�)�getattrr.�	specifierr�operator�version�join�sorted)r,Z
requires_dist�specrrr�requires_to_requires_distUs
r9z	list[str]z
Iterator[str])�requirementsr-ccs`xZ|D]R}t|�}t|�}d�tdd�|jD���}|rDd|�d�}t|j�||VqWdS)z=Yield Requires-Dist: strings for parsed requirements strings.r0css|]}t|�VqdS)N)r()�.0�errr�	<genexpr>isz'convert_requirements.<locals>.<genexpr>rrN)rr9r6r7�extrasr+r*)r:�reqZparsed_requirementr8r>rrr�convert_requirementsds
r@zdict[str, list[str]]zIterator[tuple[str, str]])�extras_requirer-ccs�x�|��D]�\}}d}|pd}d|kr6|�dd�\}}t|�}|rhd|fV|r\d|d}|d|7}|rtd|}xt|�D]}d	||fVq~Wq
Wd
S)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.
    r1�:rzProvides-Extra�(z) and z
extra == '%s'z ; z
Requires-DistN)�items�splitr(r@)rAr'�depends�	conditionZnew_reqrrr�generate_requirementsps

rHr)�
egg_info_path�pkginfo_pathr-c
Cs(t|dd��}t��|�}WdQRX|�dd�|d=|d=tj�|d�}tj�|�r�t|dd��}|��}WdQRXt	t
|�d	d
�d�}xB|D]:\}}	x0t||	i�D] \}
}|
|f|��kr�|||
<q�Wq�W|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.1zProvides-Extraz
Requires-Distzrequires.txtcSs|dp
dS)Nrr1r)�xrrr�<lambda>��z%pkginfo_to_metadata.<locals>.<lambda>)�key�Description�
rr)�openr�parse�replace_header�os�pathr6�exists�readr7r#rHrDr�lstrip�textwrap�dedent�set_payload)rIrJ�headers�pkg_infoZ
requires_pathZ
requires_file�requiresZparsed_requirementsr'�reqsrO�value�descriptionZdescription_linesZdedented_descriptionrrr�pkginfo_to_metadata�s0

rc)�__doc__�
__future__r�	functoolsr�os.pathrUr$rZ�
email.messager�email.parserr�typingrZvendored.packaging.requirementsrr
�singledispatchr�registerr
rr#r(r+r9r@rHrcrrrr�<module>s(