efvzdZddlZddlmZddlmZddlmZeeefZ ej dej Z ej dej Z ej d ej Zej d ej Zd ed efd Zded efdZded efdZded efdZded efdZded efdZded efdZded efdZdS)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(?:[0-9]+!)?[0-9]+(?:\.[0-9]+)*)namereturnc^tjdd|}|sJ|S)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)_)resub isidentifier)rsafes y/builddir/build/BUILD/imunify360-venv-2.3.5/opt/imunify360/venv/lib/python3.11/site-packages/setuptools/_normalization.pysafe_identifierrs4 6-d + +D       K componentc8td|S)zEscape 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 )rs r safe_namer s  ! !#y 1 11rversioncJ|dd} ttj|S#tjj$rJt d|}ttj|cYSwxYw)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)replacestrrrVersionInvalidVersionrr )rvattempts r safe_versionr!+s" S!!A79$,,Q//000   +777$((a009$,,W55666667s+AAB"!B"c t|S#tjj$r|dd}t |}|r |d}|t|d}nd}|}t d| d}d| d}t|d|cYSwxYw)aConvert 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' rrrN0z sanitized.z.dev0+) r!rrrr_PEP440_FALLBACKsearchlen_NON_ALPHANUMERICr strip)rrmatchrrest safe_restlocals rbest_effort_versionr-Ds" 4G$$$   + 4 4 4 OOC % % ''**  =DSYY[[>DDDD%))#t44::3?? (Y((..s33t2252233333 4sCCCextractd|dS)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_extrar1es4  e , , 2 23 7 7 = = ? ??rvaluecT|dddS)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' rr )rr(r2s rfilename_componentr5os& ==c " " ( ( - --rc:tt|S)zBLike ``safe_name`` but can be used as filename component for wheel)r5rr4s r safer_namer7xs i.. / //rc:tt|S)zLLike ``best_effort_version`` but can be used as filename component for wheel)r5r-r4s rsafer_best_effort_versionr9~s 1%88 9 99r)__doc__r pathlibrtypingrexternrr_PathcompileI _VALID_NAMErr'r$rrr!r-r1r5r7r9rrrCs  c4ibjErtLL RZ55BJ}bd332:MrtTT # #    2222227#7#77772444444B@c@c@@@@.c.c....0c0c0000 :S:S::::::r