
    ^h                     ^   S SK r S SKrS SKrS SKrS SKrS SKrS SKrS SKrS SKrS SK	r	S SK
Jr  \R                  " S\R                  \R                     S9r\R                   " \R"                  S:g  =(       d    \R                  S:H  S5      r\R                   " S\R&                  ;   S	5      r\R                   " \R*                  " 5       S
:g  =(       d    \R,                  " S5      S5      rS r\R                   " \" 5       (       + S5      rS rS r\ R8                  S 5       rSrS\S\4S jrg)    N)bind_unused_port_TestCaseType)boundposixcygwinznon-unix platform
NO_NETWORKznetwork access disabledCPythonPy_GIL_DISABLEDzNot CPython implementationc                  B   [         R                  (       d  gS n  [         R                   " [         R                  5      n U R                  S5         U b  U R                  5         g! [         a     U b  U R                  5         ggf = f! U b  U R                  5         f f = f)NF)z::1r   T)sockethas_ipv6AF_INET6bindOSErrorclose)socks    K/home/james-whalen/.local/lib/python3.13/site-packages/tornado/test/util.py_detect_ipv6r   !   s    ?? D}}V__-		* JJL  JJL  JJL s#   5A$ $
B.B BB Bzipv6 support not presentc                     [        5       u  pU R                  S5        [        R                  " 5       nUR                  SU45        U R	                  5       u  p4UR                  5         U R                  5         UR
                  US   4$ )zReturns a local port number that will refuse all connections.

Return value is (cleanup_func, port); the cleanup function
must be called to free the port to be reused.
Tz	127.0.0.1   )r   setblockingr   connectacceptr   )server_socketportclient_socketconnclient_addrs        r   refusing_portr   5   sv     +,Md#MMOM;-.%,,.DJJLQ00    c                 b    [        U 40 UD6n0 n[        [        R                  " U5      X45        U$ )zExecute ``s`` in a given context and return the result namespace.

Used to define functions for tests in particular python
versions that would be syntax errors in older versions.
)dictexectextwrapdedent)caller_globalscaller_localssglobal_namespacelocal_namespaces        r   	exec_testr+   I   s3     N<m<O	-?r    c               #      #    [         R                  " 5          [         R                  " S[        5        Sv   SSS5        g! , (       d  f       g= f7f)z/Context manager to ignore deprecation warnings.ignoreN)warningscatch_warningssimplefilterDeprecationWarning r    r   ignore_deprecationr3   X   s2      
	 	 	"h(:; 
#	"	"s   A A	A
AAzabstract base classclsreturnc                 $   ^  " U4S jSU 5      mT$ )a  Decorator to mark a test class as an "abstract" base class.

This is different from a regular abstract base class because
we do not limit instantiation of the class. (If we did, it would
interfere with test discovery). Instead, we prevent the tests from
being run.

Subclasses of an abstract base test are run as normal. There is
no support for the ``@abstractmethod`` decorator so there is no runtime
check that all such methods are implemented.

Note that while it is semantically cleaner to modify the test loader
to exclude abstract base tests, this is more complicated and would
interfere with third-party test runners. This approach degrades
gracefully to other tools such as editor-integrated testing.
c                   6   >^  \ rS rSr\UU 4S j5       rSrU =r$ )/abstract_base_test.<locals>.AbstractBaseWrapperw   c                 `   > U TL a  [         R                  " [        5      e[        TU ]  5         g )N)unittestSkipTestABT_SKIP_MESSAGEsuper
setUpClass)r4   AbstractBaseWrapper	__class__s    r   r?   :abstract_base_test.<locals>.AbstractBaseWrapper.setUpClassx   s,    ))''(899%s68r    r2   )__name__
__module____qualname____firstlineno__classmethodr?   __static_attributes____classcell__)rA   r@   s   @r   r@   r8   w   s    		9 
	9r    r@   r2   )r4   r@   s    @r   abstract_base_testrJ   c   s    (9c 9 r    ) 
contextlibosplatformr   sys	sysconfigr$   typingr;   r.   tornado.testingr   TypeVarTypeTestCaser   skipIfnameskipIfNonUnixenvironskipIfNoNetworkpython_implementationget_config_varskipNotCPythonr   skipIfNoIPv6r   r+   contextmanagerr3   r=   rJ   r2   r    r   <module>r_      s     	   
      ,fkk(BSBS6TUGGw2#,,(24G //,"**"<>WX ""$	1 3 12 " <>13MN1(   ) M m r    