/usr/lib/python3.10/test/support/__pycache__
Edit: /usr/lib/python3.10/test/support/__pycache__/import_helper.cpython-310.pyc (7318B)
o
9j8 @ s d dl Z d dlZd dlZd dlZd dlZd dlZd dlZd dlZddlm Z e j
dddZdd Zd d
Z
dd ZdddddZdd Zd ddZG dd deZG dd deZdd Zdd ZdS )! N )unlinkTc c sR | r$t t ddt dV W d dS 1 sw Y dS dV dS )zContext 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)warningscatch_warningsfilterwarningsDeprecationWarning)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)sysmodulesKeyError)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.pyc) r )optimizationN) r r
pathosjoinr importlibutilcache_from_source)modnamedirnamesourceoptr r r
forget$ s
r c C sB t j| }tjtj| }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 shutilmove)r pyc_fileup_one
legacy_pycr r r
make_legacy_pyc4 s
r' Fr )required_onc C sr t |+ z
t| W W d S ty. } ztjt|r# t t
|d}~ww 1 s2w 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_moduleImportErrorr
platform
startswithtupleunittestSkipTeststr)r
deprecatedr( msgr r r
r) B s
r) c C sL i }t dd | D }ttjD ]}|| v s||r#tj|||<