File: D:/Python311/Lib/test/support/__pycache__/import_helper.cpython-311.pyc
�
��Vc8# � � � d dl Z d dlZd dlZd dlZd dlZd dlZd dlZd dlZd dlZddl m
Z
e j dd�� � Zd� Z
d� Zd� Zdd
d�d�Zd
� Ze j dd�� � Zdd d d�d�Z G d� de� � Z G d� de� � Zd� Zd� ZdS )� N� )�unlinkTc # � K � | rMt j � � 5 t j ddt � � dV � ddd� � dS # 1 swxY w Y dS dV � dS )z�Context manager to suppress package and module deprecation
warnings when importing them.
If ignore is False, this context manager has no effect.
�ignorez.+ (module|package)N)�warnings�catch_warnings�filterwarnings�DeprecationWarning)r s �.D:\Python311\Lib\test\support\import_helper.py�_ignore_deprecated_importsr s� � � � � � �
�
$�
&�
&� � ��#�H�.C�$6�
8�
8�
8��E�E�E� � � � � � � � � � � � ���� � � � � � �
�����s � A�A �A c �D � t j | = d S # t $ r Y d S w xY w�N)�sys�modules�KeyError)�names r �unloadr s9 � �
��K�������
�
�
����
���s �
�
�c � � t | � � t j D ]j}t j � || dz � � }t |dz � � dD ]0}t t j � ||�� � � � �1�kdS )z�'Forget' a module was ever imported.
This removes the module from sys.modules and deletes any PEP 3147/488 or
legacy .pyc files.
z.py�c)� r � )�optimizationN) r r �path�os�joinr � importlib�util�cache_from_source)�modname�dirname�source�opts r �forgetr# % s� � � �7�O�O�O��8� O� O������g�w���7�7�� �v��|����� O� O�C��9�>�3�3�F��3�M�M�N�N�N�N� O�O� O� c �, � t j � | � � }t j � t j � | � � � � }t j � || dz � � }t j ||� � |S )a Move a PEP 3147/488 pyc file to its legacy pyc location.
:param source: The file system path to the source file. The source file
does not need to exist, however the PEP 3147/488 pyc file must exist.
:return: The file system path to the legacy pyc file.
r )
r r r r r r �abspathr �shutil�move)r! �pyc_file�up_one�
legacy_pycs r �make_legacy_pycr, 5 sk � � �~�/�/��7�7�H�
�W�_�_�R�W�_�_�V�4�4�
5�
5�F�����f�f�s�l�3�3�J�
�K��*�%�%�%��r$ F� )�required_onc �> � t |� � 5 t j | � � cddd� � S # t $ rS}t j � t |� � � � r� t j t |� � � � �d}~ww xY w# 1 swxY w Y dS )ac Import and return the module to be tested, raising SkipTest if
it is not available.
If deprecated is True, any module or package deprecation messages
will be suppressed. If a module is required on a platform but optional for
others, set required_on to an iterable of platform prefixes which will be
compared against sys.platform.
N)r r �
import_module�ImportErrorr �platform�
startswith�tuple�unittest�SkipTest�str)r �
deprecatedr. �msgs r r0 r0 C s� � �
$�J� /� /� .� .� .��*�4�0�0�.� .� .� .� .� .� .� .�� � .� .� .��|�&�&�u�[�'9�'9�:�:�
���#�C��H�H�-�-�-����� .����.� .� .� .���� .� .� .� .� .� .s, �B�2�
B�AB
�
B�B�B�Bc �� � i }t d� | D � � � � }t t j � � D ]=}|| v s|� |� � r"t j � |� � ||<