Uname:Linux ip-10-0-5-176 6.8.0-1057-aws #60~22.04.1-Ubuntu SMP Wed May 27 08:16:59 UTC 2026 x86_64

403WebShell
403Webshell
Server IP : 3.111.61.48  /  Your IP : 216.73.216.67
Web Server : Apache
System : Linux ip-10-0-5-176 6.8.0-1057-aws #60~22.04.1-Ubuntu SMP Wed May 27 08:16:59 UTC 2026 x86_64
User : ubuntu ( 1000)
PHP Version : 8.2.31
Disable Function : exec,passthru,shell_exec,system
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/lib/python3.10/test/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python3.10/test/__pycache__/test_py_compile.cpython-310.pyc
o

�9j�-�@s�ddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlmZddl
mZmZdd�Zdd�ZGdd	�d	ee
j��ZGd
d�d�ZGdd
�d
ee
jedd�ZGdd�dee
jedd�ZGdd�de
j�Zedkr}e
��dSdS)�N)�support)�	os_helper�
script_helperc�t����fdd��}|S)z+Runs function with SOURCE_DATE_EPOCH unset.csDt���}|�d��|i|��Wd�S1swYdS)N�SOURCE_DATE_EPOCH)r�EnvironmentVarGuard�unset��args�kwargs�env��fxn��+/usr/lib/python3.10/test/test_py_compile.py�wrappers

$�z*without_source_date_epoch.<locals>.wrapper��	functools�wraps�rrrr
r�without_source_date_epoch�rcr)z)Runs function with SOURCE_DATE_EPOCH set.csBt���}d|d<�|i|��Wd�S1swYdS)N�	123456789r)rrr	r
rrrs
$�z'with_source_date_epoch.<locals>.wrapperrrrr
r�with_source_date_epochrrcseZdZ�fdd�Z�ZS)�SourceDateEpochTestMetac	sZt��||||�}t|�D]}|�d�r*t||�}|r t|�}nt|�}t|||�q
|S)N�test_)�super�__new__�dir�
startswith�getattrrr�setattr)	�mcls�name�bases�dct�source_date_epoch�cls�attr�methr��	__class__rrr&s


