
    n&phs                        S r SSKrSSKJr  SSKr\R
                  " S\R                  5      r\R
                  " S\R                  5      r\R
                  " S\R                  5      r	\R
                  " S\R                  5      r
S\S	\4S
 jrS\S	\4S jrS\S	\4S jrS\S	\4S jrS\S	\4S jrS\S	\4S jrS\S	\4S jrS\S	\4S jrS\S	\4S jrS\S	\4S jr SSKJr  g! \ a    \(       d  \r g gf = f)zZ
Helpers for normalization as expected in wheel/sdist/module file names
and core metadata
    N)TYPE_CHECKINGz)^([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                 d    [         R                  " SSU 5      nUR                  5       (       d   eU$ )zMake 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     L/var/www/html/venv/lib/python3.13/site-packages/setuptools/_normalization.pysafe_identifierr      s0     66-d+DK    	componentc                 .    [         R                  SU 5      $ )zEscape a component used as a project name according to Core Metadata.
>>> safe_name("hello world")
'hello-world'
>>> 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                 <   U R                  SS5      n [        [        R                  R	                  U5      5      $ ! [        R                  R
                   aA    [        R                  SU5      n[        [        R                  R	                  U5      5      s $ f = f)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):
...
packaging.version.InvalidVersion: Invalid version: 'ubuntu.lts'
 .r   )replacestr	packagingr   VersionInvalidVersionr   r	   )r   vattempts      r   safe_versionr   *   s~    " 	S!A79$$,,Q/00++ 7$((a09$$,,W5667s   '< ABBc                     [        U 5      $ ! [        R                  R                   a    U R	                  SS5      n[
        R                  U5      nU(       a  US   nU[        U5      S nOSnU n[        R                  SU5      R                  S5      nSU 3R                  S5      n[        U SU 35      s $ f = f)a  Convert an arbitrary string into a version-like string.
Fallback when ``safe_version`` is not safe enough.
>>> best_effort_version("v0.2 beta")
'0.2b0'
>>> best_effort_version("ubuntu lts")
'0.dev0+sanitized.ubuntu.lts'
>>> best_effort_version("0.23ubuntu1")
'0.23.dev0+sanitized.ubuntu1'
>>> best_effort_version("0.23-")
'0.23.dev0+sanitized'
>>> best_effort_version("0.-_")
'0.dev0+sanitized'
>>> best_effort_version("42.+?1")
'42.dev0+sanitized.1'
r   r   r   N0z
sanitized.z.dev0+)r   r   r   r   r   _PEP440_FALLBACKsearchlen_NON_ALPHANUMERICr	   strip)r   r   matchr   rest	safe_restlocals          r   best_effort_versionr+   C   s     4G$$++ 4OOC% ''*=DSY[>DDD%))#t4::3?	YK(..s3tfF5'2334s   
 B-B=<B=extrac                 h    [         R                  SU 5      R                  S5      R                  5       $ )zNormalize extra name according to PEP 685
>>> safe_extra("_FrIeNdLy-._.-bArD")
'friendly-bard'
>>> safe_extra("FrIeNdLy-._.-bArD__._-")
'friendly-bard'
r   )r%   r	   r&   lower)r,   s    r   
safe_extrar/   c   s+       e,2237==??r   valuec                 D    U R                  SS5      R                  S5      $ )zNormalize each component of a filename (e.g. distribution/version part of wheel)
Note: ``value`` needs to be already normalized.
>>> filename_component("my-pkg")
'my_pkg'
r   r   )r   r&   r0   s    r   filename_componentr3   m   s      ==c"((--r   c                 &    U R                  SS5      $ )z
Produce the incorrect filename component for compatibility.

See pypa/setuptools#4167 for detailed analysis.

TODO: replace this with filename_component after pip 24 is
nearly-ubiquitous.

>>> filename_component_broken('foo_bar-baz')
'foo-bar-baz'
r   r   )r   r2   s    r   filename_component_brokenr5   v   s     ==c""r   c                     [         R                  " SS[        U 5      5      R                  5       R	                  SS5      $ )zBLike ``safe_name`` but can be used as filename component for wheelz[-_.]+r   r   )r   r	   r   r.   r   r2   s    r   
safer_namer7      s1    
 	y#y/0		c	r   c                 *    [        [        U 5      5      $ )zLLike ``best_effort_version`` but can be used as filename component for wheel)r3   r+   r2   s    r   safer_best_effort_versionr9      s     1%899r   
expressionc                     [        S5      e)a  
Defer import error to affect only users that actually use it
https://github.com/pypa/setuptools/issues/4894
>>> _missing_canonicalize_license_expression("a OR b")
Traceback (most recent call last):
...
ImportError: ...Cannot import `packaging.licenses`...
zCannot import `packaging.licenses`.
        Setuptools>=77.0.0 requires "packaging>=24.2" to work properly.
        Please make sure you have a suitable version installed.
        )ImportError)r:   s    r   (_missing_canonicalize_license_expressionr=      s     	 r   )canonicalize_license_expression)__doc__r   typingr   r   compileI_VALID_NAMEr   r%   r"   r   r   r   r   r+   r/   r3   r5   r7   r9   r=   packaging.licensesr>    _canonicalize_license_expressionr<    r   r   <module>rG      s[  
 
    jjErttLZZ 0"$$7 JJ}bdd3 ::MrttT 	# 	# 		2 	2 	27# 7# 724 4 4@@c @c @.c .c .#S #S #	c 	c 	:S :S :  $T  T+S( Ts    C' 'C;:C;