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 :  /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 : /lib/python3/dist-packages/twisted/internet/test/__pycache__/test_posixbase.cpython-310.pyc
o

�b�%�@s�dZddlmZddlmZmZddlmZddlm	Z	dZ
zddlmZddl
mZWney7d	Z
Ynwdd
lmZddlmZGdd
�d
e�ZGdd�de	�ZGdd�de	�ZGdd�de�ZGdd�de	�ZGdd�de	�ZGdd�de	�ZdS)z>
Tests for L{twisted.internet.posixbase} and supporting code.
�)�Deferred)�PosixReactorBase�_Waker)�
ServerFactory)�TestCaseN)�unix)�ClientProtoz)Platform does not support AF_UNIX sockets��reactor)�Portc@s4eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)�TrivialReactorcCsi|_i|_t�|�dS�N)�_readers�_writersr�__init__��self�r�F/usr/lib/python3/dist-packages/twisted/internet/test/test_posixbase.pyrszTrivialReactor.__init__cC�d|j|<dS�NT�r�r�readerrrr�	addReader�zTrivialReactor.addReadercC�|j|=dSr
rrrrr�removeReader"�zTrivialReactor.removeReadercCrr�r�r�writerrrr�	addWriter%rzTrivialReactor.addWritercCrr
rr rrr�removeWriter(rzTrivialReactor.removeWriterN)�__name__�
__module__�__qualname__rrrr"r#rrrrrsrc@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)�PosixReactorBaseTestsz(
    Tests for L{PosixReactorBase}.
    cCs2|�|jt�|�|j|j�|�|j|j�dSr
)�assertIsInstance�wakerr�assertIn�_internalReadersr�rr
rrr�_checkWaker1sz!PosixReactorBaseTests._checkWakercCst�}|�|�dS)z
        When L{PosixReactorBase} is instantiated, it creates a waker and adds
        it to its internal readers set.
        N)rr-r,rrr�test_wakerIsInternalReader6sz0PosixReactorBaseTests.test_wakerIsInternalReadercCs\t�}t�}|j�|�|�|�|�|j|j�|�|�|�	||j�|�	||j�dS)z�
        Any L{IReadDescriptors} in L{PosixReactorBase._internalReaders} are
        left alone by L{PosixReactorBase._removeAll}.
        N)
r�objectr+�addr�
_removeAllrrr-r*)rr
�extrarrr�"test_removeAllSkipsInternalReaders>s

z8PosixReactorBaseTests.test_removeAllSkipsInternalReaderscCsjt�}t�}t�}|�|�|�|�|�|j|j�}|�t|�||h�|�	||j�|�	||j�dS)z�
        L{PosixReactorBase._removeAll} returns a list of removed
        L{IReadDescriptor} and L{IWriteDescriptor} objects.
        N)
rr/rr"r1rr�assertEqual�set�assertNotIn)rr
rr!�removedrrr�'test_removeAllReturnsRemovedDescriptorsLs

z=PosixReactorBaseTests.test_removeAllReturnsRemovedDescriptorsN)r$r%r&�__doc__r-r.r3r8rrrrr',sr'c@s&eZdZdZeee�s
dZdd�ZdS)�TCPPortTestsz1
    Tests for L{twisted.internet.tcp.Port}.
    zNon-posixbase reactorcCs,tdt��}d|_dd�|_|�|��t�S)z�
        L{Port.stopListening} returns a L{Deferred} which errbacks if
        L{Port.connectionLost} raises an exception.
        i90TcSsddS)N�rr)�reasonrrr�<lambda>k�z8TCPPortTests.test_connectionLostFailed.<locals>.<lambda>)rr�	connected�connectionLost�
assertFailure�
stopListening�ZeroDivisionError)r�portrrr�test_connectionLostFailedds
z&TCPPortTests.test_connectionLostFailedN)	r$r%r&r9�
isinstancer
r�skiprErrrrr:\s

r:c@s8eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�ZdS)
�TimeoutReportReactorz�
    A reactor which is just barely runnable and which cannot monitor any
    readers or writers, and which fires a L{Deferred} with the timeout
    passed to its C{doIteration} method as soon as that method is invoked.
    cCst�|�t�|_d|_dS)N�d)rrr�iterationTimeout�nowrrrrrvs

zTimeoutReportReactor.__init__cCsdS)z�
        Ignore the reader.  This is necessary because the waker will be
        added.  However, we won't actually monitor it for any events.
        Nrrrrrr{�zTimeoutReportReactor.addReadercCsgS)z�
        There are no readers or writers, so there is nothing to remove.
        This will be called when the reactor stops, though, so it must be
        implemented.
        rrrrr�	removeAll�szTimeoutReportReactor.removeAllcCs|jS)zx
        Override the real clock with a deterministic one that can be easily
        controlled in a unit test.
        )rKrrrr�seconds�szTimeoutReportReactor.secondscCs&|j}|durd|_|�|�dSdSr
)rJ�callback)r�timeout�drrr�doIteration�s
�z TimeoutReportReactor.doIterationN)	r$r%r&r9rrrMrNrRrrrrrHosrHc@sPeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�ZdS)�IterationTimeoutTestsz�
    Tests for the timeout argument L{PosixReactorBase.run} calls
    L{PosixReactorBase.doIteration} with in the presence of various delayed
    calls.
    cs6g}�j�|j��j��fdd�����|dS)Ncs���Sr
)�stop)�ignoredr	rrr=�r>z>IterationTimeoutTests._checkIterationTimeout.<locals>.<lambda>r)rJ�addCallback�append�run�rr
rPrr	r�_checkIterationTimeout�s
z,IterationTimeoutTests._checkIterationTimeoutcCst�}|�|�}|�|�dS)zl
        If there are no delayed calls, C{doIteration} is called with a
        timeout of L{None}.
        N)rHrZ�assertIsNonerYrrr�test_noCalls�s
