o
    bi                     @   s   d Z ddlmZmZ ddlmZ ddlmZ ddlm	Z	m
Z
mZmZ ddlmZ ddlmZ d	eed
f deeef defddZeee	G dd dZdS )z(
Parser for 'haproxy:' string endpoint.
    )MappingTuple)implementer)
interfaces)!IStreamServerEndpointStringParser_WrapperServerEndpointquoteStringArgumentserverFromString)IPlugin   )proxyEndpointargs.kwargsreturnc                 C   s.   d dd | D tdd | D  }|S )a  
    Un-parse the already-parsed args and kwargs back into endpoint syntax.

    @param args: C{:}-separated arguments

    @param kwargs: C{:} and then C{=}-separated keyword arguments

    @return: a string equivalent to the original format which this was parsed
        as.
    :c                 S   s   g | ]}t t|qS  )r   str).0argr   r   C/usr/lib/python3/dist-packages/twisted/protocols/haproxy/_parser.py
<listcomp>$   s    z#unparseEndpoint.<locals>.<listcomp>c                 s   s0    | ]\}}d  tt|tt|V  qdS )z{}={}N)formatr   r   )r   keyvaluer   r   r   	<genexpr>%   s    
z"unparseEndpoint.<locals>.<genexpr>)joinsorteditems)r   r   descriptionr   r   r   unparseEndpoint   s   	r   c                   @   s0   e Zd ZdZdZdejdededefddZ	d	S )
HAProxyServerParserz
    Stream server endpoint string parser for the HAProxyServerEndpoint type.

    @ivar prefix: See L{IStreamServerEndpointStringParser.prefix}.
    haproxyreactorr   r   r   c                 O   s   t ||}t||}t|S )a[  
        Parse a stream server endpoint from a reactor and string-only arguments
        and keyword arguments.

        @param reactor: The reactor.

        @param args: The parsed string arguments.

        @param kwargs: The parsed keyword arguments.

        @return: a stream server endpoint
        @rtype: L{IStreamServerEndpoint}
        )r   r	   r   )selfr"   r   r   subdescriptionwrappedEndpointr   r   r   parseStreamServer9   s   

z%HAProxyServerParser.parseStreamServerN)
__name__
__module____qualname____doc__prefixr   IReactorCoreobjectr   r&   r   r   r   r   r    /   s    r    N)r*   typingr   r   zope.interfacer   twisted.internetr   twisted.internet.endpointsr   r   r   r	   twisted.pluginr
    r   r-   r   r   r    r   r   r   r   <module>   s   &