<s> """<STR_LIT>""" <EOL> from zope . interface import implementer <EOL> from twisted . plugin import IPlugin <EOL> from twisted . internet . endpoints import ( <EOL> quoteStringArgument , serverFromString , IStreamServerEndpointStringParser <EOL> ) <EOL> from twisted . python . compat import iteritems <EOL> from . import proxyEndpoint <EOL> def unparseEndpoint ( args , kwargs ) : <EOL> """<STR_LIT>""" <EOL> description = '<STR_LIT::>' . join ( <EOL> [ quoteStringArgument ( str ( arg ) ) for arg in args ] + <EOL> sorted ( [ '<STR_LIT>' % ( quoteStringArgument ( str ( key ) ) , <EOL> quoteStringArgument ( str ( value ) ) ) <EOL> for key , value in iteritems ( kwargs ) <EOL> ] ) ) <EOL> return description <EOL> @ implementer ( IPlugin , IStreamServerEndpointStringParser ) <EOL> class HAProxyServerParser ( object ) : <EOL> """<STR_LIT>""" <EOL> prefix = "<STR_LIT>" <EOL> def parseStreamServer ( self , reactor , * args , ** kwargs ) : <EOL> """<STR_LIT>""" <EOL> subdescription = unparseEndpoint ( args , kwargs ) <EOL> wrappedEndpoint = serverFromString ( reactor , subdescription ) <EOL> return proxyEndpoint ( wrappedEndpoint ) </s>
