$29 GRAYBYTE WORDPRESS FILE MANAGER $83

SERVER : premium201.web-hosting.com #1 SMP Wed Mar 26 12:08:09 UTC 2025
SERVER IP : 104.21.15.130 | ADMIN IP 216.73.216.174
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : NONE

/opt/hc_python/lib/python3.12/site-packages/nose/__pycache__/

HOME
Current File : /opt/hc_python/lib/python3.12/site-packages/nose/__pycache__//twistedtools.cpython-312.pyc
�

H��g���d�dZddlZddlmZmZddlmZmZgd�Zda	d�Z
e
�\ZZd�Z
d	d�Zy)
av
Twisted integration
-------------------

This module provides a very simple way to integrate your tests with the
Twisted_ event loop.

You must import this module *before* importing anything from Twisted itself!

Example::

  from nose.twistedtools import reactor, deferred
  
  @deferred()
  def test_resolve():
      return reactor.resolve("www.python.org")

Or, more realistically::

  @deferred(timeout=5.0)
  def test_resolve():
      d = reactor.resolve("www.python.org")
      def check_ip(ip):
          assert ip == "67.15.36.43"
      d.addCallback(check_ip)
      return d

.. _Twisted: http://twistedmatrix.com/trac/
�N)�Queue�Empty)�make_decorator�TimeExpired)�threaded_reactor�reactor�deferredr�stop_reactorc����	ddlm�tsAddlm}ddlm}|�fd���atjd�tj��tfS#t$rYywxYw)	z�
    Start the Twisted reactor in a separate thread, if not already done.
    Returns the reactor.
    The thread will automatically be destroyed when all the tests are done.
    r�r)NN)�
threadable)�Threadc�(���jd��S)NF)�installSignalHandlers)�runrs��@/opt/hc_python/lib/python3.12/site-packages/nose/twistedtools.py�<lambda>z"threaded_reactor.<locals>.<lambda>8s������&+�1<�1-�)�targetT)
�twisted.internetr�ImportError�_twisted_thread�twisted.pythonr
�	threadingr�	setDaemon�start)r
rrs  @rrr*s^����,��-�$� �)-�.���!�!�$�'������O�#�#������s�A�	A$�#A$c���d�}tj|�tj�tj	�D]#}|j�s�|j
��%day)aStop the reactor and join the reactor thread until it stops.
    Call this function in teardown at the module or package level to
    reset the twisted system after your tests. You *must* do this if
    you mix tests using these tools and tests using twisted.trial.
    c�,�tj�y)z0Helper for calling stop from withing the thread.N)r�stop�rrr
z"stop_reactor.<locals>.stop_reactorJs�����rN)r�callFromThread�reactor_thread�join�getDelayedCalls�active�cancelr)r
�ps  rr
r
BsO������<�(�����
�
$�
$�
&���8�8�:�
�H�H�J�'��Orc����t�\�}��td��	�duxs�dz��fd�}|S#t$rtd��wxYw)a
    By wrapping a test function with this decorator, you can return a
    twisted Deferred and the test will wait for the deferred to be triggered.
    The whole test function will run inside the Twisted event loop.

    The optional timeout parameter specifies the maximum duration of the test.
    The difference with timed() is that timed() will still wait for the test
    to end, while deferred() will stop the test when its timeout has expired.
    The latter is more desireable when dealing with network tests, because
    the result may actually never arrive.

    If the callback is triggered, the test has passed.
    If the errback is triggered or the timeout expires, the test has failed.

    Example::
    
        @deferred(timeout=5.0)
        def test_resolve():
            return reactor.resolve("www.python.org")

    Attention! If you combine this decorator with other decorators (like
    "raises"), deferred() must be called *first*!

    In other words, this is good::
        
        @raises(DNSLookupError)
        @deferred()
        def test_error():
            return reactor.resolve("xxxjhjhj.biz")

    and this is bad::
        
        @deferred()
        @raises(DNSLookupError)
        def test_error():
            return reactor.resolve("xxxjhjhj.biz")
    Nz1twisted is not available or could not be importedrz+'timeout' argument must be a number or Nonec�:������fd�}t��|�}|S)Nc�������	�t��	�	fd���	fd������
��	fd�}�j|�	�	j���}|�|\}}}||�j|��y#t$rt	d�z��wxYw)Nc�(���jd�y�N)�put)�value�qs �r�callbackz=deferred.<locals>.decorate.<locals>.wrapper.<locals>.callback�s������d�rc�|��	|j�y#�jtj��YyxYwr,)�raiseExceptionr-�sys�exc_info)�failurer/s �r�errbackz<deferred.<locals>.decorate.<locals>.wrapper.<locals>.errback�s-���*��*�*�,��*��E�E�#�,�,�.�)�s��%;c����	��i���}	|j���y#t$rtd��wxYw#�jt	j
��YyxYw)Nz7you must return a twisted Deferred from your test case!)�addCallbacks�AttributeError�	TypeErrorr-r3r4)�d�argsr0r6�func�kargsr/s ������r�gz6deferred.<locals>.decorate.<locals>.wrapper.<locals>.g�sj���*��d�,�e�,�A�@����x��9��*�@�'�)?�@�@�@��
*��E�E�#�,�,�.�)�s�7��4�7�%A)�timeoutz*timeout expired before end of test (%f s.))rr!�getrr�with_traceback)
r<r>r?�error�exc_type�	exc_value�tbr0r6r/r=rr@s
``     @@@���r�wrapperz+deferred.<locals>.decorate.<locals>.wrapper�s������A�
�
*�

*�

*�
�"�"�1�%�
-����g��.��
� �*/�'��)�R��y�)�8�8��<�<�!��	�
-�!�"N�$+�#,�-�-�
-�s�A)�)B)r)r=rGrr@s` ��r�decoratezdeferred.<locals>.decorate�s!���!	=�D'�.��&�w�/���r)rrr:)r@r"rHrs`  @rr	r	Vsh���L/�0��G�^����M�N�N�G��4��&�7�Q�;��$�J�O��Q�G��E�F�F�G�s	�1�Ar,)�__doc__r3�queuerr�
nose.toolsrr�__all__rrrr"r
r	r rr�<module>rMsB���<��2���
��$�*+�,�����(Vr


Current_dir [ NOT WRITEABLE ] Document_root [ WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
4 Apr 2025 8.03 AM
root / root
0755
__init__.cpython-312.pyc
0.619 KB
4 Apr 2025 8.03 AM
root / root
0644
__main__.cpython-312.pyc
0.439 KB
4 Apr 2025 8.03 AM
root / root
0644
case.cpython-312.pyc
16.521 KB
4 Apr 2025 8.03 AM
root / root
0644
commands.cpython-312.pyc
7.2 KB
4 Apr 2025 8.03 AM
root / root
0644
config.cpython-312.pyc
30.731 KB
4 Apr 2025 8.03 AM
root / root
0644
core.cpython-312.pyc
16.784 KB
4 Apr 2025 8.03 AM
root / root
0644
exc.cpython-312.pyc
0.559 KB
4 Apr 2025 8.03 AM
root / root
0644
failure.cpython-312.pyc
2.285 KB
4 Apr 2025 8.03 AM
root / root
0644
importer.cpython-312.pyc
7.765 KB
4 Apr 2025 8.03 AM
root / root
0644
inspector.cpython-312.pyc
8.422 KB
4 Apr 2025 8.03 AM
root / root
0644
loader.cpython-312.pyc
26.476 KB
4 Apr 2025 8.03 AM
root / root
0644
proxy.cpython-312.pyc
10.119 KB
4 Apr 2025 8.03 AM
root / root
0644
pyversion.cpython-312.pyc
9.988 KB
4 Apr 2025 8.03 AM
root / root
0644
result.cpython-312.pyc
8.917 KB
4 Apr 2025 8.03 AM
root / root
0644
selector.cpython-312.pyc
11.738 KB
4 Apr 2025 8.03 AM
root / root
0644
suite.cpython-312.pyc
27.258 KB
4 Apr 2025 8.03 AM
root / root
0644
twistedtools.cpython-312.pyc
6.741 KB
4 Apr 2025 8.03 AM
root / root
0644
util.cpython-312.pyc
27.329 KB
4 Apr 2025 8.03 AM
root / root
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025 CONTACT ME
Static GIF