Файловый менеджер - Редактировать - /opt/imh-python/lib/python3.9/site-packages/twisted/internet/test/__pycache__/test_endpoints.cpython-39.pyc
Ðазад
a k�h�D � @ sR d Z ddlmZ ddlmZmZmZmZmZ ddl m Z ddlmZ ddl mZ ddlmZmZmZ ddlmZ dd lmZmZ dd lmZ ddlmZmZmZmZmZm Z m!Z!m"Z" ddl#m$Z$ dd l%m&Z&m'Z'm(Z(m)Z)m*Z* ddl+m,Z, ddl-m.Z. ddl/m0Z0m1Z1m2Z2m3Z3m4Z4 ddl5m6Z6m7Z7m8Z8 ddl9m:Z: ddl;m<Z< ddl=m>Z?m@Z@mAZAmBZB ddlCmDZDmEZE ddlFmGZG ddlHmIZImJZJ ddlKmLZL ddlMmNZN ddlOmPZP ddlQmRZR ddlSmTZT ddlUmVZV ddlWmXZX ddlYmZZZm[Z[ dd l\m Z eVd!�j]�^d"�Z_eVd!�j]�^d#�Z`eVd!�j]�^d$�ZaeVeb�j]�^d%�Zcec�dd&�Zee�fe_jg�Zhe�fe`jg�Zie�feajg�Zje�fecjg�Zke�feejg�Zlztdd'lmmnZompZpmqZqmrZr dd(lsmtZtmuZumvZvmwZwmxZx dd)lymzZz dd*l{m|Z| et�}e_�~� �Zex�}e_�~� �Z�d+Z�d,Z�W n2 e��y Z� zd-Z�e�e��Z�W Y d.Z�[�n d.Z�[�0 0 G d/d0� d0e8�Z�eej��G d1d2� d2e���Z�eej��G d3d4� d4e���Z�eej��G d5d6� d6e���Z�G d7d8� d8e6�Z�G d9d:� d:e6�Z�G d;d<� d<e j��Z�G d=d>� d>�Z�G d?d@� d@�Z�G dAdB� dBe�e��Z�G dCdD� dDe7�Z�G dEdF� dF�Z�G dGdH� dHe j��Z�G dIdJ� dJej8�Z�eej��G dKdL� dLeB��Z�eej0e�� eej2e�� eej�e�� eej��G dMdN� dN��Z�G dOdP� dPe j��Z�G dQdR� dRe j��Z�G dSdT� dTe j��Z�G dUdV� dVe�e j��Z�G dWdX� dXe�e j��Z�G dYdZ� dZe�e j��Z�G d[d\� d\e@e<�Z�d�d^d_�Z�G d`da� dae j��Z�G dbdc� dce j��Z�G ddde� dee��Z�G dfdg� dge�e j��Z�G dhdi� die�e j��Z�G djdk� dke�e j��Z�G dldm� dme�e j��Z�G dndo� doe j��Z�G dpdq� dqe j��Z�G drds� dse j��Z�G dtdu� due j��Z�ee�e��G dvdw� dwe�e j���Z�G dxdy� dye�e j��Z�G dzd{� d{e j��Z�G d|d}� d}e j��Z�d�dd��Z�G d�d�� d�e j��Z�ee�e��G d�d�� d�e j���Z�G d�d�� d�e�e j��Z�G d�d�� d�e j��Z�G d�d�� d�e j��Z�G d�d�� d�e j��Z�G d�d�� d�e j��Z�G d�d�� d�eJj��Z�G d�d�� d�eJj��Z�G d�d�� d�eIj��Z�G d�d�� d�eZ�G d�d�� d�e j��Z�d�d�� Z�ee�e��G d�d�� d�e j���Z�d�d�� Z�G d�d�� d�e j��Z�d.S )�z� Test the C{I...Endpoint} implementations that wrap the L{IReactorTCP}, L{IReactorSSL}, and L{IReactorUNIX} interfaces found in L{twisted.internet.endpoints}. � )�EPERM)�AF_INET�AF_INET6�IPPROTO_TCP�SOCK_STREAM�gaierror)�FunctionType)� normalize)�skipIf)�implementer� providedBy�provider)�InterfaceClass)�verifyClass�verifyObject)�plugins)�defer� endpoints�error� interfaces�protocol�reactor�stdio�threads)� isIPv6Address)�HostnameAddress�IPv4Address�IPv6Address�UNIXAddress�_ProcessAddress)�StandardErrorBehavior)�ConnectingCancelledError)� IConsumer�IHostnameResolver� IPushProducer�IReactorPluggableNameResolver� ITransport)� ClientFactory�Factory�Protocol)�PipeAddress)�Clock)�MemoryReactorClock�RaisingMemoryReactor�StringTransport� StringTransportWithDisconnection)�ILogObserver�globalLogPublisher)� getPlugins)�basic�policies)�log)�nativeString)�proxyForInterface)�Failure)�FilePath)� getModule)� ListenFDs)�connectableEndpoint�connectedServerAndClient)�unittestztwisted.testz server.pemzkey.pem.no_trailing_newlinezcert.pem.no_trailing_newlineZfake_CAsz chain.pem)�Context�OP_NO_SSLv3� SSLv23_METHOD�TLSv1_METHOD)�Certificate�CertificateOptions�DiffieHellmanParameters�KeyPair�PrivateCertificate��TLSMemoryBIOFactory)�makeCertificateF� TNc @ s8 e Zd ZdZdd� Zdd� Zdd� Zdd � Zd d� ZdS ) �TestProtocolzx Protocol whose only function is to callback deferreds on the factory when it is connected or disconnected. c C s g | _ g | _d| _d S �Nr )�data�connectionsLost�connectionMadeCalls��self� rS ��/root/rpmbuild/BUILDROOT/imh-python39-modules-3.9.7-92.el8.x86_64/opt/imh-python/lib/python3.9/site-packages/twisted/internet/test/test_endpoints.py�__init__| s zTestProtocol.__init__c C s dS )N�A Test ProtocolrS rQ rS rS rT � logPrefix� s zTestProtocol.logPrefixc C s | j d7 _ d S �N� )rP rQ rS rS rT �connectionMade� s zTestProtocol.connectionMadec C s | j �|� d S �N)rN �append�rR rN rS rS rT �dataReceived� s zTestProtocol.dataReceivedc C s | j �|� d S r[ )rO r\ �rR �reasonrS rS rT �connectionLost� s zTestProtocol.connectionLostN) �__name__� __module__�__qualname__�__doc__rU rW rZ r^ ra rS rS rS rT rL v s rL c @ s( e Zd ZdZdd� Zdd� Zdd� ZdS ) �TestHalfCloseableProtocolab A Protocol that implements L{IHalfCloseableProtocol} and records whether its C{readConnectionLost} and {writeConnectionLost} methods are called. @ivar readLost: A C{bool} indicating whether C{readConnectionLost} has been called. @ivar writeLost: A C{bool} indicating whether C{writeConnectionLost} has been called. c C s t �| � d| _d| _d S )NF)rL rU �readLost� writeLostrQ rS rS rT rU � s z"TestHalfCloseableProtocol.__init__c C s d| _ d S �NT)rg rQ rS rS rT �readConnectionLost� s z,TestHalfCloseableProtocol.readConnectionLostc C s d| _ d S ri )rh rQ rS rS rT �writeConnectionLost� s z-TestHalfCloseableProtocol.writeConnectionLostN)rb rc rd re rU rj rk rS rS rS rT rf � s rf c @ s e Zd ZdZdd� Zdd� ZdS )�"TestFileDescriptorReceiverProtocola A Protocol that implements L{IFileDescriptorReceiver} and records how its C{fileDescriptorReceived} method is called. @ivar receivedDescriptors: A C{list} containing all of the file descriptors passed to C{fileDescriptorReceived} calls made on this instance. c C s t �| � g | _d S r[ )rL rZ �receivedDescriptorsrQ rS rS rT rZ � s z1TestFileDescriptorReceiverProtocol.connectionMadec C s | j �|� d S r[ )rm r\ )rR Z descriptorrS rS rT �fileDescriptorReceived� s z9TestFileDescriptorReceiverProtocol.fileDescriptorReceivedN)rb rc rd re rZ rn rS rS rS rT rl � s rl c @ s e Zd ZdZdd� Zdd� ZdS )�TestHandshakeListenera A Protocol that implements L{IHandshakeListener} and records the number of times its C{handshakeCompleted} method has been called. @ivar handshakeCompletedCalls: The number of times C{handshakeCompleted} @type handshakeCompletedCalls: L{int} c C s t �| � d| _d S rM )rL rU �handshakeCompletedCallsrQ rS rS rT rU � s zTestHandshakeListener.__init__c C s | j d7 _ dS )zk Called when a TLS handshake has completed. Implemented per L{IHandshakeListener} rY N)rp rQ rS rS rT �handshakeCompleted� s z(TestHandshakeListener.handshakeCompletedN)rb rc rd re rU rq rS rS rS rT ro � s ro c @ s e Zd ZdZeZdS )�TestFactoryz� Simple factory to be used both when connecting and listening. It contains two deferreds which are called back when my protocol connects and disconnects. N)rb rc rd re rL r rS rS rS rT rr � s rr c @ s e Zd ZdZdd� ZdS )�NoneFactoryzC A one off factory whose C{buildProtocol} returns L{None}. c C s d S r[ rS �rR �addrrS rS rT � buildProtocol� s zNoneFactory.buildProtocolN�rb rc rd re rv rS rS rS rT rs � s rs c @ s� e Zd ZdZdd� Zdd� Zdd� Zdd � Zd d� Zdd � Z dd� Z dd� Zdd� Zdd� Z dd� Zdd� Zdd� Zdd� Zdd� Zd d!� Zd"d#� Zd$d%� Zd&d'� Zd(d)� Zd*d+� Zd,S )-�WrappingFactoryTestszS Test the behaviour of our ugly implementation detail C{_WrappingFactory}. c C s* t � }t�|�}|�� | �d|j� dS )z� L{_WrappingFactory.doStart} passes through to the wrapped factory's C{doStart} method, allowing application-specific setup and logging. rY N)r'