K iDddlZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl m Z ejdejejZej ej"dk7xsejdk(dZej dej&vd Zej ej*d k7xsej,d d Zd Zej e dZdZdZej8dZdZdedefdZy)N)bind_unused_port _TestCaseType)boundposixcygwinznon-unix platform NO_NETWORKznetwork access disabledCPythonPy_GIL_DISABLEDzNot CPython implementationc.tjsyd} tjtj}|jd ||j y#t$rY||j yywxYw#||j wwxYw)NF)z::1rT)sockethas_ipv6AF_INET6bindOSErrorclose)socks W/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/tornado/test/util.py _detect_ipv6r!s ?? D}}V__- *   JJL     JJL    JJL s#4A A<&A?;A<<A??Bzipv6 support not presentct\}}|jdtj}|jd|f|j \}}|j |j |j |dfS)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 connectacceptr) server_socketport client_socketconn client_addrs r refusing_portr5sz+,M4d#MMOM;-.%,,.D+JJL   Q 00cbt|fi|}i}ttj||||S)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. )dictexectextwrapdedent)caller_globals caller_localssglobal_namespacelocal_namespaces r exec_testr+Is5N.AbstractBaseWrapperc\|urtjtt|y)N)unittestSkipTestABT_SKIP_MESSAGEsuper setUpClass)r4AbstractBaseWrapper __class__s rr>z:abstract_base_test..AbstractBaseWrapper.setUpClassxs,))''(899 %s 6 8r )__name__ __module__ __qualname__ classmethodr> __classcell__)r@r?s@rr?r8ws  9  9r r?r2)r4r?s @rabstract_base_testrFcs(9c9 r ) contextlibosplatformr sys sysconfigr$typingr:r.tornado.testingrTypeVarTypeTestCaserskipIfname skipIfNonUnixenvironskipIfNoNetworkpython_implementationget_config_varskipNotCPythonr skipIfNoIPv6rr+contextmanagerr3r<rFr2r rr[s.   ,fkk(BSBS6TU GGw2#,,(24G "(//,"**"<>WX #H""$ 13y 12 "x<>13MN 1(  )Mmr