403Webshell
Server IP : 118.27.122.248  /  Your IP : 216.73.216.15
Web Server : Apache
System : Linux web0264.sh.tyo1 4.18.0-553.79.1.lve.el7h.x86_64 #1 SMP Wed Oct 15 16:34:46 UTC 2025 x86_64
User : c9415830 ( 11735)
PHP Version : 8.4.17
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/alt/python36/lib64/python3.6/test/test_importlib/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/alt/python36/lib64/python3.6/test/test_importlib/__pycache__/util.cpython-36.pyc
3

�w2_�0�@sddlZddlZddlZddlZddlZddlmZmZmZddlZddl	Zddl
mZddlZddl
Z
ddlZddlZej�Zde_de_de
jkr�de_de
jkr�de_ej�adt_dt_dt_dt_dt_dd�Ze�d	d
�Zd3dd�Zd4d
d�Zd5dd�ZdZ e
j!d6k�rBe"j#�Z$e$e"k�r0e"j%�Z$ejj&e$��sBdZ ed�dZ'e(ej)�e(e'j)�d�Z)dd�Z*d7dd�Z+ej,dd��Z-ej,d8dd�dd ��Z.ej,d!d"��Z/Gd#d$�d$�Z0Gd%d&�d&e0�Z1Gd'd(�d(e0�Z2d)d*�Z3d+d,�Z4ej,d-d.��Z5d/d0�Z6Gd1d2�d2�Z7dS)9�N)�	machinery�util�invalidate_caches)�support�errno�	importlibZ	_testcapicCsdx^tjD]T}xNtjD]D}tj|}tjj||�}tjj|�r|t_|t_	|t_
|t_dSqWqWdS)N)�sys�pathr�EXTENSION_SUFFIXES�
EXTENSIONS�name�os�join�exists�ext�filename�	file_path)r	rrr�r�=/opt/alt/python36/lib64/python3.6/test/test_importlib/util.py�_extension_detailss
rcCs4d|krdnf}tj|�}tj||dd�}||d�S)	zAImport a module from importlib both w/ and w/o _frozen_importlib.�.r�_frozen_importlib�_frozen_importlib_external)�freshZblocked)�Frozen�Source)r)rr)rZimport_fresh_module)Zmodule_namer�frozen�sourcerrr�import_importlib/s

rc
Ks�|dkrtj}nt|t�s"||}dj||j�}||f}tj||�}|j|_|j|_	||_
x(|j�D]\}}||}	t|||	�qdW|S)Nz{}_{})
�unittestZTestCase�
isinstance�type�format�__name__�types�	new_class�
__module__Z_NAMEZ_KIND�items�setattr)
�clsZkind�base�kwargsr�basesZspecialized�attr�values�valuerrr�specialize_class8s
r0cKs(t|d|f|�}t|d|f|�}||fS)Nrr)r0)r)r*r+rrrrr�split_frozenKsr1cKst||f|�S)N)r1)Z
test_classr*r+rrr�	test_bothQsr2T�win32�cygwinFr)rrcCstjtd�|�S)zRClass decorator that nullifies tests requiring a case-insensitive
    file system.z&requires a case-insensitive filesystem)rZskipIf�CASE_INSENSITIVE_FS)�testrrr�case_insensitive_testsdsr7�c
CsBtjj||d�}t|d��}|j|�WdQRXdj||�|fS)Nz.py�wz{}.{})r
r	r�open�writer")�parentrZpkg_dir�contentr	Zsubfilerrr�	submoduleksr>cgs�xD|D]<}|dkr tdj|���ytj|=Wqtk
r@YqXqWz
dVWdx.|D]&}ytj|=WqXtk
r|YqXXqXWXdS)z�Uncache a module from sys.modules.

    A basic sanity check is performed to prevent uncaching modules that either
    cannot/shouldn't be uncached.

    r�marshal�impzcannot uncache {0}N)rr?r@)�
