





import argparse
import json

from tqdm import tqdm


def     SCREAMING_SNAKE_CASE			(      ):
       _UpperCamelCase              =						argparse.ArgumentParser()

       # Required parameters
       parser.add_argument(
           '''--src_path'''    ,       type=lowerCAmelCase    ,       default='''biencoder-nq-dev.json'''    ,       help='''Path to raw DPR training data'''    ,       )
       parser.add_argument(
           '''--evaluation_set'''    ,       type=lowerCAmelCase    ,       help='''where to store parsed evaluation_set file'''    ,       )
       parser.add_argument(
           '''--gold_data_path'''    ,       type=lowerCAmelCase    ,       help='''where to store parsed gold_data_path file'''    ,       )
       _UpperCamelCase              =						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:
              _UpperCamelCase              =						json.load(lowerCAmelCase					)
              for dpr_record in tqdm(lowerCAmelCase					):
                     _UpperCamelCase              =						dpr_record['''question''']
                     _UpperCamelCase              =						[context['''title'''] for context in dpr_record['''positive_ctxs''']]
                     eval_file.write(question + '''\n'''					)
                     gold_file.write('''\t'''.join(lowerCAmelCase					) + '''\n'''					)


if __name__ == "__main__":
       main()













def     SCREAMING_SNAKE_CASE			(      lowerCAmelCase					):
       _UpperCamelCase              =						[]
       if len(lowerCAmelCase					) == 1:
              return [nums.copy()]
       for _ in range(len(lowerCAmelCase					)					):
              _UpperCamelCase              =						nums.pop(0					)
              _UpperCamelCase              =						permute(lowerCAmelCase					)
              for perm in permutations:
                     perm.append(lowerCAmelCase					)
              result.extend(lowerCAmelCase					)
              nums.append(lowerCAmelCase					)
       return result


def     SCREAMING_SNAKE_CASE			(      lowerCAmelCase					):

       def backtrack(lowerCAmelCase					):
              if start == len(lowerCAmelCase					) - 1:
                     output.append(nums[:]					)
              else:
                     for i in range(lowerCAmelCase    ,       len(lowerCAmelCase					)					):
                            _UpperCamelCase       ,		_UpperCamelCase              =						nums[i], nums[start]
                            backtrack(start + 1					)
                            _UpperCamelCase       ,		_UpperCamelCase              =						nums[i], nums[start]  # backtrack

       _UpperCamelCase              =						[]
       backtrack(0					)
       return output


if __name__ == "__main__":
       import doctest

       # use res to print the data in permute2 function
       lowercase    : Optional[Any]    	=  permutea([1, 2, 3])
       print(res)
       doctest.testmod()