�zSourceDateEpochTestMeta.__new__)�__name__�
__module__�__qualname__r�
__classcell__rrr*rr%src@s�eZdZdd�Zdd�Zdd�Zdd�Ze�e	j
�e	j�p$e	j
�
e	j�d	�d
d��Zdd
�Zdd�Zdd�Ze�ee	d�oCe	��dkd�e�e	jdkd�dd���Zdd�Zdd�Ze�ejjdkd�dd��Zd d!�Zd"d#�Zd$d%�Zd&S)'�PyCompileTestsBasecCs�tjt��d�|_tj�|jd�|_|jd|_t	j
�|j�|_tj�
t���d|_tj�
|j�d}|r;t�|�t|jd��}|�d�Wd�dS1sRwYdS)N)r�_test.py�cr�w�x = 123
)�tempfile�mkdtemp�os�getcwd�	directory�path�join�source_path�pyc_path�	importlib�util�cache_from_source�
cache_path�
splitdrive�	cwd_drive�chdir�open�write)�self�drive�filerrr�setUp7s
"�zPyCompileTestsBase.setUpcCs&t�|j�|jrt�|j�dSdS�N)�shutil�rmtreer9rCr7rD�rGrrr�tearDownGs�zPyCompileTestsBase.tearDowncCs<t�|j|j�|�tj�|j��|�tj�|j	��dSrK)
�
py_compile�compiler<r=�
assertTruer7r:�exists�assertFalserArNrrr�test_absolute_pathLsz%PyCompileTestsBase.test_absolute_pathc	Cs�zt�|jd|j�Wnttfy|�d�YdSwtj�|j�s'J�|�t	��t
�|j|j�Wd�dS1s@wYdS)Nz.actualz.need to be able to create a symlink for a file)
r7�symlinkr=�NotImplementedError�OSError�skipTestr:�islink�assertRaises�FileExistsErrorrPrQr<rNrrr�test_do_not_overwrite_symlinksQs�"�z1PyCompileTestsBase.test_do_not_overwrite_symlinksz7requires os.devnull and for it to be a non-regular filecCs@|�t��t�|jtj�Wd�dS1swYdSrK)r[r\rPrQr<r7�devnullrNrrr�&test_do_not_overwrite_nonregular_files]s"�z9PyCompileTestsBase.test_do_not_overwrite_nonregular_filescCs$t�|j�|�tj�|j��dSrK)rPrQr<rRr7r:rSrArNrrr�test_cache_pathesz"PyCompileTestsBase.test_cache_pathcCsxt�|j��t�tj�|j�tj�|j	��Wd�n1s!wY|�
tj�|j	��|�tj�|j
��dSrK)r�
change_cwdr9rPrQr7r:�basenamer<r=rRrSrTrArNrrr�test_cwdis��zPyCompileTestsBase.test_cwdcCsLt�tj�|j�tj�|j��|�tj�|j��|�	tj�|j
��dSrK)rPrQr7r:�relpathr<r=rRrSrTrArNrrr�test_relative_pathps
�z%PyCompileTestsBase.test_relative_path�geteuidrznon-root user required�ntz/cannot control directory permissions on Windowsc
Cs�t�|j�}t�|jtj�z3|�t��t�|j	|j
�Wd�n1s'wYWt�|j|j�dSWt�|j|j�dSt�|j|j�wrK)r7�statr9�chmod�S_IREADr[�IOErrorrPrQr<r=�st_mode)rG�moderrr�test_exceptions_propagatevs��&z,PyCompileTestsBase.test_exceptions_propagatecCsptj�tj�t�d�}t���|�tj	|dd��Wd�n1s$wY|�
tj�tj
�|���dS)N�bad_coding2.pyF)�doraise)r7r:r;�dirname�__file__r�captured_stderr�assertIsNonerPrQrTrSr>r?r@)rG�
bad_codingrrr�test_bad_coding�s
�


