<s> from . base import MarathonObject <EOL> class MarathonEndpoint ( MarathonObject ) : <EOL> """<STR_LIT>""" <EOL> def __repr__ ( self ) : <EOL> return "<STR_LIT>" . format ( <EOL> clazz = self . __class__ . __name__ , <EOL> app_id = self . app_id , <EOL> service_port = self . service_port , <EOL> task_id = self . task_id , <EOL> task_port = self . task_port <EOL> ) <EOL> def __init__ ( self , app_id = None , service_port = None , <EOL> host = None , task_id = None , task_port = None ) : <EOL> self . app_id = app_id <EOL> self . service_port = service_port <EOL> self . host = host <EOL> self . task_id = task_id <EOL> self . task_port = task_port <EOL> @ classmethod <EOL> def from_tasks ( cls , tasks ) : <EOL> """<STR_LIT>""" <EOL> endpoints = [ <EOL> [ <EOL> MarathonEndpoint ( task . app_id , task . service_ports [ <EOL> port_index ] , task . host , task . id , port ) <EOL> for port_index , port in enumerate ( task . ports ) <EOL> ] <EOL> for task in tasks <EOL> ] <EOL> return [ item for sublist in endpoints for item in sublist ] </s>
