Current File : //snap/core22/2115/usr/lib/python3.10/test/support/__pycache__/import_helper.cpython-310.pyc |
o
}�5h8 � @ s� d dl Z d dlZd dlZd dlZd dlZd dlZd dlZd dlZddlm Z e j
ddd��Zdd� Zd d
� Z
dd� Zddd�dd�Zdd� Zd dd�ZG dd� de�ZG dd� de�Zdd� Zdd� ZdS )!� N� )�unlinkTc c sR � | r$t �� � t �ddt� dV W d � dS 1 sw 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 � r �1/usr/lib/python3.10/test/support/import_helper.py�_ignore_deprecated_imports
s �
�"�
r c C s$ zt j| = W d S ty Y d S w �N)�sys�modules�KeyError)�namer r r
�unload s
�r c C sT t | � tjD ] }tj�|| d �}t|d � dD ]}ttjj||d�� qqdS )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�optr r r
�forget$ s
��r c C sB t j�| �}tj�tj�| ��}tj�|| d �}t� ||� |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_pycr r r
�make_legacy_pyc4 s
r'