#NEWLINE# def define_enum_values( type , value_map ) : #NEWLINE# #INDENT# assert ( isinstance ( value_map , collections . Mapping ) and ( len ( value_map ) > 0 ) ) , '{} values must be a mapping (dict / OrderedDict) with value names as keys.' . format ( type ) #NEWLINE# values = [ ] #NEWLINE# if ( not isinstance ( value_map , collections . OrderedDict ) ) : #NEWLINE# #INDENT# value_map = collections . OrderedDict ( sorted ( list ( value_map . items ( ) ) ) ) #NEWLINE# #UNINDENT# for ( value_name , value ) in value_map . items ( ) : #NEWLINE# #INDENT# assert_valid_name ( value_name ) #NEWLINE# assert isinstance ( value , GraphQLEnumValue ) , '{}.{} must be an instance of GraphQLEnumValue, but got: {}' . format ( type , type , value ) #NEWLINE# value = copy . copy ( value ) #NEWLINE# value . name = value_name #NEWLINE# if ( value . value is None ) : #NEWLINE# #INDENT# value . value = value_name #NEWLINE# #UNINDENT# values . append ( value ) #NEWLINE# #UNINDENT# return values