Sindbad~EG File Manager

Current Path : /usr/local/lib/python3.12/test/test_importlib/__pycache__/
Upload File :
Current File : //usr/local/lib/python3.12/test/test_importlib/__pycache__/test_metadata_api.cpython-312.pyc

�

)Μg'+�
��ddlZddlZddlZddlZddlZddlZddlmZddlm	Z	m
Z
mZmZm
Z
mZmZmZej"d��ZGd�dej&ej(ej*ej,ej.ej0ej2ej4ej6�ZGd�d	ej:ej6�ZGd
�dej>ej6�Z Gd�d
ej6�Z!y)�N�)�fixtures)�Distribution�PackageNotFoundError�distribution�entry_points�files�metadata�requires�versionc#�K�tjd��5}tjdt��|��ddd�y#1swYyxYw�w)NT)�record�default)�category)�warnings�catch_warnings�simplefilter�DeprecationWarning)�ctxs �B/usr/local/lib/python3.12/test/test_importlib/test_metadata_api.py�suppress_known_deprecationrs7����	�	 �	 ��	-�����i�2D�E��	�
.�	-�	-�s�A� A�	A�A�Ac���eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zd�Zed��Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z d�Z!d�Z"y )!�APITestsz\d+\.\d+(\.\d)?c��td�}t|t�sJ�tj|j
|�sJ�y)N�egginfo-pkg�r�
isinstance�str�re�match�version_pattern��self�pkg_versions  r�test_retrieves_version_of_selfz'APITests.test_retrieves_version_of_self)s6���m�,���+�s�+�+�+��x�x��,�,�k�:�:�:�c��td�}t|t�sJ�tj|j
|�sJ�y�N�distinfo-pkgrr"s  r�&test_retrieves_version_of_distinfo_pkgz/APITests.test_retrieves_version_of_distinfo_pkg.s6���n�-���+�s�+�+�+��x�x��,�,�k�:�:�:r&c�n�|jt�5td�ddd�y#1swYyxYw)N�does-not-exist)�assertRaisesrr�r#s r�test_for_name_does_not_existz%APITests.test_for_name_does_not_exist3s&��
�
�
�3�
4��)�*�5�
4�
4�s�+�4c��d}|D]:}|j|�5t|�jddk(sJ�	ddd��<y#1swY�GxYw�N)�pkg.dot�pkg_dotzpkg-dotzpkg..dotzPkg.Dot�Namer2��subTestrr
�r#�names�names   r�test_name_normalizationz APITests.test_name_normalization7�J��F���D����d�#�#�D�)�2�2�6�:�i�G�G�G�$�#��#�#���A�A	c���d}|D]E}|j|�5|jt�5t|�ddd�ddd��Gy#1swY�xYw#1swY�^xYw)N)�p�pkgzpkg.)r6r-rr)r#�prefixes�prefixs   r�test_prefix_not_matchedz APITests.test_prefix_not_matched=sQ��%���F����f�%��&�&�';�<� ��(�=�&�%��<�<��&�%�s!�A�A�A�A�A�A#	c���ddg}|D]W\}}|j|�5|jt|�jd�j	�|�ddd��Yy#1swY�dxYw)N)r�mod)�egg_with_no_modules-pkg��
top_level.txt)r6�assertEqualr�	read_text�strip)r#�tests�pkg_name�expect_contents    r�test_for_top_levelzAPITests.test_for_top_levelDsh��"�+�
��).�$�H�n����h�'�� � � ��*�4�4�_�E�K�K�M�"��(�'�).�'�'�s�9A"�"A+	c��ddg}|D]k\}}|j|�5t|�D�cgc]}|jdk(s�|��c}d}|j|j	�|�ddd��mycc}w#1swY�}xYw)N)rzmod
)rE�
rGr)r6r	r9rHrI)r#rKrLrM�path�	top_levels      r�test_read_textzAPITests.test_read_textPs���$�-�
��).�$�H�n����h�'�%*�8�_��%4�T��	�	�_�8T�D�_����	�� � ��!4�!4�!6��G�	(�'�).���(�'�s"�A;�A6�A6�&A;�6A;�;B	c��t�}d|jvsJ�|jd��}d|jvsJ�|d}|j	|j
d�|j	|jg�y)N�entries��group�mainzmod:main)r�groups�selectr8rH�value�extras)r#�epsrU�eps    r�test_entry_pointszAPITests.test_entry_points\sn���n���C�J�J�&�&�&��*�*�9�*�-������&�&�&�
�V�_��������:�.�������B�'r&c���td��}dD]S}||}|j|jjd�|j	|jj
d��Uy)NrUrV)rX�ns:sub)r)r�1.0.0)r�assertIn�distr9rHr)r#rU�entryr^s    r�test_entry_points_distributionz'APITests.test_entry_points_distributionesN���Y�/��'�E����B��M�M�"�'�'�,�,�(G�H����R�W�W�_�_�g�6�(r&c�L�|jjtj��}|jj|j|��dddd�i}tj||�td��}t
d�|D��rJ�d|jvsJ�y	)
z�
        Entry points should only be exposed for the first package
        on sys.path with a given name (even when normalized).
        zDistInfo_pkg-1.1.0.dist-infozS
                Name: distinfo-pkg
                Version: 1.1.0
                zJ
                [entries]
                main = mod:altmain
            )�METADATAzentry_points.txtrUrVc3�K�|]8}|jjdk(xr|jjdk(���:y�w)r)rbN)rdr9r)�.0r^s  r�	<genexpr>zHAPITests.test_entry_points_unique_packages_normalized.<locals>.<genexpr>�s:����
