403Webshell
Server IP : 93.86.61.54  /  Your IP : 216.73.216.156
Web Server : Apache/2.4.62 (Ubuntu)
System : Linux rasin.ddns.net 6.8.0-124-generic #124~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue May 26 21:05:19 UTC x86_64
User : www-data ( 33)
PHP Version : 8.4.22
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/lib/python3/dist-packages/reportlab/lib/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python3/dist-packages/reportlab/lib/__pycache__/testutils.cpython-310.pyc
o

`�b�/�@sZddlZde_[dZdZddlZddlZddlZddlZddlm	Z	ddl
Z
ddlmZm
Z
mZmZdd�Zdadadad	d
�Zej�dd�dkrKdnd
fZdd�Zdd�Zd.dd�Zdd�Zd/dd�ZGdd�de	�ZGdd�d�ZGdd�de�ZGdd �d e�Z Gd!d"�d"e
j!�Z"Gd#d$�d$e
j!�Z#Gd%d&�d&e
j!�Z$d0d(d)�Z%d*d+�Z&d,d-�Z'dS)1�NTz3.3.0aProvides support for the test suite.

The test suite as a whole, and individual tests, need to share
certain support functions.  We have to put these in here so they
can always be imported, and so that individual tests need to import
nothing more than "reportlab.whatever..."
)�ConfigParser)�isCompactDistro�
__rl_loader__�rl_isdir�	asUnicodecCsPz!d}t|d�}|�d�|��tj�|�rt�|�WdSWdSYdS)Nz00DELETE.ME�wz$test of writability - can be deleted�r)�open�write�close�os�path�isfile�remove)�D�fn�f�r�9/usr/lib/python3/dist-packages/reportlab/lib/testutils.py�
isWritables


�rcCs�trtSdd�tjD�}|stj�dd�}|r|g}|r=|dazt�t�WnY|D]
}|tjvr;tj�|�q.n|dksEJd��tj�	tjd�}|sTt�
�}|att�s^td	�add
l
}|jdatj�t�swtj�tj�t��atj�	t�}tj�|d�atj�t�s�tj�tj�	|�d�atj�t�s�|dkr�tj�	tjd�}|s�t�
�}tj�|�and
atr�tj�dtj�	t��tS)z�Is it a writable file system distro being invoked within
    test directory?  If so, can write test output here.  If not,
    it had better go in a temp directory.  Only do this once per
    processcSs"g|]
}|�d�r|dd��qS)z	--outdir=�	N��
startswith)�.0�drrr�
<listcomp>+s"zsetOutDir.<locals>.<listcomp>�RL_TEST_OUTDIR�����__main__z2setOutDir should only be called in the main scriptr�reportlab_testN�tests)�_OUTDIR�sys�argvr�environ�get�makedirsrr
�dirname�getcwdr�get_rl_tempdir�	reportlab�__path__�RL_HOME�isabs�normpath�abspath�join�testsFolder�isdir�insert)�namerr�	scriptDirr+�topDirrrr�	setOutDir$sL

��
 r8�OFFLINE_MOCK�1z,http://www.reportlab.com/rsrc/encryption.gifcCsh|tvr(ttj�ttj�|��d��}|��Wd�S1s!wYdSddlm	}||���S)N�rbr)�urlopen)
�	_mockumapr	rr
r1r2�basename�read�urllib.requestr<)r5rr<rrr�mockUrlReadWs$�rAcCstt�}|r
tj�||�}|S)z�This works out where to write test output.  If running
    code in a locked down file system, this will be a
    temp directory; otherwise, the output of 'test_foo.py' will
    normally be a file called 'test_foo.pdf', next door.
    )r8�__name__rr
r1)rrrrr�
outputfile_srCrcCs>t�|�j�d�dkrtd�}|tkrtd|�dSdSdS)NrBrrz,Logs and output files written to folder "%s")r#�	_getframe�f_localsr&rCr"�print)�depth�outDirrrr�
printLocationis�rIcGs.t��}t��}|D]
}|�|�|��q
|S)z<Return a test suite with tests loaded from provided classes.)�unittest�	TestSuite�
TestLoader�addTest�loadTestsFromTestCase)�classes�suite�loader�Crrr�makeSuiteForClassesos
rScCs�tjj}z
t||dd��}WntygYSwg}|��D]#}|r*|ddks2|rC|ddkrC|�d�d}|rC|�|||��q |S)aGReturns a list of filenames as listed in the CVS/Entries file.

    'folder' is the folder that should contain the CVS subfolder.
    If there is no such subfolder an empty list is returned.
    'files' is a boolean; 1 and 0 means to return files or not.
    'folders' is a boolean; 1 and 0 means to return folders or not.
    �CVS�Entriesrr�/r)rr
r1r	�IOError�	readlines�split�append)�folder�files�foldersr1r�
allEntries�line�entryrrr�
getCVSEntriesxs"	���rac@s"eZdZdZe�d�Zdd�ZdS)�ExtConfigParserz7A slightly extended version to return lists of strings.z\s*\[.*\]\s*cCs8t�|||�}|�dd�}|j�|�rt|tdi�S|S)zECoerce option to a list of strings or return unchanged if that fails.�
rN)rr&�replace�pat�match�eval�__builtins__)�self�section�option�value�valrrr�
getstringlist�s
zExtConfigParser.getstringlistN)rB�
__module__�__qualname__�__doc__�re�compilerernrrrrrb�s
rbc@s*eZdZdZd
dd�Zdd�Zdd�Zd	S)�GlobDirectoryWalkerz<A forward iterator that traverses files in a directory tree.�*c	Cs�d|_||_|�dtj�tj�|�r|g|_g|_dSt	�r%t
r%t|�s+td|��|t
t
j�t
tj�d�|_|jtj}t
|�}tt|fdd�tt|fdd�tt
j�������|_|j��g|_dS)NrrVz"%s" is not a directorycSs||d�S�Nr)�x�nrrr�<lambda>�sz.GlobDirectoryWalker.__init__.<locals>.<lambda>cSs
|�|�Srvr)rw�pfxrrrry�s
)�index�patternrdr�sepr
r3�stackr\rrr�
ValueError�len�archive�	directory�list�map�filter�_files�keys�sort)rir�r|rzrxrrr�__init__�s
4

zGlobDirectoryWalker.__init__cCs�	z|j|j}|jd|_Wn"ty1|j��|_t�|j�|_|�|j|j�|_d|_Yn$wtj	�
|j|�}tj	�|�rLtj	�|�sL|j�
|�t�||j�rU|Sq)Nrr)r\r{�
IndexErrorr~�popr�r�listdir�filterFilesr
r1r3�islinkrZ�fnmatchr|)rir{�file�fullnamerrr�__getitem__�s 
�	�zGlobDirectoryWalker.__getitem__cCs|S)z/Filter hook, overwrite in subclasses as needed.r)rir[r\rrrr��szGlobDirectoryWalker.filterFilesN)ru)rBrorprqr�r�r�rrrrrt�s

rtc@s"eZdZdZddd�Zdd�ZdS)	�RestrictedGlobDirectoryWalkerz&An restricted directory tree iterator.ruNcCs�t�|||�|dkr
g}gj}t|ttf�r!|D]}||�qn	t|t�r*||�tjdkr:dd�|j	D�|_
dS|j	|_
dS)NrVcSsg|]	}|�dtj��qS)rV)rdrr})r�_rrrr�sz:RestrictedGlobDirectoryWalker.__init__.<locals>.<listcomp>)rtr�rZ�
isinstance�tupler��strrr}�__self__�ignorePatterns)rir�r|�ignore�ip�prrrr��s
�
 �z&RestrictedGlobDirectoryWalker.__init__cCsltj}g}t|�D]\}}|jD]}|||�s!|tj�||�|�r&|�|�qq	|��|D]}||=q.|S)z9Filters all items from files matching patterns to ignore.)r��	enumerater�rr
r1rZ�reverse)rir[r\�fnm�indicesToDelete�irr�rrrr��s

��z)RestrictedGlobDirectoryWalker.filterFiles)ruN)rBrorprqr�r�rrrrr��s
r�c@seZdZdZdd�ZdS)�CVSGlobDirectoryWalkerz4An directory tree iterator that checks for CVS data.cCsftjj}t|�}|r1g}tt|��D]}||}|||�|vr$|�|�q|��|D]}||=q+|S)z�Filters files not listed in CVS subfolder.

        This will look in the CVS subfolder of 'folder' for
        a file named 'Entries' and filter all elements from
        the 'files' list that are not listed in 'Entries'.
        )rr
r1ra�ranger�rZr�)rir[r\r1�cvsFilesr�r�rrrrr��s
�z"CVSGlobDirectoryWalker.filterFilesN)rBrorprqr�rrrrr��sr�c@s eZdZdZdd�Zdd�ZdS)�SecureTestCasea�Secure testing base class with additional pre- and postconditions.

    We try to ensure that each test leaves the environment it has
    found unchanged after the test is performed, successful or not.

    Currently we restore sys.path and the working directory, but more
    of this could be added easily, like removing temporary files or
    similar things.

    Use this as a base class replacing unittest.TestCase and call
    these methods in subclassed versions before doing your own
    business!
    cCstjdd�|_t��|_dS)z0Remember sys.path and current working directory.N)r#r
�_initialPathrr)�_initialWorkDir�rirrr�setUp'szSecureTestCase.setUpcCs|jt_t�|j�dS)z0Restore previous sys.path and working directory.N)r�r#r
r�chdirr�r�rrr�tearDown,szSecureTestCase.tearDownN)rBrorprqr�r�rrrrr�sr�c@seZdZddd�Zee�ZdS)�NearTestCase��h㈵��>cCsjt|ttf�rt||�|krtd||f��dSt||�D]\}}t||�|kr2td||f��qdS)Nz%s not near %s)r��float�int�abs�AssertionError�zip)�a�b�accuracy�ae�berrr�
assertNear2s���zNearTestCase.assertNearN)r�)rBrorpr��staticmethodrrrrr�1s
r�c@s2eZdZdZddd�Zdd�Zdd�Zd	d
�ZdS)
�ScriptThatMakesFileTestzyRuns a Python script at OS level, expecting it to produce a file.

    It CDs to the working directory to run the script.rcCs(||_||_||_||_tj�|�dSrv)r6�
scriptName�outFileName�verboserJ�TestCaser�)rir6r�r�r�rrrr�@s
z ScriptThatMakesFileTest.__init__cCsrt��|_|j}tj�|�stj�t|�}t�|�tj�	|j
�s(Jd|j
��tj�	|j�r7t�|j�dSdS)NzScript %s not found!)
rr)�cwdr6r
r.r1r2r�rr�r�r)rir6rrrr�Hs

�zScriptThatMakesFileTest.setUpcCst�|j�dSrv)rr�r�r�rrrr�Tsz ScriptThatMakesFileTest.tearDowncCsZtjdkrdpd}ddl}|�tj|jf�}|jrt|�tj	�
|j�s+Jd|j��dS)N�win32z"%s" %sz%s %srzFile %s not created!)r#�platform�
subprocess�check_output�
executabler�r�rFrr
rr�)ri�fmtr��outrrr�runTestWs zScriptThatMakesFileTest.runTestN)r)rBrorprqr�r�r�r�rrrrr�<s
r��utf8cCs,t|�t|�kr||kSt||�t||�kSrv)�typer)r�r��encrrr�equalStringsbs,r�cCs(||krtdt|�t|�f�dSdS)NzStrings unequal
exp: %s
got: %s)rF�ascii)�rrwrrr�eqCheckes�r�cCszddl}WdSYdS)NrFT��rlextrar�rrr�
rlextraNeededis
r�)r)rr)r�)(r+�_rl_testing�__version__rqr#rr�rr�configparserrrJ�reportlab.lib.utilsrrrrrr"r-r2r8r%r&r=rArCrIrSrarbrtr�r�r�r�r�r�r�r�r�rrrr�<module>s@ 0�


	.!
&

Youez - 2016 - github.com/yon3zu
LinuXploit