

from typing import TypeVar

from .arrow_dataset import Dataset, _split_by_node_map_style_dataset
from .iterable_dataset import IterableDataset, _split_by_node_iterable_dataset


_UpperCamelCase     =    TypeVar('''DatasetType''', Dataset, IterableDataset)
def 		UpperCamelCase_(    snake_case__:						DatasetType						,					snake_case__:						int						,					snake_case__:						int     ) ->				DatasetType:
 if isinstance(snake_case__						,					snake_case__     ):
  return _split_by_node_map_style_dataset(snake_case__						,					rank=snake_case__						,					world_size=snake_case__     )
 else:
  return _split_by_node_iterable_dataset(snake_case__						,					rank=snake_case__						,					world_size=snake_case__     )






def 		UpperCamelCase_(    snake_case__:						int     ) ->				int:
 if not isinstance(snake_case__						,					snake_case__     ):
  UpperCAmelCase__           =       f"Input value of [number={number}] must be an integer"
  raise TypeError(snake_case__     )
 if number < 1:
  raise ValueError('Input must be a positive integer'     )
 return number * (2 * number - 1)


if __name__ == "__main__":
 import doctest

 doctest.testmod()



