
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


lowerCamelCase__     :		List[Any]        = logging.get_logger(__name__)


lowerCamelCase__     :		Union[str, Any]        = TypeVar("""DatasetType""", Dataset, IterableDataset)

def 		UpperCamelCase						(   lowercase_			,			lowercase_ = None			,			lowercase_ = None			,			lowercase_ = None			,			lowercase_ = None			,			lowercase_ = "first_exhausted"			,			)		->						Dict:


  '''simple docstring'''






  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(SCREAMING_SNAKE_CASE__ ):
    if not isinstance(SCREAMING_SNAKE_CASE__			,			(Dataset, IterableDataset) ):
      if isinstance(SCREAMING_SNAKE_CASE__			,			(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(SCREAMING_SNAKE_CASE__ )}\n'
            F'Please pick one to interleave with the other datasets, for example: dataset[\'{next(iter(SCREAMING_SNAKE_CASE__ ) )}\']' )
      raise ValueError(
          F'Expected a list of Dataset objects or a list of IterableDataset objects, but element at position {i} is a {type(SCREAMING_SNAKE_CASE__ ).__name__}.' )
    if i == 0:
      lowercase__	: Dict     		=   (
          (Dataset, IterableDataset) if isinstance(SCREAMING_SNAKE_CASE__			,			SCREAMING_SNAKE_CASE__ ) else (IterableDataset, Dataset)
      )
    elif not isinstance(SCREAMING_SNAKE_CASE__			,			SCREAMING_SNAKE_CASE__ ):
      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(
        SCREAMING_SNAKE_CASE__			,			SCREAMING_SNAKE_CASE__			,			SCREAMING_SNAKE_CASE__			,			info=SCREAMING_SNAKE_CASE__			,			split=SCREAMING_SNAKE_CASE__			,			stopping_strategy=SCREAMING_SNAKE_CASE__ )
  else:
    return _interleave_iterable_datasets(
        SCREAMING_SNAKE_CASE__			,			SCREAMING_SNAKE_CASE__			,			SCREAMING_SNAKE_CASE__			,			info=SCREAMING_SNAKE_CASE__			,			split=SCREAMING_SNAKE_CASE__			,			stopping_strategy=SCREAMING_SNAKE_CASE__ )



def 		UpperCamelCase						(   lowercase_			,			lowercase_ = None			,			lowercase_ = None			,			lowercase_ = 0			,			)		->						Any:


  '''simple docstring'''






  if not dsets:
    raise ValueError("""Unable to concatenate an empty list of datasets.""" )
  for i, dataset in enumerate(SCREAMING_SNAKE_CASE__ ):
    if not isinstance(SCREAMING_SNAKE_CASE__			,			(Dataset, IterableDataset) ):
      if isinstance(SCREAMING_SNAKE_CASE__			,			(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(SCREAMING_SNAKE_CASE__ )}\n'
            F'Please pick one to interleave with the other datasets, for example: dataset[\'{next(iter(SCREAMING_SNAKE_CASE__ ) )}\']' )
      raise ValueError(
          F'Expected a list of Dataset objects or a list of IterableDataset objects, but element at position {i} is a {type(SCREAMING_SNAKE_CASE__ ).__name__}.' )
    if i == 0:
      lowercase__	: Any     		=   (
          (Dataset, IterableDataset) if isinstance(SCREAMING_SNAKE_CASE__			,			SCREAMING_SNAKE_CASE__ ) else (IterableDataset, Dataset)
      )
    elif not isinstance(SCREAMING_SNAKE_CASE__			,			SCREAMING_SNAKE_CASE__ ):
      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(SCREAMING_SNAKE_CASE__			,			info=SCREAMING_SNAKE_CASE__			,			split=SCREAMING_SNAKE_CASE__			,			axis=SCREAMING_SNAKE_CASE__ )
  else:
    return _concatenate_iterable_datasets(SCREAMING_SNAKE_CASE__			,			info=SCREAMING_SNAKE_CASE__			,			split=SCREAMING_SNAKE_CASE__			,			axis=SCREAMING_SNAKE_CASE__ )










'''simple docstring'''


def      snake_case_  (    SCREAMING_SNAKE_CASE__				, SCREAMING_SNAKE_CASE__	):







				"""simple docstring"""





				if b == 0:
								return 1
				if (b % 2) == 0:
								return actual_power(SCREAMING_SNAKE_CASE__				, int(b / 2	)	) * actual_power(SCREAMING_SNAKE_CASE__				, int(b / 2	)	)
				else:
								return a * actual_power(SCREAMING_SNAKE_CASE__				, int(b / 2	)	) * actual_power(SCREAMING_SNAKE_CASE__				, int(b / 2	)	)







def      snake_case_  (    SCREAMING_SNAKE_CASE__				, SCREAMING_SNAKE_CASE__	):







				"""simple docstring"""





				if b < 0:
								return 1 / actual_power(SCREAMING_SNAKE_CASE__				, SCREAMING_SNAKE_CASE__	)
				return actual_power(SCREAMING_SNAKE_CASE__				, SCREAMING_SNAKE_CASE__	)


if __name__ == "__main__":
				print(power(-2, -3))




