File manager - Edit - /opt/saltstack/salt/lib/python3.10/site-packages/setuptools/_vendor/wheel/__pycache__/_metadata.cpython-310.pyc
Back
o ;j, � @ s� d Z ddlmZ ddlZddlZddlZddlZddlZddl m Z mZmZ ddl mZ ddlmZ ddlmZ ddlmZ d3dd �Zejd4dd��Ze�e�d5dd��Zd6dd�Zd7dd�Zd8dd �Zd9d#d$�Zd:d'd(�Zd;d,d-�Z d<d1d2�Z!dS )=z2 Tools for converting old- to new-style metadata. � )�annotationsN)� Generator�Iterable�Iterator)�Message)�Parser)�Literal)�Requirement�str�return�bool | Literal['']c C s | o| � d� S )N�#)� startswith)r � r �V/opt/saltstack/salt/lib/python3.10/site-packages/setuptools/_vendor/wheel/_metadata.py� _nonblank s r �iterable� Iterable[str]� Iterator[str]c C s t j�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)r r r r r s r �textc C s t tttj| �� ��S �N)�filterr r r �strip� splitlines)r r r r �_* s r �s�str | Iterator[str]�3Generator[tuple[str | None, list[str]], None, None]c c sv � d}g }t | �D ]*}|�d�r.|�d�r)|s|r||fV |dd� �� }g }q td|��|�|� q ||fV dS )ar Split 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�[�]� ���zInvalid section heading)r r �endswithr � ValueError�append)r �section�content�liner r r �split_sections/ s � r- �extrac C s t �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. r r r � safe_extraJ s r2 �namec C s t �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 )r3 r r r � safe_nameR s r5 �requirementr c C sL | j rd| j S g }| jD ]}|�|j|j � q |r$dd�t|�� S dS )zFReturn the version specifier for a requirement in PEP 345/566 fashion.z @ � �,� )�urlZ specifierr) �operator�version�join�sorted)r6 Z requires_dist�specr r r �requires_to_requires_distY s r@ �requirements� list[str]c c s^ � | D ])}t |�}t|�}d�tdd� |jD ���}|r"d|� d�}t|j�| | V qdS )z=Yield Requires-Dist: strings for parsed requirements strings.r8 c s s � | ]}t |�V qd S r )r2 )�.0�er r r � <genexpr>m s � z'convert_requirements.<locals>.<genexpr>r# r$ N)r r@ r= r>