<s> """<STR_LIT>""" <EOL> __author__ = '<STR_LIT>' <EOL> from django . forms . models import model_to_dict <EOL> from services . configuration . jrpc . serializers import channels as channel_serializers <EOL> from services . configuration . jrpc . serializers import segments as segment_serializers <EOL> GS_OBJECT_K = '<STR_LIT>' <EOL> GS_CHANNEL_OBJECT_K = '<STR_LIT>' <EOL> SC_CHANNEL_OBJECT_K = '<STR_LIT>' <EOL> COMPATIBILITY_OBJECT_K = '<STR_LIT>' <EOL> def serialize_gs_ch_compatibility_tuples ( gs_ch_list ) : <EOL> """<STR_LIT>""" <EOL> result = [ ] <EOL> for t in gs_ch_list : <EOL> result . append ( { <EOL> GS_OBJECT_K : model_to_dict ( t [ <NUM_LIT:0> ] , fields = [ '<STR_LIT>' ] ) , <EOL> GS_CHANNEL_OBJECT_K : channel_serializers . serialize_gs_channel ( t [ <NUM_LIT:1> ] ) <EOL> } ) <EOL> return result <EOL> def serialize_sc_ch_compatibility ( spacecraft_ch , compatibility ) : <EOL> """<STR_LIT>""" <EOL> return { <EOL> SC_CHANNEL_OBJECT_K : channel_serializers . serialize_sc_channel ( <EOL> spacecraft_ch <EOL> ) , <EOL> COMPATIBILITY_OBJECT_K : compatibility <EOL> } <EOL> def serialize_sc_compatibility ( spacecraft , compatibility ) : <EOL> """<STR_LIT>""" <EOL> return { <EOL> segment_serializers . SC_ID_K : spacecraft . identifier , <EOL> COMPATIBILITY_OBJECT_K : compatibility <EOL> } <EOL> def serialize_segment_compatibility ( compatibility ) : <EOL> """<STR_LIT>""" <EOL> results = [ ] <EOL> for c in compatibility : <EOL> results . append ( { <EOL> SC_CHANNEL_OBJECT_K : channel_serializers . serialize_sc_channel ( <EOL> c . spacecraft_channel <EOL> ) , <EOL> GS_CHANNEL_OBJECT_K : channel_serializers . serialize_gs_channel ( <EOL> c . groundstation_channel <EOL> ) <EOL> } ) <EOL> return results </s>
