File: //usr/lib/python3/dist-packages/twisted/protocols/haproxy/__pycache__/_parser.cpython-310.pyc
o
�bi � @ s� d Z ddlmZmZ ddlmZ ddlmZ ddlm Z m
Z
mZmZ ddl
mZ ddlmZ d eed
f deeef defd
d�Zeee �G dd� d��ZdS )z(
Parser for 'haproxy:' string endpoint.
� )�Mapping�Tuple)�implementer)�
interfaces)�!IStreamServerEndpointStringParser�_WrapperServerEndpoint�quoteStringArgument�serverFromString)�IPlugin� )�
proxyEndpoint�args.�kwargs�returnc C s. d� dd� | D �tdd� |�� 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|���qS � )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 � tt|��tt|���V qdS )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 Zd ZdZdZdejdededefdd�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"