
from __future__ import annotations



def 	UpperCamelCase   (							lowerCAmelCase__			,      lowerCAmelCase__		):
					'''simple docstring'''
					lowercase						     =						[]
					create_all_state(1			,      lowerCAmelCase__			,      lowerCAmelCase__			,      []			,      lowerCAmelCase__		)
					return result



def 	UpperCamelCase   (							lowerCAmelCase__			,      lowerCAmelCase__			,      lowerCAmelCase__			,      lowerCAmelCase__			,      lowerCAmelCase__			,      ):
					'''simple docstring'''
					if level == 0:
										total_list.append(current_list[:]		)
										return

					for i in range(lowerCAmelCase__			,      total_number - level + 2		):
										current_list.append(lowerCAmelCase__		)
										create_all_state(i + 1			,      lowerCAmelCase__			,      level - 1			,      lowerCAmelCase__			,      lowerCAmelCase__		)
										current_list.pop()



def 	UpperCamelCase   (							lowerCAmelCase__		):
					'''simple docstring'''
					for i in total_list:
										print(*lowerCAmelCase__		)


if __name__ == "__main__":
							lowercase__			  =   4
							lowercase__			  =   2
							lowercase__			  =   generate_all_combinations(n, k)
							print_all_state(total_list)






from pathlib import Path

import fire
from tqdm import tqdm



def 	UpperCamelCase   (							lowerCAmelCase__="ro"			,      lowerCAmelCase__="en"			,      lowerCAmelCase__="wmt16"			,      lowerCAmelCase__=None		):
					'''simple docstring'''
					try:
										import datasets
					except (ModuleNotFoundError, ImportError):
										raise ImportError('''run pip install datasets'''		)
					lowercase						     =						f'{src_lang}-{tgt_lang}'
					print(f'Converting {dataset}-{pair}'		)
					lowercase						     =						datasets.load_dataset(lowerCAmelCase__			,      lowerCAmelCase__		)
					if save_dir is None:
										lowercase						     =						f'{dataset}-{pair}'
					lowercase						     =						Path(lowerCAmelCase__		)
					save_dir.mkdir(exist_ok=lowerCAmelCase__		)

					for split in ds.keys():
										print(f'Splitting {split} with {ds[split].num_rows} records'		)

										# to save to val.source, val.target like summary datasets
										lowercase						     =						'''val''' if split == '''validation''' else split
										lowercase						     =						save_dir.joinpath(f'{fn}.source'		)
										lowercase						     =						save_dir.joinpath(f'{fn}.target'		)
										lowercase						     =						src_path.open('''w+'''		)
										lowercase						     =						tgt_path.open('''w+'''		)

										# reader is the bottleneck so writing one record at a time doesn't slow things down
										for x in tqdm(ds[split]		):
															lowercase						     =						x['''translation''']
															src_fp.write(ex[src_lang] + '''\n'''		)
															tgt_fp.write(ex[tgt_lang] + '''\n'''		)

					print(f'Saved {dataset} dataset to {save_dir}'		)


if __name__ == "__main__":
							fire.Fire(download_wmt_dataset)