���
�G�G�L�L�N�*�I�r�w�w���'�/I�I��s�>AraN)r�
enter_context�tempdir�add_sys_path�build_filesr�anyr8)r#�alt_site_dir�alt_pkgrUs    r�,test_entry_points_unique_packages_normalizedz5APITests.test_entry_points_unique_packages_normalizedls���
�}�}�2�2�8�3C�3C�3E�F���
�
�#�#�D�$5�$5�l�$C�D�*��%�	-�
��	���W�l�3��Y�/���
��
�
�	
�
�
�w�}�}�,�,�,r&c�v�|jt�5td��dddd�y#1swYyxYw)NrUrV�missing)r-�KeyErrorrr.s r�test_entry_points_missing_namez'APITests.test_entry_points_missing_name�s)��
�
�
�x�
(��y�)�)�4�)�
(�
(�s�/�8c�&�td��dk(sJ�y)NrurV�)rr.s r�test_entry_points_missing_groupz(APITests.test_entry_points_missing_group�s���)�,��2�2�2r&c��t�jdd��}|jt�5d|_ddd�y#1swYyxYw)NrUrX)rWr9�)rrZr-�AttributeError�foo)r#r^s  r�&test_entry_points_allows_no_attributesz/APITests.test_entry_points_allows_no_attributes�s:��
�^�
"�
"���
"�
@��
�
�
�~�
.��B�F�/�
.�
.�s�A�Ac��td�}|ddk(sJ�|ddk(sJ�|ddk(sJ�|jd�}d|vsJ�y)	Nr�authorz	Steven Ma�LICENSE�Unknownr4�
Classifierz*Topic :: Software Development :: Libraries)r
�get_all)r#�md�classifierss   r�test_metadata_for_this_packagez'APITests.test_metadata_for_this_package�s^��
�m�
$���(�|�{�*�*�*��)�}�	�)�)�)��&�z�]�*�*�*��j�j��.��;�{�J�J�Jr&c�h�td�}t�5|d�J�	ddd�y#1swYyxYw)zL
        Requesting a missing key will still return None, but warn.
        r)r,N)r
r�r#r�s  r�test_missing_key_legacyz APITests.test_missing_key_legacy�s2���n�
%��
'�
)��&�'�/�/�/�*�
)�
)�s�(�1c�F�td�}|jd�dk(sJ�y)z-
        Getting a key gets the key.
        rr4N�r
�getr�s  r�test_get_keyzAPITests.test_get_key�s$���m�
$���v�v�f�~��.�.�.r&c�@�td�}|jd��J�y)z<
        Requesting a missing key will return None.
        r)r,Nr�r�s  r�test_get_missing_keyzAPITests.test_get_missing_key�s$���n�
%���v�v�&�'�/�/�/r&c��|dj}|D]�}|j|k(sJ�|jr|jjsJ�|jr|jjdk(sJ�|jr|jdk\sJ�|j�j
�sJ�t|j�t�sJ�|jjd�s��|j���y)Nr�sha256z.py)
�root�hashr[�mode�size�locate�existsr�read_binary�bytesr9�endswithrI)r	r��files   r�_test_fileszAPITests._test_files�s����Q�x�}�}���D��9�9��$�$�$��y�y�D�I�I�O�O�3�3��y�y�D�I�I�N�N�h�$>�>�>��y�y�D�I�I��N�2�2��;�;�=�'�'�)�)�)��d�.�.�0�%�8�8�8��y�y�!�!�%�(���� �r&c��td�D�cgc]}|jdk(s�|��c}d}|jt|j�d�ycc}w)Nr)zmod.pyrz!<FileHash mode: sha256 value: .*>)r	r9�assertRegex�reprr�)r#r>�utils   r�test_file_hash_reprzAPITests.test_file_hash_repr�sL�� ��0�G�0�a�A�F�F�h�4F��0�G��J������d�i�i��*M�N��Hs
�A�Ac�8�|jtd��yr(�r�r	r.s r�test_files_dist_infozAPITests.test_files_dist_info�s������~�.�/r&c���|jtd��|jtd��|jtd��|jtd��y)Nrzegg_with_module-pkgrEzsources_fallback-pkgr�r.s r�test_files_egg_infozAPITests.test_files_egg_info�sQ������}�-�.�����4�5�6�����8�9�:�����5�6�7r&c�:�|jtd�d�y)N�egginfo-filez0.1)rHrr.s r�test_version_egg_info_filez#APITests.test_version_egg_info_file�s�������0�%�8r&c�<�td�}|j|�y)Nr�)r�assertIsNone)r#�requirementss  r�test_requires_egg_info_filez$APITests.test_requires_egg_info_file�s����/�����,�'r&c�b�td�}t|�dk(sJ�td�|D��sJ�y)Nr�c3�&K�|]	}|dk(���y�w)z%wheel >= 1.0; python_version >= "2.7"Nry)rj�deps  rrkz2APITests.test_requires_egg_info.<locals>.<genexpr>�s����R�T�c�3�A�A�T�s�)r�lenrp�r#�depss  r�test_requires_egg_infozAPITests.test_requires_egg_info�s0���
�&���4�y�A�~��~��R�T�R�R�R�Rr&c��tjddi|jjd��t	d�}|gk(sJ�y)Nzrequires.txtrFzegginfo_pkg.egg-infor)rro�site_dir�joinpathrr�s  r�test_requires_egg_info_emptyz%APITests.test_requires_egg_info_empty�sG�������
�
�M�M�"�"�#9�:�		
��
�&���r�z��zr&c�l�td�}t|�dk(sJ�t|�sJ�d|vsJ�d|vsJ�y)Nr)r�zwheel >= 1.0zpytest; extra == 'test')rr��allr�s  r�test_requires_dist_infoz APITests.test_requires_dist_info�sD����'���4�y�A�~��~��4�y��y���%�%�%�(�D�0�0�0r&c��tjd�}ttj|��}gd�}||k(sJ�y)Na
            dep1
            dep2

            [:python_version < "3"]
            dep3

            [extra1]
            dep4
            dep6@ git+https://example.com/python/dep.git@v1.0.0

            [extra2:python_version < "3"]
            dep5
            )�dep1�dep2zdep3; python_version < "3"zdep4; extra == "extra1"z2dep5; (python_version < "3") and extra == "extra2"zGdep6@ git+https://example.com/python/dep.git@v1.0.0 ; extra == "extra1")�textwrap�dedent�sortedr�_deps_from_requires_text)r#rr��expecteds    r�$test_more_complex_deps_requires_textz-APITests.test_more_complex_deps_requires_text�sC���?�?�

�
�� �l�;�;�H�E�F��
���x���r&c��td�j}d|vsJ�|dddgk(sJ�|d}|jd�sJ�t|d�d	k(sJ�y)
Nr)r9�keywords�sample�package�description�Once upon a time
There was�
requires_distr��r
�json�
startswithr��r#r��descs   r�test_as_jsonzAPITests.test_as_json	sj��
�n�
%�
*�
*����|��|��*�~�(�I�!6�6�6�6��-� �����<�=�=�=��2�o�&�'�1�,�,�,r&c��td�j}d|vsJ�|dddgk(sJ�|d}|jd�sJ�t|d�d	k(sJ�y)
Nrr9r�r�r�r�r��
classifierr�r�r�s   r�test_as_json_egg_infozAPITests.test_as_json_egg_infosj��
�m�
$�
)�
)����|��|��*�~�(�I�!6�6�6�6��-� �����<�=�=�=��2�l�#�$��)�)�)r&c��|j�td�j}d|vsJ�t|d�dk(sJ�|dddgk(sJ�y)Nr)r9r�r�r��SAMPLE�PACKAGE)�make_uppercaser
r�r�r�s  r�test_as_json_odd_casezAPITests.test_as_json_odd_casesY������
�n�
%�
*�
*����|��|��2�o�&�'�1�,�,�,��*�~�(�I�!6�6�6�6r&N)#�__name__�
__module__�__qualname__r!r%r*r/r:rBrNrSr_rfrsrwrzrr�r�r�r��staticmethodr�r�r�r�r�r�r�r�r�r�r�r�r�ryr&rrrs���)�O�;�
;�
+�H�)�
�
H�(�7�-�85�3��
K�0�/�0��
!��
!�O�0�8�9�(�S�
�1� �@-�*�7r&rc��eZdZd�Zd�Zy)�
LegacyDotsc��d}|D]:}|j|�5t|�jddk(sJ�	ddd��<y#1swY�GxYwr1r5r7s   rr:z"LegacyDots.test_name_normalization"r;r<c��d}|D]:}|j|�5t|�jddk(sJ�	ddd��<y#1swY�GxYw)N)�pkg.lot�pkg_lotzpkg-lotzpkg..lotzPkg.Lotr4r�r5r7s   r�,test_name_normalization_versionless_egg_infoz7LegacyDots.test_name_normalization_versionless_egg_info(r;r<N)r�r�r�r:r�ryr&rr�r�!s��H�Hr&r�c��eZdZd�Zd�Zd�Zy)�OffSysPathTestsc��tjt|j�g��}t	d�|D��sJ�y)N)rQc3�@K�|]}|jddk(���y�w)r4r)N)r
)rjrds  rrkzIOffSysPathTests.test_find_distributions_specified_path.<locals>.<genexpr>2s����M�u�t�4�=�=��(�N�:�u�s�)r�discoverrr�rp)r#�distss  r�&test_find_distributions_specified_pathz6OffSysPathTests.test_find_distributions_specified_path0s2���%�%�C��
�
�,>�+?�@���M�u�M�M�M�Mr&c�n�|jdz}tj|�}|jdk(sJ�y)z9Demonstrate how to load metadata direct from a directory.�distinfo_pkg-1.0.0.dist-inforbN)r�r�atr�r#�dist_info_pathrds   r�test_distribution_at_pathlibz,OffSysPathTests.test_distribution_at_pathlib4s1�����)G�G�����~�.���|�|�w�&�&�&r&c��|jdz}tjt|��}|jdk(sJ�y)Nr�rb)r�rr�rrr�s   r�test_distribution_at_strz(OffSysPathTests.test_distribution_at_str:s6�����)G�G�����s�>�2�3���|�|�w�&�&�&r&N)r�r�r�r�r�r�ryr&rr�r�/s��N�'�'r&r�c��eZdZd�Zy)�InvalidateCachec�,�tj�y)N)�	importlib�invalidate_cachesr.s r�test_invalidate_cachez%InvalidateCache.test_invalidate_cacheAs���#�#�%r&N)r�r�r�r�ryr&rr�r�@s��&r&r�)"rr��unittestrr��
contextlibrFr�importlib.metadatarrrrr	r
rr�contextmanagerr�
EggInfoPkg� EggInfoPkgPipInstalledNoToplevel�EggInfoPkgPipInstalledNoModules�'EggInfoPkgPipInstalledExternalDataFiles�EggInfoPkgSourcesFallback�DistInfoPkg�DistInfoPkgWithDot�EggInfoFile�TestCaser�DistInfoPkgWithDotLegacyr��DistInfoPkgOffPathr�r�ryr&r�<module>rs���	�������	�	�	�������B7�����-�-��,�,��4�4��&�&�������������B7�JH��2�2�H�4E�4E�H�'�h�1�1�8�3D�3D�'�"&�h�'�'�&r&

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists