Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes15kdownloads
_normalization.cpython-313.pyc98 linesDownload Raw Back to __pycache__
1�

2��j�����SrSSKrSSKJr SSKr\R3"S\R5r\R4"S\R5r\R5"S\R5r	\R6"S\R5r7S\S	\4S8jrS\S	\4Sjr
S
\S	\4SjrS
\S	\4SjrS\S	\4SjrS\S	\4SjrS\S	\4SjrS\S	\4SjrS\S	\4SjrS\S	\4SjrSSKJr g!\a \(d\rggf=f)zZ9Helpers for normalization as expected in wheel/sdist/module file names10and core metadata11�N)�
TYPE_CHECKINGz)^([A-Z0-9]|[A-Z0-9][A-Z0-9._-]*[A-Z0-9])$z
[^A-Z0-9._-]+z12[^A-Z0-9]+z,^v?(?P<safe>(?:[0-9]+!)?[0-9]+(?:\.[0-9]+)*)�name�returnc�d�[R"SSU5nUR5(deU$)z�Make a string safe to be used as Python identifier.13>>> safe_identifier("12abc")14'_12abc'15>>> safe_identifier("__editable__.myns.pkg-78.9.3_local")16'__editable___myns_pkg_78_9_3_local'17z18\W|^(?=\d)�_)�re�sub�isidentifier)r�safes  �_D:\code\apps\devtools\python\user_packages\Python313\site-packages\setuptools/_normalization.py�safe_identifierr
s0���6�6�-��d�+�D���������K��	componentc�.�[RSU5$)z�Escape a component used as a project name according to Core Metadata.19>>> safe_name("hello world")20'hello-world'21>>> safe_name("hello?world")22'hello-world'23>>> safe_name("hello_world")24'hello_world'25�-)�_UNSAFE_NAME_CHARSr	)rs r�	safe_namer s���!�!�#�y�1�1r�versionc�<�URSS5n[[RR	U55$![RR26aA [RSU5n[[RR	U55s$f=f)a�Convert an arbitrary string into a valid version string.27Can still raise an ``InvalidVersion`` exception.28To avoid exceptions use ``best_effort_version``.29>>> safe_version("1988 12 25")30'1988.12.25'31>>> safe_version("v0.2.1")32'0.2.1'33>>> safe_version("v0.2?beta")34'0.2b0'35>>> safe_version("v0.2 beta")36'0.2b0'37>>> safe_version("ubuntu lts")38Traceback (most recent call last):39...40packaging.version.InvalidVersion: Invalid version: 'ubuntu.lts'41� �.r)�replace�str�	packagingr�Version�InvalidVersionrr	)r�v�attempts   r�safe_versionr,s~��"	����S�!�A�7��9�$�$�,�,�Q�/�0�0�����+�+�7�$�(�(��a�0���9�$�$�,�,�W�5�6�6�7�s�'<�AB�Bc��[U5$![RRa� UR	SS5n[42R
U5nU(aUSnU[U5SnOSnUn[RSU5RS5nSU3RS5n[USU35s$f=f)a�Convert an arbitrary string into a version-like string.43Fallback when ``safe_version`` is not safe enough.44>>> best_effort_version("v0.2 beta")45'0.2b0'46>>> best_effort_version("ubuntu lts")47'0.dev0+sanitized.ubuntu.lts'48>>> best_effort_version("0.23ubuntu1")49'0.23.dev0+sanitized.ubuntu1'50>>> best_effort_version("0.23-")51'0.23.dev0+sanitized'52>>> best_effort_version("0.-_")53'0.dev0+sanitized'54>>> best_effort_version("42.+?1")55'42.dev0+sanitized.1'56rrrN�0z57sanitized.z.dev0+)rrrrr�_PEP440_FALLBACK�search�len�_NON_ALPHANUMERICr	�strip)rr�matchr�rest�	safe_rest�locals       r�best_effort_versionr+Es��� 
4��G�$�$�����+�+�4��O�O�C��%�� �'�'��*�����=�D��S��Y�[�>�D��D��D�%�)�)�#�t�4�:�:�3�?�	��Y�K�(�.�.�s�3���t�f�F�5�'�2�3�3�4�s�58
�B-B=�<B=�extrac�h�[RSU5RS5R5$)z�Normalize extra name according to PEP 68559>>> safe_extra("_FrIeNdLy-._.-bArD")60'friendly-bard'61>>> safe_extra("FrIeNdLy-._.-bArD__._-")62'friendly-bard'63r)r%r	r&�lower)r,s r�64safe_extrar/es+��� � ��e�,�2�2�3�7�=�=�?�?r�valuec�D�URSS5RS5$)z�Normalize each component of a filename (e.g. distribution/version part of wheel)65Note: ``value`` needs to be already normalized.66>>> filename_component("my-pkg")67'my_pkg'68rr)rr&�r0s r�filename_componentr3os ���=�=��c�"�(�(��-�-rc�&�URSS5$)z�69Produce the incorrect filename component for compatibility.70 71See pypa/setuptools#4167 for detailed analysis.72 73TODO: replace this with filename_component after pip 24 is74nearly-ubiquitous.75 76>>> filename_component_broken('foo_bar-baz')77'foo-bar-baz'78rr)rr2s r�filename_component_brokenr5xs���=�=��c�"�"rc��[R"SS[U55R5R	SS5$)zBLike ``safe_name`` but can be used as filename component for wheelz[-_.]+rr)rr	rr.rr2s r�79safer_namer7�s:��80	�	��	
�
��Y�u�-�	/�	���	���c�	�
rc�*�[[U55$)zLLike ``best_effort_version`` but can be used as filename component for wheel)r3r+r2s r�safer_best_effort_versionr9�s���1�%�8�9�9r�81expressionc��[S5e)a82Defer import error to affect only users that actually use it83https://github.com/pypa/setuptools/issues/489484>>> _missing_canonicalize_license_expression("a OR b")85Traceback (most recent call last):86...87ImportError: ...Cannot import `packaging.licenses`...88z�Cannot import `packaging.licenses`.89        Setuptools>=77.0.0 requires "packaging>=24.2" to work properly.90        Please make sure you have a suitable version installed.91        )�ImportError)r:s r�(_missing_canonicalize_license_expressionr=�s���	��r)�canonicalize_license_expression)�__doc__r�typingrr�compile�92IGNORECASE�_VALID_NAMErr%r"rr
rrr+r/r3r5r7r9r=�packaging.licensesr>� _canonicalize_license_expressionr<�rr�<module>rGs]���9394� ���j�j�E�r�}�}�U���Z�Z� 0�"�-�-�@���J�J�}�b�m�m�<���:�:�3�R�]�]���95	�#�	�#�	�	2��	2��	2�7�#�7�#�7�24��4��4�@@�c�@�c�@�.�c�.�c�.�#�S�#�S�#�96�c�97�c�98�:�S�:�S�:������$T����T��+S�(��T�s� C'�'C;�:C;
codekingpro/portable-devtools · Team Ai