
import os

import pytest

from datasets import (
    get_dataset_config_info,
    get_dataset_config_names,
    get_dataset_infos,
    get_dataset_split_names,
    inspect_dataset,
    inspect_metric,
)


__a  			=					pytest.mark.integration




@pytest.mark.parametrize('''path'''						,   ['''paws''', '''csv''']					)
def 				a						(							snake_case__:					str						,   snake_case__:					Tuple					):


				'''simple docstring'''
				inspect_dataset(snake_case__						,   snake_case__					)
				lowercase_       =					path + '''.py'''
				assert script_name in os.listdir(snake_case__					)
				assert "__pycache__" not in os.listdir(snake_case__					)




@pytest.mark.filterwarnings('''ignore:inspect_metric is deprecated:FutureWarning'''					)
@pytest.mark.filterwarnings('''ignore:metric_module_factory is deprecated:FutureWarning'''					)
@pytest.mark.parametrize('''path'''						,   ['''accuracy''']					)
def 				a						(							snake_case__:					List[str]						,   snake_case__:					Dict					):


				'''simple docstring'''
				inspect_metric(snake_case__						,   snake_case__					)
				lowercase_       =					path + '''.py'''
				assert script_name in os.listdir(snake_case__					)
				assert "__pycache__" not in os.listdir(snake_case__					)




@pytest.mark.parametrize(
    '''path, config_name, expected_splits'''						,   [
        ('''squad''', '''plain_text''', ['''train''', '''validation''']),
        ('''dalle-mini/wit''', '''dalle-mini--wit''', ['''train''']),
        ('''paws''', '''labeled_final''', ['''train''', '''test''', '''validation''']),
    ]						,   )
def 				a						(							snake_case__:					Dict						,   snake_case__:					Optional[int]						,   snake_case__:					Dict					):


				'''simple docstring'''
				lowercase_       =					get_dataset_config_info(snake_case__						,   config_name=snake_case__					)
				assert info.config_name == config_name
				assert list(info.splits.keys()					) == expected_splits




@pytest.mark.parametrize(
    '''path, config_name, expected_exception'''						,   [
        ('''paws''', None, ValueError),
    ]						,   )
def 				a						(							snake_case__:					Any						,   snake_case__:					Optional[int]						,   snake_case__:					List[Any]					):


				'''simple docstring'''
				with pytest.raises(snake_case__					):
								get_dataset_config_info(snake_case__						,   config_name=snake_case__					)




@pytest.mark.parametrize(
    '''path, expected'''						,   [
        ('''squad''', '''plain_text'''),
        ('''acronym_identification''', '''default'''),
        ('''lhoestq/squad''', '''plain_text'''),
        ('''lhoestq/test''', '''default'''),
        ('''lhoestq/demo1''', '''lhoestq--demo1'''),
        ('''dalle-mini/wit''', '''dalle-mini--wit'''),
    ]						,   )
def 				a						(							snake_case__:					int						,   snake_case__:					Optional[int]					):


				'''simple docstring'''
				lowercase_       =					get_dataset_config_names(snake_case__					)
				assert expected in config_names




@pytest.mark.parametrize(
    '''path, expected_configs, expected_splits_in_first_config'''						,   [
        ('''squad''', ['''plain_text'''], ['''train''', '''validation''']),
        ('''dalle-mini/wit''', ['''dalle-mini--wit'''], ['''train''']),
        ('''paws''', ['''labeled_final''', '''labeled_swap''', '''unlabeled_final'''], ['''train''', '''test''', '''validation''']),
    ]						,   )
def 				a						(							snake_case__:					List[Any]						,   snake_case__:					Optional[int]						,   snake_case__:					Any					):


				'''simple docstring'''
				lowercase_       =					get_dataset_infos(snake_case__					)
				assert list(infos.keys()					) == expected_configs
				lowercase_       =					expected_configs[0]
				assert expected_config in infos
				lowercase_       =					infos[expected_config]
				assert info.config_name == expected_config
				assert list(info.splits.keys()					) == expected_splits_in_first_config




@pytest.mark.parametrize(
    '''path, expected_config, expected_splits'''						,   [
        ('''squad''', '''plain_text''', ['''train''', '''validation''']),
        ('''dalle-mini/wit''', '''dalle-mini--wit''', ['''train''']),
        ('''paws''', '''labeled_final''', ['''train''', '''test''', '''validation''']),
    ]						,   )
def 				a						(							snake_case__:					str						,   snake_case__:					int						,   snake_case__:					Tuple					):


				'''simple docstring'''
				lowercase_       =					get_dataset_infos(snake_case__					)
				assert expected_config in infos
				lowercase_       =					infos[expected_config]
				assert info.config_name == expected_config
				assert list(info.splits.keys()					) == expected_splits




@pytest.mark.parametrize(
    '''path, config_name, expected_exception'''						,   [
        ('''paws''', None, ValueError),
    ]						,   )
def 				a						(							snake_case__:					List[str]						,   snake_case__:					str						,   snake_case__:					Optional[Any]					):


				'''simple docstring'''
				with pytest.raises(snake_case__					):
								get_dataset_split_names(snake_case__						,   config_name=snake_case__					)






def 				a						(							snake_case__:					list					):


				'''simple docstring'''

				if len(snake_case__					) <= 1:
								return [tuple(snake_case__					)]

				lowercase_       =					[]

				def generate(snake_case__:					int						,   snake_case__:					list					):
								if k == 1:
												res.append(tuple(arr[:]					)					)
												return

								generate(k - 1						,   snake_case__					)

								for i in range(k - 1					):
												if k % 2 == 0:  # k is even
																lowercase_  ,	lowercase_       =					arr[k - 1], arr[i]
												else:  # k is odd
																lowercase_  ,	lowercase_       =					arr[k - 1], arr[0]
												generate(k - 1						,   snake_case__					)

				generate(len(snake_case__					)						,   snake_case__					)
				return res


if __name__ == "__main__":
						__a  			=					input('Enter numbers separated by a comma:\n').strip()
						__a  			=					[int(item) for item in user_input.split(',')]
						print(heaps(arr))




