

'''simple docstring'''

# Algorithm for the pigeonhole sorting






def 				UpperCamelCase(					UpperCAmelCase_     ):
 UpperCAmelCase	:     Optional[int]						 =			min(UpperCAmelCase_     )  # min() finds the minimum value
 UpperCAmelCase	:     int						 =			max(UpperCAmelCase_     )  # max() finds the maximum value

 UpperCAmelCase	:     int						 =			max_val - min_val + 1  # size is difference of max and min values plus one

 # list of pigeonholes of size equal to the variable size
 UpperCAmelCase	:     Optional[Any]						 =			[0] * size

 # Populate the pigeonholes.
 for x in a:
  assert isinstance(UpperCAmelCase_  ,	UpperCAmelCase_     ), "integers only please"
  holes[x - min_val] += 1

 # Putting the elements back into the array in an order.
 UpperCAmelCase	:     List[str]						 =			0
 for count in range(UpperCAmelCase_     ):
  while holes[count] > 0:
   holes[count] -= 1
   UpperCAmelCase	:     Union[str, Any]						 =			count + min_val
   i += 1




def 				UpperCamelCase(					):
 UpperCAmelCase	:     Any						 =			[8, 3, 2, 7, 4, 6, 8]
 pigeonhole_sort(UpperCAmelCase_     )
 print('Sorted order is:'  ,	' '.join(UpperCAmelCase_     )     )


if __name__ == "__main__":
 main()







'''simple docstring'''

import argparse
import json

from tqdm import tqdm




def 				UpperCamelCase(					):
 UpperCAmelCase	:     List[Any]						 =			argparse.ArgumentParser()

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


if __name__ == "__main__":
 main()




