관리-도구
편집 파일: _normalization.cpython-312.pyc
� t��ev � � � d Z ddlZddlmZ ddlmZ ddlmZ eeef Z ej dej � Z ej dej � Z ej d ej � Z ej d ej � Zdedefd �Zdedefd�Zdedefd�Zdedefd�Zdedefd�Zdedefd�Zdedefd�Zdedefd�Zy)zZ Helpers for normalization as expected in wheel/sdist/module file names and core metadata � N)�Path)�Union� )� packagingz)^([A-Z0-9]|[A-Z0-9][A-Z0-9._-]*[A-Z0-9])$z[^A-Z0-9.]+z [^A-Z0-9]+z,^v?(?P<safe>(?:[0-9]+!)?[0-9]+(?:\.[0-9]+)*)�name�returnc �X � t j dd| � }|j � sJ �|S )z�Make a string safe to be used as Python identifier. >>> safe_identifier("12abc") '_12abc' >>> safe_identifier("__editable__.myns.pkg-78.9.3_local") '__editable___myns_pkg_78_9_3_local' z \W|^(?=\d)�_)�re�sub�isidentifier)r �safes ��/builddir/build/BUILDROOT/alt-python312-setuptools-69.0.2-1.el8.x86_64/opt/alt/python312/lib/python3.12/site-packages/setuptools/_normalization.py�safe_identifierr s* � � �6�6�-��d�+�D�������K� � componentc �. � t j d| � S )z�Escape a component used as a project name according to Core Metadata. >>> safe_name("hello world") 'hello-world' >>> safe_name("hello?world") 'hello-world' �-)�_UNSAFE_NAME_CHARSr )r s r � safe_namer s � � �!�!�#�y�1�1r �versionc �: � | j dd� } t t j j |� � S # t j j $ rA t j d|� }t t j j |� � cY S w xY w)a Convert an arbitrary string into a valid version string. Can still raise an ``InvalidVersion`` exception. To avoid exceptions use ``best_effort_version``. >>> safe_version("1988 12 25") '1988.12.25' >>> safe_version("v0.2.1") '0.2.1' >>> safe_version("v0.2?beta") '0.2b0' >>> safe_version("v0.2 beta") '0.2b0' >>> safe_version("ubuntu lts") Traceback (most recent call last): ... setuptools.extern.packaging.version.InvalidVersion: Invalid version: 'ubuntu.lts' � �.r )�replace�strr r �Version�InvalidVersionr r )r �v�attempts r �safe_versionr! + s~ � �"