ValueErrorr"r�modules�KeyError)�namesrrrr�uncachers



rE)�pkgc#s��fdd�tjD�}tjd���}t�f|����tj|��zt�tjj	|��}|rntjj	|d�}tj
��n|d}|dkr�d}|dk	r�t|d��}|j|�WdQRX|VWdQRXWdQRXWdQRXdS)Ncs"g|]}|jd�d�kr|�qS)rr)�	partition)�.0�n)rrr�
<listcomp>�sztemp_module.<locals>.<listcomp>z__init__.pyz.pyr8r9)
rrBrZtemp_cwdrEZ
DirsOnSysPathrr
r	r�mkdirr:r;)rr=rFZ	conflicts�cwd�locationZmodpathZmodfiler)rr�temp_module�s rNcks�i}z�x^dgfdgfdgfdiffD]>\}}tt|�||<||krR||}||=n|}tt||�q$Wt|�r�tdj|j����dVWdx |j�D]\}}tt||�q�WXdS)a,Context manager to manage the various importers and stored state in the
    sys module.

    The 'modules' attribute is not supported as the interpreter state stores a
    pointer to the dict that the interpreter uses internally;
    reassigning to sys.modules does not have the desired effect.

    �	meta_pathr	�
path_hooks�path_importer_cachezunrecognized arguments: {0}N)�getattrrr(�lenrAr"�keysr')r+Z	originalsr-�defaultZ	new_valuer/rrr�import_state�s"

rVc@s6eZdZdZid�dd�Zdd�Zdd�Zd	d
�ZdS)�
_ImporterMockz0Base class to help with creating importer mocks.)�module_codecGs�i|_i|_x�|D]�}|jd�s&|}n|dtd��}d|krFd}n||kr`|jdd�d}n|}tj|�}||_d|_||_	||_
||kr�dg|_||j|<||kr|||j|<qWdS)Nz	.__init__r�rz<mock __file__>z<mock __path__>)rBrX�endswithrS�rsplitr$�
ModuleType�
__loader__�__file__�__package__r-�__path__)�selfrXrDr�import_name�package�modulerrr�__init__�s*



z_ImporterMock.__init__cCs
|j|S)N)rB)rarrrr�__getitem__�sz_ImporterMock.__getitem__cCst|jj��|_|jj�|S)N)rErBrT�_uncache�	__enter__)rarrrrh�s
z_ImporterMock.__enter__cGs|jjddd�dS)N)rg�__exit__)ra�exc_inforrrri�sz_ImporterMock.__exit__N)r#r&�__qualname__�__doc__rerfrhrirrrrrW�s
rWc@s"eZdZdZddd�Zdd�ZdS)�mock_modulesz!Importer mock using PEP 302 APIs.NcCs||jkrdS|SdS)N)rB)ra�fullnamer	rrr�find_module�s
zmock_modules.find_modulecCsh||jkrt�nT|j|tj|<||jkrZy|j|�Wntk
rXtj|=�YnX|j|SdS)N)rB�ImportErrorrrX�	Exception)rarnrrr�load_module�s

zmock_modules.load_module)N)r#r&rkrlrorrrrrrrm�s
rmc@s*eZdZdZd	dd�Zdd�Zdd�ZdS)
�	mock_specz!Importer mock using PEP 451 APIs.NcCsDy|j|}Wntk
r"dSXtj||j|t|dd�d�}|S)Nr`)�loader�submodule_search_locations)rBrCr�spec_from_file_locationr^rR)rarnr	r<rd�specrrr�	find_specszmock_spec.find_speccCs|j|jkrt�|j|jS)N)rrBrp)rarwrrr�
create_moduleszmock_spec.create_modulecCs.y|j|jj�Wntk
r(YnXdS)N)rX�__spec__rrC)rardrrr�exec_moduleszmock_spec.exec_module)NN)r#r&rkrlrxryr{rrrrrss