�z"PyCompileTestsBase.test_bad_codingcCs�t�|j|j�|�tj�|j��|�tj�|j	��t
|jd��}tj�
|��di�}Wd�n1s7wYtj�d�rEd}nd}|�||�dS)N�rb�testr�r)rPrQr<r=rRr7r:rSrTrArEr>�_bootstrap_external�
_classify_pyc�read�environ�get�assertEqual)rG�fp�flags�expected_flagsrrr�test_source_date_epoch�s
��z)PyCompileTestsBase.test_source_date_epochztest does not work with -Oc	Cs�tj�|jd�}tj�|�}|d}tj�|�\}}tj�|�}|�	tj�||�tj�dd�
tjj
���t|d��
}|�d�Wd�n1sJwYt�|�|�tj�|��|�tj�|��dS)Nz
foo.bar.pyr2�__pycache__zfoo.bar.{}.pycr3r4)r7r:r;r9r>r?r@�splitrbr�format�sys�implementation�	cache_tagrErFrPrQrRrSrT)rG�
weird_pathrAr=�head�tail�penultimate_tailrIrrr�test_double_dot_no_clobber�s$���
z-PyCompileTestsBase.test_double_dot_no_clobbercCs|�dtj|jdd��dS)Nzopt-2�)�optimize)�assertInrPrQr<rNrrr�test_optimization_path�sz)PyCompileTestsBase.test_optimization_pathcCs�tj|jtjjd�t|jd��}tj�	|�
�di�}Wd�n1s%wY|�|d�tj|jtjjd�t|jd��}tj�	|�
�di�}Wd�n1sUwY|�|d�dS)N)�invalidation_moderwrxry�)
rPrQr<�PycInvalidationMode�CHECKED_HASHrErAr>rzr{r|r�UNCHECKED_HASH)rGr�r�rrr�test_invalidation_mode�s(�
���
��z)PyCompileTestsBase.test_invalidation_modec	Cs�tj�tj�t�d�}t���M}|�tj	|ddd��|�tj	|ddd��|�
|��d�|�tj
��tj	|ddd�Wd�n1sGwYWd�dSWd�dS1s_wYdS)NroFr�)rp�quietT�r�)r7r:r;rqrrrrsrtrPrQr�getvaluer[�PyCompileError)rGru�stderrrrr�
test_quiet�s
��"�zPyCompileTestsBase.test_quietN)r,r-r.rJrOrUr]�unittest�skipIfr7r:rSr^�isfiler_r`rcre�hasattrrfr#rnrvr�r�r�r�r�r�r�r�rrrrr05s4 �
��
r0c@�eZdZdS)�PyCompileTestsWithSourceEpochN�r,r-r.rrrrr���r�T)�	metaclassr&c@r�)� PyCompileTestsWithoutSourceEpochNr�rrrrr��r�r�Fc@s\eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�ZdS)�PyCompileCLITestCasecCsht��|_tj�|jd�|_tj�	|j�|_
t|jd��}|�d�Wd�dS1s-wYdS)Nr1r3r4)
r5r6r9r7r:r;r<r>r?r@rArErF)rGrIrrrrJ�s
"�zPyCompileCLITestCase.setUpcCst�|j�dSrK)rrMr9rNrrrrO�szPyCompileCLITestCase.tearDowncOsT|r|ddkrd|vrtjtjdddg|d��dd�Stjddg|�Ri|��S)Nr�-�input�-mrPT)r��capture_output)�
subprocess�runr��
executable�encoder�assert_python_ok)rGr
rrrr�pycompilecmd�s
�z!PyCompileCLITestCase.pycompilecmdcGstjddg|�R�S)Nr�rP)r�assert_python_failure)rGr
rrr�pycompilecmd_failure�sz)PyCompileCLITestCase.pycompilecmd_failurecCsR|jd|jd�}|�|jd�|�|jd�|�|jd�|�tj�	|j
��dS)Nr�)r�r�)r�r<r�
returncode�stdoutr�rRr7r:rSrA)rG�resultrrr�
test_stdin�s
zPyCompileCLITestCase.test_stdincCsR|�|j|j�\}}}|�|d�|�|d�|�|d�|�tj�|j��dS)Nrr�)r�r<rrRr7r:rSrA)rG�rcr�r�rrr�test_with_files�s
z$PyCompileCLITestCase.test_with_filescCsNtj�tj�t�d�}|�|�\}}}|�|d�|�|d�|�d|�dS)N�badsyntax_3131.pyr�r�sSyntaxError)r7r:r;rqrrr�rr��rG�
bad_syntaxr�r�r�rrr�test_bad_syntaxs
z$PyCompileCLITestCase.test_bad_syntaxcCsPtj�tj�t�d�}|�d|�\}}}|�|d�|�|d�|�|d�dS)Nr��-qr�r�)r7r:r;rqrrr�rr�rrr�test_bad_syntax_with_quiets
z/PyCompileCLITestCase.test_bad_syntax_with_quietcCsVtj�tj�t�d�}|�|j|�\}}}|�|d�|�|d�|�d|�	��dS)N�should_not_exists.pyr�r�sno such file or directory)
r7r:r;rqrrr�r<rr��lower�rG�should_not_existsr�r�r�rrr�test_file_not_existss
z)PyCompileCLITestCase.test_file_not_existscCsTtj�tj�t�d�}|�d|j|�\}}}|�|d�|�|d�|�|d�dS)Nr�r�r�r�)r7r:r;rqrrr�r<rr�rrr�test_file_not_exists_with_quiets
z4PyCompileCLITestCase.test_file_not_exists_with_quietN)
r,r-r.rJrOr�r�r�r�r�r�r�r�rrrrr��s
r��__main__)r�importlib.utilr>r7rPrLrhr�r�r5r�rxr�test.supportrrrr�type�TestCaserr0r�r�r�r,�mainrrrr�<module>s>
��D�

Youez - 2016 - github.com/yon3zu
LinuXploit