HEX
Server: nginx/1.24.0
System: Linux localhost 5.15.0-46-generic #49-Ubuntu SMP Thu Aug 4 18:03:25 UTC 2022 x86_64
User: www (1000)
PHP: 8.3.27
Disabled: passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
Upload Files
File: //usr/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