z"IterationTimeoutTests.test_noCallscCs0t�}|�ddd��|�|�}|�|d�dS)z�
        If there is a delayed call, C{doIteration} is called with a timeout
        which is the difference between the current time and the time at
        which that call is to run.
        rIcS�dSr
rrrrrr=�rLz8IterationTimeoutTests.test_delayedCall.<locals>.<lambda>N�rH�	callLaterrZr4rYrrr�test_delayedCall�s
z&IterationTimeoutTests.test_delayedCallcCs>t�}|�ddd��|jd7_|�|�}|�|d�dS)z�
        If a delayed call is scheduled and then some time passes, the
        timeout passed to C{doIteration} is reduced by the amount of time
        which passed.
        rIcSr]r
rrrrrr=�rLz7IterationTimeoutTests.test_timePasses.<locals>.<lambda>��KN)rHr_rKrZr4rYrrr�test_timePasses�s

z%IterationTimeoutTests.test_timePassescCsPt�}|�ddd��|�ddd��|�ddd��|�|�}|�|d�dS)	z�
        If there are several delayed calls, C{doIteration} is called with a
        timeout which is the difference between the current time and the
        time at which the earlier of the two calls is to run.
        �2cSr]r
rrrrrr=�rLzAIterationTimeoutTests.test_multipleDelayedCalls.<locals>.<lambda>�
cSr]r
rrrrrr=�rLrIcSr]r
rrrrrr=�rLNr^rYrrr�test_multipleDelayedCalls�s
z/IterationTimeoutTests.test_multipleDelayedCallscCsHt�}|�ddd��}|jd7_|�d�|�|�}|�|d�dS)z�
        If a delayed call is reset, the timeout passed to C{doIteration} is
        based on the interval between the time when reset is called and the
        new delay of the call.
        rdcSr]r
rrrrrr=�rLz=IterationTimeoutTests.test_resetDelayedCall.<locals>.<lambda>ra�N)rHr_rK�resetrZr4�rr
�callrPrrr�test_resetDelayedCall�s

z+IterationTimeoutTests.test_resetDelayedCallcCsHt�}|�ddd��}|jd7_|�d�|�|�}|�|d�dS)z�
        If a delayed call is re-delayed, the timeout passed to
        C{doIteration} is based on the remaining time before the call would
        have been made and the additional amount of time passed to the delay
        method.
        rdcSr]r
rrrrrr=�rLz=IterationTimeoutTests.test_delayDelayedCall.<locals>.<lambda>re��<N)rHr_rK�delayrZr4rirrr�test_delayDelayedCall�s

z+IterationTimeoutTests.test_delayDelayedCallcCs6t�}|�ddd��}|��|�|�}|�|�dS)zp
        If the only delayed call is canceled, L{None} is the timeout passed
        to C{doIteration}.
        rdcSr]r
rrrrrr=�rLz>IterationTimeoutTests.test_cancelDelayedCall.<locals>.<lambda>N)rHr_�cancelrZr[rirrr�test_cancelDelayedCall�s

z,IterationTimeoutTests.test_cancelDelayedCallN)r$r%r&r9rZr\r`rcrfrkrorqrrrrrS�s	

rSc@s,eZdZdZedureZdd�Zdd�ZdS)�ConnectedDatagramPortTestsz/
    Test connected datagram UNIX sockets.
    Ncs.�fdd�}t�dt��}||_|�d�dS)z�
        L{ConnectedDatagramPort} does not call the deprecated C{loseConnection}
        in L{ConnectedDatagramPort.connectionFailed}.
        cs��d�dS)z�
            Dummy C{loseConnection} method. C{loseConnection} is deprecated and
            should not get called.
            z7loseConnection is deprecated and should not get called.N)�failrrrr�loseConnectionsz`ConnectedDatagramPortTests.test_connectionFailedDoesntCallLoseConnection.<locals>.loseConnectionN�goodbye)r�ConnectedDatagramPortrrt�connectionFailed)rrtrDrrr�-test_connectionFailedDoesntCallLoseConnectionszHConnectedDatagramPortTests.test_connectionFailedDoesntCallLoseConnectioncs@d�_�fdd�}t�dt��}||_|�d����j�dS)z�
        L{ConnectedDatagramPort} calls L{ConnectedDatagramPort.stopListening}
        instead of the deprecated C{loseConnection} in
        L{ConnectedDatagramPort.connectionFailed}.
        Fcs
d�_dS)z8
            Dummy C{stopListening} method.
            TN)�calledrrrrrBs
zYConnectedDatagramPortTests.test_connectionFailedCallsStopListening.<locals>.stopListeningNru)ryrrvrrBrw�
assertTrue)rrBrDrrr�'test_connectionFailedCallsStopListenings
zBConnectedDatagramPortTests.test_connectionFailedCallsStopListening)r$r%r&r9�skipSocketsrGrxr{rrrrrr�srrc@seZdZdd�ZdS)�
WakerTestscCs0tdd�}|��}|�d�|�t|�d�dS)Nr	r)r�
flushWarningsr@r4�len)rr)�warningsrrr� test_noWakerConstructionWarnings's

z+WakerTests.test_noWakerConstructionWarningsN)r$r%r&r�rrrrr}&sr})r9�twisted.internet.deferr�twisted.internet.posixbaserr�twisted.internet.protocolr�twisted.trial.unittestrr|�twisted.internetr�twisted.test.test_unixr�ImportErrorr
�twisted.internet.tcprrr'r:rHrSrrr}rrrr�<module>s*�0(b-

Anon7 - 2022
AnonSec Team