# Path: px/environments/bidaf.py
# class BidafEnvironment(object):
#   def __init__(self,
#                data_dir,
#                shared_path,
#                model_dir,
#                docid_separator='###',
#                debug_mode=False,
#                load_test=False,
#                load_impossible_questions=False):
#   def _ReadImpossiblities(self, dataset, data_dir):
#   def _WordTokenize(self, text):
#   def _PreprocessQaData(self, questions, document_ids):
#   def IsImpossible(self, document_id):
#   def GetAnswers(self, questions, document_ids):
# 
# Path: px/environments/bidaf_server.py
# FLAGS = flags.FLAGS
# DOCID_SEPARATOR = '###'
# class BidafServer(aqa_pb2_grpc.EnvironmentServerServicer):
#   def __init__(self, *args, **kwargs):
#   def _InitializeEnvironment(self, data_dir, shared_file, model_dir, load_test,
#                              load_impossible_questions, debug_mode):
#   def GetObservations(self, request, context):
# def main(unused_argv):


import collections
import grpc
import mock
import portpicker
import unittest
from absl import logging
from grpc.framework.foundation import logging_pool
from tensorflow.python.util.protobuf import compare
from px.environments import bidaf
from px.environments import bidaf_server
from px.proto import aqa_pb2
from px.proto import aqa_pb2_grpc
  response.processed_question = PROCESSED1

  response = GOOD_RESPONSE.responses.add()
  response.id = DOCID2
  answer = response.answers.add()
  answer.text = ANSWER2
  answer.scores['environment_confidence'] = SCORE2
  answer.scores['f1'] = F1_SCORE2
  response.question = QUESTION2
  response.processed_question = PROCESSED2

  response = DUPLICATE_IDS_RESPONSE.responses.add()
  response.id = DOCID1
  answer = response.answers.add()
  answer.text = ANSWER1
  answer.scores['environment_confidence'] = SCORE1
  answer.scores['f1'] = F1_SCORE1
  response.question = QUESTION1
  response.processed_question = PROCESSED1

  response = DUPLICATE_IDS_RESPONSE.responses.add()
  response.id = DOCID1  # Same docid.
  answer = response.answers.add()
  answer.text = ANSWER2
  answer.scores['environment_confidence'] = SCORE2
  answer.scores['f1'] = F1_SCORE2
  response.question = QUESTION2
  response.processed_question = PROCESSED2



# Path: px/environments/bidaf.py
# class BidafEnvironment(object):
#   def __init__(self,
#                data_dir,
#                shared_path,
#                model_dir,
#                docid_separator='###',
#                debug_mode=False,
#                load_test=False,
#                load_impossible_questions=False):
#   def _ReadImpossiblities(self, dataset, data_dir):
#   def _WordTokenize(self, text):
#   def _PreprocessQaData(self, questions, document_ids):
#   def IsImpossible(self, document_id):
#   def GetAnswers(self, questions, document_ids):
# 
# Path: px/environments/bidaf_server.py
# FLAGS = flags.FLAGS
# DOCID_SEPARATOR = '###'
# class BidafServer(aqa_pb2_grpc.EnvironmentServerServicer):
#   def __init__(self, *args, **kwargs):
#   def _InitializeEnvironment(self, data_dir, shared_file, model_dir, load_test,
#                              load_impossible_questions, debug_mode):
#   def GetObservations(self, request, context):
# def main(unused_argv):


# Path: px/environments/bidaf_server_test.py
import collections
import grpc
import mock
import portpicker
import unittest
from absl import logging
from grpc.framework.foundation import logging_pool
from tensorflow.python.util.protobuf import compare
from px.environments import bidaf
from px.environments import bidaf_server
from px.proto import aqa_pb2
from px.proto import aqa_pb2_grpc

  response.processed_question = PROCESSED1

  response = GOOD_RESPONSE.responses.add()
  response.id = DOCID2
  answer = response.answers.add()
  answer.text = ANSWER2
  answer.scores['environment_confidence'] = SCORE2
  answer.scores['f1'] = F1_SCORE2
  response.question = QUESTION2
  response.processed_question = PROCESSED2

  response = DUPLICATE_IDS_RESPONSE.responses.add()
  response.id = DOCID1
  answer = response.answers.add()
  answer.text = ANSWER1
  answer.scores['environment_confidence'] = SCORE1
  answer.scores['f1'] = F1_SCORE1
  response.question = QUESTION1
  response.processed_question = PROCESSED1

  response = DUPLICATE_IDS_RESPONSE.responses.add()
  response.id = DOCID1  # Same docid.
  answer = response.answers.add()
  answer.text = ANSWER2
  answer.scores['environment_confidence'] = SCORE2
  answer.scores['f1'] = F1_SCORE2
  response.question = QUESTION2
  response.processed_question = PROCESSED2



class MockBidafEnvironment(bidaf.BidafEnvironment):