CasperSecurity

Current Path : /lib/python3/dist-packages/twisted/python/test/__pycache__/
Upload File :
Current File : //lib/python3/dist-packages/twisted/python/test/__pycache__/modules_helpers.cpython-310.pyc

o

�b
�@sJdZddlZddlmZddlmZmZmZddlm	Z	Gdd�d�Z
dS)z\
Facilities for helping test code which interacts with Python's module system
to load code.
�N)�
ModuleType)�Iterable�List�Tuple)�FilePathc@sXeZdZdZdeeddfdd�Zdeeee	fddfdd	�Z
ddedefdd
�ZdS)�TwistedModulesMixinz�
    A mixin for C{twisted.trial.unittest.SynchronousTestCase} providing useful
    methods for manipulating Python's module system.
    �sysPath�returnNcs8tjdd��d�fdd�}|�|�|tjdd�<dS)zW
        Replace sys.path, for the duration of the test, with the given value.
        Nr	cs�tjdd�<dS�N)�sys�path���originalSysPathr
�E/usr/lib/python3/dist-packages/twisted/python/test/modules_helpers.py�cleanUpSysPathsz:TwistedModulesMixin.replaceSysPath.<locals>.cleanUpSysPath�r	N)rr�
addCleanup)�selfrrr
rr�replaceSysPaths
z"TwistedModulesMixin.replaceSysPath�
sysModulescs<tj���d�fdd�}|�|�tj��tj�|�dS)zZ
        Replace sys.modules, for the duration of the test, with the given value.
        r	Ncstj��tj���dSr
)r�modules�clear�updater
��originalSysModulesr
r�cleanUpSysModules(s
z@TwistedModulesMixin.replaceSysModules.<locals>.cleanUpSysModulesr)rr�copyrrr)rrrr
rr�replaceSysModules"s



z%TwistedModulesMixin.replaceSysModules�test_package�pkgnamecCs2t|���}|�d�}|��|�d��d�|S)z�
        Generate a L{FilePath} with one package, named C{pkgname}, on it, and
        return the L{FilePath} of the path entry.
        rz__init__.py�)r�mktemp�child�makedirs�
setContent)rr �entry�pkgr
r
r�pathEntryWithOnePackage0s

z+TwistedModulesMixin.pathEntryWithOnePackage)r)
�__name__�
__module__�__qualname__�__doc__r�strrrrrrrr(r
r
r
rrs
r)r,r�typesr�typingrrr�twisted.python.filepathrrr
r
r
r�<module>s
Hacker Blog, Shell İndir, Sql İnjection, XSS Attacks, LFI Attacks, Social Hacking, Exploit Bot, Proxy Tools, Web Shell, PHP Shell, Alfa Shell İndir, Hacking Training Set, DDoS Script, Denial Of Service, Botnet, RFI Attacks, Encryption
Telegram @BIBIL_0DAY