rscs(tjrdd�Stj���fdd��}|S)ztDecorator to protect sys.dont_write_bytecode from mutation and to skip
    tests that require it to be set to False.c_sdS)Nr)�argsr+rrr�<lambda>"sz'writes_bytecode_files.<locals>.<lambda>cs(tj}dt_z�||�}Wd|t_X|S)NF)r�dont_write_bytecode)r|r+ZoriginalZ	to_return)�fxnrr�wrapper#sz&writes_bytecode_files.<locals>.wrapper)rr~�	functools�wraps)rr�r)rr�writes_bytecode_filess	r�cCsLytjtjj|��Wn0tk
rF}z|jtjkr6�WYdd}~XnXdS)z�Ensure that the __pycache__ directory for PEP 3147 pyc file exists.

    :param bytecode_path: File system path to PEP 3147 pyc file.
    N)r
rKr	�dirname�OSErrorrZEEXIST)�
bytecode_path�errorrrr�ensure_bytecode_path/s
r�cgs�d}g}i}d}d}�z0tj�}||d<t�}x�|D]�}|jd�sH|}	n|dtd��}	|j|	�|	tjkrvtj|	=|jd�}
|}xB|
dd�D]2}t	j
j||�}t	j
j|�s�t	j
|�|j|�q�Wt	j
j||
dd�}t|d	��}
|
j|j|��WdQRX|j|�|||<q4Wt|�}|j�t|gd
�}|j�|VWd|dk	�r`|jddd�|dk	�rx|jddd�tj|�XdS)
aRTemporarily create each named module with an attribute (named 'attr')
    that contains the name passed into the context manager that caused the
    creation of the module.

    All files are created in a temporary directory returned by
    tempfile.mkdtemp(). This directory is inserted at the beginning of
    sys.path. When the context manager exits all created files (source and
    bytecode) are explicitly deleted.

    No magic is performed when creating packages! This means that if you create
    a module within a package you must also create the package's __init__ as
    well.

    zattr = {0!r}Nz.rootrez	.__init__rrYz.pyr9)r	���r�)�tempfileZmkdtemp�setrZrS�addrrB�splitr
r	rrrK�appendr:r;r"rErhrVrirZrmtree)rDrZ
created_paths�mappingZ
state_managerZuncache_managerZtemp_dirZimport_namesrrbZ
name_partsrZ	directory�filerrr�create_modules;sL









r�cs��fdd�}|S)zA mock sys.path_hooks entry.cs|�krt��S)N)rp)�entry)�entries�importerrr�hookwszmock_path_hook.<locals>.hookr)r�r�r�r)r�r�r�mock_path_hookusr�c@seZdZdd�ZdS)�CASEOKTestBasecs,d}t�fdd�|D��|kr(�jd�dS)N�PYTHONCASEOK�PYTHONCASEOKc3s|]}|�jjjjkVqdS)N)r�_bootstrap_external�_os�environ)rH�x)rarr�	<genexpr>�sz4CASEOKTestBase.caseok_env_changed.<locals>.<genexpr>z/os.environ changes not reflected in _os.environ)r�r�)�anyZskipTest)raZshould_existZ
possibilitiesr)rar�caseok_env_changed�sz!CASEOKTestBase.caseok_env_changedN)r#r&rkr�rrrrr�~sr�)N)N)N)r3r4)r8)r8)8�builtins�
contextlibrr�rrrrr
Zos.pathr6rrrr�r$�SimpleNamespaceZBUILTINSZ	good_nameZbad_name�builtin_module_namesrr	rrrrrrr0r1r2r5�platformr^�upperZchanged_name�lowerrZsource_importlib�staticmethod�
__import__r7r>�contextmanagerrErNrVrWrmrsr�r�r�r�r�rrrr�<module>sn


	




):	

Youez - 2016 - github.com/yon3zu
LinuXploit