


"""simple docstring"""


import operator



def   snake_case						(				_a:     list		,   _a:     bool = False		,   _a:     list | None = None							)->		list:
      '''simple docstring'''


      lowerCamelCase__           =		operator.lt if reverse else operator.gt
      lowerCamelCase__           =		solution or []

      if not arr:
            return solution

      lowerCamelCase__           =		[arr.pop(0							)]
      for i, item in enumerate(_a							):
            if _operator(_a		,   sublist[-1]							):
                  sublist.append(_a							)
                  arr.pop(_a							)

    #  merging sublist into solution list
      if not solution:
            solution.extend(_a							)
      else:
            while sublist:
                  lowerCamelCase__           =		sublist.pop(0							)
                  for i, xx in enumerate(_a							):
                        if not _operator(_a		,   _a							):
                              solution.insert(_a		,   _a							)
                              break
                  else:
                        solution.append(_a							)

      strand_sort(_a		,   _a		,   _a							)
      return solution


if __name__ == "__main__":
   assert strand_sort([4, 3, 5, 1, 2]) == [1, 2, 3, 4, 5]
   assert strand_sort([4, 3, 5, 1, 2], reverse=True) == [5, 4, 3, 2, 1]







"""simple docstring"""


import argparse
import json

from tqdm import tqdm



def   snake_case						(				)->		List[Any]:
      '''simple docstring'''


      lowerCamelCase__           =		argparse.ArgumentParser()

      # Required parameters
      parser.add_argument(
          '--src_path'		,   type=_a		,   default='biencoder-nq-dev.json'		,   help='Path to raw DPR training data'		,   )
      parser.add_argument(
          '--evaluation_set'		,   type=_a		,   help='where to store parsed evaluation_set file'		,   )
      parser.add_argument(
          '--gold_data_path'		,   type=_a		,   help='where to store parsed gold_data_path file'		,   )
      lowerCamelCase__           =		parser.parse_args()

      with open(args.src_path		,   'r'							) as src_file, open(args.evaluation_set		,   'w'							) as eval_file, open(
          args.gold_data_path		,   'w'							) as gold_file:
            lowerCamelCase__           =		json.load(_a							)
            for dpr_record in tqdm(_a							):
                  lowerCamelCase__           =		dpr_record['question']
                  lowerCamelCase__           =		[context['title'] for context in dpr_record['positive_ctxs']]
                  eval_file.write(question + '\n'							)
                  gold_file.write('\t'.join(_a							) + '\n'							)


if __name__ == "__main__":
   main()



