o
    ¯b!
  ã                	   @   sŒ   d Z ddlmZmZ ddlmZ ddlmZmZ dej	fdd„Z
	dd	ed
ejdeej	 defdd„Zd	ed
ejdejfdd„ZddgZdS )z°
Construct listening port services from a simple string description.

@see: L{twisted.internet.endpoints.serverFromString}
@see: L{twisted.internet.endpoints.clientFromString}
é    )ÚOptionalÚcast)ÚStreamServerEndpointService)Ú	endpointsÚ
interfacesÚreturnc                  C   s   ddl m}  ttj| ƒS )Nr   ©Úreactor)Útwisted.internetr	   r   r   ÚIReactorCorer   © r   ú>/usr/lib/python3/dist-packages/twisted/application/strports.pyÚ_getReactor   s   r   NÚdescriptionÚfactoryr	   c                 C   s*   |du rt ƒ }tt || ¡|ƒ}d|_|S )aj  
    Return the service corresponding to a description.

    @param description: The description of the listening port, in the syntax
        described by L{twisted.internet.endpoints.serverFromString}.
    @type description: C{str}

    @param factory: The protocol factory which will build protocols for
        connections to this service.
    @type factory: L{twisted.internet.interfaces.IProtocolFactory}

    @rtype: C{twisted.application.service.IService}
    @return: the service corresponding to a description of a reliable stream
        server.

    @see: L{twisted.internet.endpoints.serverFromString}
    NT)r   r   r   ÚserverFromStringÚ_raiseSynchronously)r   r   r	   Úsvcr   r   r   Úservice   s   ÿr   c                 C   s>   ddl m} t | |¡\}}}ttjt|d| ƒ|i |¤ŽƒS )ac  
    Listen on a port corresponding to a description.

    @param description: The description of the connecting port, in the syntax
        described by L{twisted.internet.endpoints.serverFromString}.
    @type description: L{str}

    @param factory: The protocol factory which will build protocols on
        connection.
    @type factory: L{twisted.internet.interfaces.IProtocolFactory}

    @rtype: L{twisted.internet.interfaces.IListeningPort}
    @return: the port corresponding to a description of a reliable virtual
        circuit server.

    @see: L{twisted.internet.endpoints.serverFromString}
    r   r   Úlisten)r
   r	   r   Ú_parseServerr   r   ÚIListeningPortÚgetattr)r   r   r	   ÚnameÚargsÚkwr   r   r   r   7   s
   ÿr   )N)Ú__doc__Útypingr   r   Útwisted.application.internetr   r
   r   r   r   r   ÚstrÚIProtocolFactoryr   r   r   Ú__all__r   r   r   r   Ú<module>   s.   	ýÿþý
ü ÿÿ
þ