def _get_comment_callback(comment_data, thread_id, parent_id):
 def callback(request, _uri, headers):
  '\n        Simulate the comment creation or update endpoint as described above.\n        '
  response_data = make_minimal_cs_comment(comment_data)
  response_data['thread_id'] = thread_id
  response_data['parent_id'] = parent_id
  for (key, val_list) in request.parsed_body.items():
   val = val_list[0]
   if (key in ['anonymous', 'anonymous_to_peers', 'endorsed']):
    response_data[key] = (val == 'True')
   else:
    response_data[key] = val
  return (200, headers, json.dumps(response_data))
 return callback

def _get_comment_callback ( comment_data , thread_id , parent_id ) : def callback ( request , _uri , headers ) : response_data = make_minimal_cs_comment ( comment_data ) response_data [ 'thread_id' ] = thread_id response_data [ 'parent_id' ] = parent_id for ( key , val_list ) in request . parsed_body . items ( ) : val = val_list [ 0 ] if ( key in [ 'anonymous' , 'anonymous_to_peers' , 'endorsed' ] ) : response_data [ key ] = ( val == 'True' ) else : response_data [ key ] = val return ( 200 , headers , json . dumps ( response_data ) ) return callback
get a callback function that will return a comment containing the given data plus necessary dummy data .