관리-도구
편집 파일: utils.cpython-311.pyc
� �܋f� � � � d dl mZ d dlZd dlmZmZmZmZ ddlm Z m Z ddlmZm Z eed eeef f Z ede� � Z G d � d e� � Z G d� de� � Z G d � de� � Z ej dej � � Z ej d� � Z ej d� � Z ej d� � Zdd�d'd�Zd(d�Zdd�d)d!�Zd*d$�Zd+d&�Z dS ),� )�annotationsN)�NewType�Tuple�Union�cast� )�Tag� parse_tag)�InvalidVersion�Version� �NormalizedNamec � � e Zd ZdZdS )�InvalidNamezW An invalid distribution name; users should refer to the packaging user guide. N��__name__� __module__�__qualname__�__doc__r � �R/opt/cloudlinux/venv/lib64/python3.11/site-packages/pip/_vendor/packaging/utils.pyr r � � � � � � �� � � r r c � � e Zd ZdZdS )�InvalidWheelFilenamezM An invalid wheel filename was found, users should refer to PEP 427. Nr r r r r r r r r c � � e Zd ZdZdS )�InvalidSdistFilenamez^ An invalid sdist filename was found, users should refer to the packaging user guide. Nr r r r r r r r r z)^([A-Z0-9]|[A-Z0-9][A-Z0-9._-]*[A-Z0-9])$z[-_.]+z/^([a-z0-9]|[a-z0-9]([a-z0-9-](?!--))*[a-z0-9])$z (\d+)(.*)F)�validate�name�strr �bool�returnc �� � |r,t � | � � st d| ��� � �t � d| � � � � � }t t |� � S )Nzname is invalid: �-)�_validate_regex�matchr �_canonicalize_regex�sub�lowerr r )r r �values r �canonicalize_namer* - sg � �� 8��-�-�d�3�3� 8��6�d�6�6�7�7�7��#�#�C��.�.�4�4�6�6�E����&�&�&r c �: � t � | � � d uS �N)�_normalized_regexr% )r s r �is_normalized_namer. 5 s � ��"�"�4�(�(��4�4r T)�strip_trailing_zero�version� Version | strr/ c �� � t | t � � r# t | � � }n# t $ r | cY S w xY w| }g }|j dk r|� |j � d�� � d� d� |j D � � � � }|rt j dd|� � }|� |� � |j �7|� d� d� |j D � � � � � � |j �|� d |j � �� � |j �|� d |j � �� � |j �|� d|j � �� � d� |� � S )z� This is very similar to Version.__str__, but has one subtle difference with the way it handles the release segment. r �!�.c 3 �4 K � | ]}t |� � V � �d S r, �r ��.0�xs r � <genexpr>z'canonicalize_version.<locals>.<genexpr>P s( � � � �>�>�!�s�1�v�v�>�>�>�>�>�>r z(\.0)+$� Nc 3 �4 K � | ]}t |� � V � �d S r, r6 r7 s r r: z'canonicalize_version.<locals>.<genexpr>X s( � � � �8�8��S��V�V�8�8�8�8�8�8r z.postz.dev�+)� isinstancer r r �epoch�append�join�release�rer'