U
    
W[¹  ã                   @   sJ   d Z ddlmZmZ ddlmZ ddlmZ d
dd„Z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}
é    )Úabsolute_importÚdivision)ÚStreamServerEndpointService)Ú	endpointsNc                 C   s0   |dkrddl m} 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}
    Nr   ©ÚreactorT)Útwisted.internetr   r   r   ZserverFromStringZ_raiseSynchronously)ÚdescriptionÚfactoryr   Zsvc© r   ú>/usr/lib/python3/dist-packages/twisted/application/strports.pyÚservice   s    
 ÿr   c                 C   s2   ddl m} t | |¡\}}}t|d| ƒ||Ž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   Z_parseServerÚgetattr)r	   r
   r   ÚnameÚargsÚkwr   r   r   r   .   s    r   )N)Ú__doc__Z
__future__r   r   Ztwisted.application.internetr   r   r   r   r   Ú__all__r   r   r   r   Ú<module>   s   
