

'''simple docstring'''





from typing import List, Optional, TypeVar

from .arrow_dataset import Dataset, _concatenate_map_style_datasets, _interleave_map_style_datasets
from .dataset_dict import DatasetDict, IterableDatasetDict
from .info import DatasetInfo
from .iterable_dataset import IterableDataset, _concatenate_iterable_datasets, _interleave_iterable_datasets
from .splits import NamedSplit
from .utils import logging
from .utils.py_utils import Literal


UpperCamelCase_    						=       logging.get_logger(__name__)


UpperCamelCase_    						=       TypeVar("""DatasetType""", Dataset, IterableDataset)






def 				_lowerCAmelCase			(   __magic_name__						:     List[DatasetType]   , __magic_name__						:     Optional[List[float]] = None   , __magic_name__						:     Optional[int] = None   , __magic_name__						:     Optional[DatasetInfo] = None   , __magic_name__						:     Optional[NamedSplit] = None   , __magic_name__						:     Literal["first_exhausted", "all_exhausted"] = "first_exhausted"   , )				->  DatasetType:
						from .arrow_dataset import Dataset
						from .iterable_dataset import IterableDataset

						if not datasets:
												raise ValueError('''Unable to interleave an empty list of datasets.'''						)
						for i, dataset in enumerate(__magic_name__						):
												if not isinstance(__magic_name__   , (Dataset, IterableDataset)						):
																		if isinstance(__magic_name__   , (DatasetDict, IterableDatasetDict)						):
																								if not dataset:
																														raise ValueError(
																														    f'''Expected a list of Dataset objects or a list of IterableDataset objects, but element at position {i} '''
																														    '''is an empty dataset dictionary.'''						)
																								raise ValueError(
																								    f'''Dataset at position {i} has at least one split: {list(__magic_name__						)}\n'''
																								    f'''Please pick one to interleave with the other datasets, for example: dataset[\'{next(iter(__magic_name__						)						)}\']'''						)
																		raise ValueError(
																		    f'''Expected a list of Dataset objects or a list of IterableDataset objects, but element at position {i} is a {type(__magic_name__						).__name__}.'''						)
												if i == 0:
																		lowercase		,	lowercase :							str    		=(
																		    (Dataset, IterableDataset) if isinstance(__magic_name__   , __magic_name__						) else (IterableDataset, Dataset)
																		)
												elif not isinstance(__magic_name__   , __magic_name__						):
																		raise ValueError(
																		    f'''Unable to interleave a {dataset_type.__name__} (at position 0) with a {other_type.__name__} (at position {i}). Expected a list of Dataset objects or a list of IterableDataset objects.'''						)
						if stopping_strategy not in ["first_exhausted", "all_exhausted"]:
												raise ValueError(f'''{stopping_strategy} is not supported. Please enter a valid stopping_strategy.'''						)
						if dataset_type is Dataset:
												return _interleave_map_style_datasets(
												    __magic_name__   , __magic_name__   , __magic_name__   , info=__magic_name__   , split=__magic_name__   , stopping_strategy=__magic_name__						)
						else:
												return _interleave_iterable_datasets(
												    __magic_name__   , __magic_name__   , __magic_name__   , info=__magic_name__   , split=__magic_name__   , stopping_strategy=__magic_name__						)







def 				_lowerCAmelCase			(   __magic_name__						:     List[DatasetType]   , __magic_name__						:     Optional[DatasetInfo] = None   , __magic_name__						:     Optional[NamedSplit] = None   , __magic_name__						:     int = 0   , )				->  DatasetType:

						if not dsets:
												raise ValueError('''Unable to concatenate an empty list of datasets.'''						)
						for i, dataset in enumerate(__magic_name__						):
												if not isinstance(__magic_name__   , (Dataset, IterableDataset)						):
																		if isinstance(__magic_name__   , (DatasetDict, IterableDatasetDict)						):
																								if not dataset:
																														raise ValueError(
																														    f'''Expected a list of Dataset objects or a list of IterableDataset objects, but element at position {i} '''
																														    '''is an empty dataset dictionary.'''						)
																								raise ValueError(
																								    f'''Dataset at position {i} has at least one split: {list(__magic_name__						)}\n'''
																								    f'''Please pick one to interleave with the other datasets, for example: dataset[\'{next(iter(__magic_name__						)						)}\']'''						)
																		raise ValueError(
																		    f'''Expected a list of Dataset objects or a list of IterableDataset objects, but element at position {i} is a {type(__magic_name__						).__name__}.'''						)
												if i == 0:
																		lowercase		,	lowercase :							Optional[int]    		=(
																		    (Dataset, IterableDataset) if isinstance(__magic_name__   , __magic_name__						) else (IterableDataset, Dataset)
																		)
												elif not isinstance(__magic_name__   , __magic_name__						):
																		raise ValueError(
																		    f'''Unable to interleave a {dataset_type.__name__} (at position 0) with a {other_type.__name__} (at position {i}). Expected a list of Dataset objects or a list of IterableDataset objects.'''						)
						if dataset_type is Dataset:
												return _concatenate_map_style_datasets(__magic_name__   , info=__magic_name__   , split=__magic_name__   , axis=__magic_name__						)
						else:
												return _concatenate_iterable_datasets(__magic_name__   , info=__magic_name__   , split=__magic_name__   , axis=__magic_name__						)











def    UpperCAmelCase_				( __UpperCAmelCase		:      int				)   ->					int:
      assert isinstance(__UpperCAmelCase     ,     __UpperCAmelCase				), f"The input value of [n={number}] is not an integer"

      if number == 1:
            return 2
      elif number < 1:
            SCREAMING_SNAKE_CASE_      		=     f"The input value of [n={number}] has to be > 0"
            raise ValueError(__UpperCAmelCase				)
      else:
            SCREAMING_SNAKE_CASE_      		=     sylvester(number - 1				)
            SCREAMING_SNAKE_CASE_      		=     num - 1
            SCREAMING_SNAKE_CASE_      		=     num
            return lower * upper + 1


if __name__ == "__main__":
   print(f'''The 8th number in Sylvester\'s sequence: {sylvester(8)}''')