관리-도구
편집 파일: metadata.cpython-38.pyc
U -?�f � @ s* d Z ddlmZ ddlZddlZddlZddlZddlZddl m Z ddlmZ ddl mZmZmZmZ ddlmZ d d d�dd �Zejddd�dd��Ze�e�d dd�dd��Zddd�dd�Zd d d�dd�Zd d d�dd �Zd!d d"�d#d$�Zd%dd&�d'd(�Zd)d*d+�d,d-�Zd d d.d/�d0d1�Z dS )2z2 Tools for converting old- to new-style metadata. � )�annotationsN)�Message)�Parser)� Generator�Iterable�Iterator�Literal� )�Requirement�strzbool | Literal[''])r �returnc C s | o| � d� S )N�#)� startswith)r � r �</opt/hc_python/lib/python3.8/site-packages/wheel/metadata.py� _nonblank s r z Iterable[str]z Iterator[str])�iterabler 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 )�textr c C s t tttj| �� ��S �N)�filterr r r �strip� splitlines)r r r r �_) s r zstr | Iterator[str]z3Generator[tuple[str | None, list[str]], None, None])�sr c c sv d}g }t | �D ]V}|�d�r\|�d�rP|s0|r:||fV |dd� �� }g }qftd|��q|�|� 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�[�]r ���zInvalid section heading)r r �endswithr � ValueError�append)r �section�content�liner r r �split_sections. s r( )�extrar c 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_extraI s r- )�namer c 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* r+ )r. r r r � safe_nameQ s r0 r )�requirementr c C sP | j rd| j S g }| jD ]}|�|j|j � q|rHdd�t|�� S dS dS )zFReturn the version specifier for a requirement in PEP 345/566 fashion.z @ � �,� N)�url� specifierr$ �operator�version�join�sorted)r1 Z requires_dist�specr r r �requires_to_requires_distX s r<