





class 					UpperCamelCase_    :




							class 					UpperCamelCase_    :
														lowerCamelCase_          =   "_prev", "_data", "_next"


														def __init__(							self      :Optional[Any]							,			__A      :Optional[Any]							,			__A      :Any							,			__A      :Any						)				->				Dict:



																"""simple docstring"""



																SCREAMING_SNAKE_CASE__								= link_p
																SCREAMING_SNAKE_CASE__								= element
																SCREAMING_SNAKE_CASE__								= link_n


														def        _snake_case					(							self      :List[Any]						)				->				Union[str, Any]:



																"""simple docstring"""



																return (
																    f''' Prev -> {self._prev is not None}, Next -> {self._next is not None}'''
																)



							def __init__(							self      :Tuple						)				->				Optional[int]:



									"""simple docstring"""



									SCREAMING_SNAKE_CASE__								= self._Node(__A							,			__A							,			__A						)
									SCREAMING_SNAKE_CASE__								= self._Node(__A							,			__A							,			__A						)
									SCREAMING_SNAKE_CASE__								= self._trailer
									SCREAMING_SNAKE_CASE__								= self._header
									SCREAMING_SNAKE_CASE__								= 0


							def __len__(							self      :Tuple						)				->				Any:



									"""simple docstring"""



									return self._size


							def        _snake_case					(							self      :Union[str, Any]						)				->				Union[str, Any]:



									"""simple docstring"""



									return self.__len__() == 0


							def        _snake_case					(							self      :Union[str, Any]							,			__A      :Union[str, Any]							,			__A      :Optional[Any]							,			__A      :Any						)				->				Optional[int]:



									"""simple docstring"""



									SCREAMING_SNAKE_CASE__								= self._Node(__A							,			__A							,			__A						)
									SCREAMING_SNAKE_CASE__								= new_node
									SCREAMING_SNAKE_CASE__								= new_node
									self._size += 1
									return self


							def        _snake_case					(							self      :List[Any]							,			__A      :Tuple						)				->				str:



									"""simple docstring"""



									SCREAMING_SNAKE_CASE__								= node._prev
									SCREAMING_SNAKE_CASE__								= node._next

									SCREAMING_SNAKE_CASE__								= successor
									SCREAMING_SNAKE_CASE__								= predecessor
									self._size -= 1
									SCREAMING_SNAKE_CASE__								= node._data
									SCREAMING_SNAKE_CASE__								= SCREAMING_SNAKE_CASE__								= SCREAMING_SNAKE_CASE__								= None
									del node
									return temp




class 					UpperCamelCase_    (       _DoublyLinkedBase      ):


							def        _snake_case					(							self      :Optional[int]						)				->				int:



									"""simple docstring"""



									if self.is_empty():
											raise Exception("""List is empty"""						)
									return self._header._next._data


							def        _snake_case					(							self      :str						)				->				Tuple:



									"""simple docstring"""



									if self.is_empty():
											raise Exception("""List is empty"""						)
									return self._trailer._prev._data


							def        _snake_case					(							self      :List[str]							,			__A      :List[Any]						)				->				Optional[Any]:



									"""simple docstring"""



									return self._insert(self._header							,			__A							,			self._header._next						)


							def        _snake_case					(							self      :int							,			__A      :Optional[int]						)				->				Any:



									"""simple docstring"""



									return self._insert(self._trailer._prev							,			__A							,			self._trailer						)


							def        _snake_case					(							self      :Dict						)				->				Optional[Any]:



									"""simple docstring"""



									if self.is_empty():
											raise IndexError("""remove_first from empty list"""						)
									return self._delete(self._header._next						)


							def        _snake_case					(							self      :Union[str, Any]						)				->				Union[str, Any]:



									"""simple docstring"""



									if self.is_empty():
											raise IndexError("""remove_first from empty list"""						)
									return self._delete(self._trailer._prev						)






import json
import os
import tempfile

import datasets
from utils import generate_example_dataset, get_duration


_lowerCamelCase							=     500000

_lowerCamelCase			,    _lowerCamelCase							=     os.path.split(__file__)
_lowerCamelCase							=     os.path.join(RESULTS_BASEPATH, 'results', RESULTS_FILENAME.replace('.py', '.json'))






@get_duration
def 			SCREAMING_SNAKE_CASE__							(    UpperCamelCase__:							datasets.Dataset      ):
		SCREAMING_SNAKE_CASE__								= dataset.select(range(0   ,				len(UpperCamelCase__      )   ,				2      )      )






@get_duration
def 			SCREAMING_SNAKE_CASE__							(    UpperCamelCase__:							datasets.Dataset      ):
		SCREAMING_SNAKE_CASE__								= dataset.sort("""numbers"""      )






@get_duration
def 			SCREAMING_SNAKE_CASE__							(    UpperCamelCase__:							datasets.Dataset      ):
		SCREAMING_SNAKE_CASE__								= dataset.shuffle()






@get_duration
def 			SCREAMING_SNAKE_CASE__							(    UpperCamelCase__:							datasets.Dataset      ):
		SCREAMING_SNAKE_CASE__								= dataset.train_test_split(0.1      )






@get_duration
def 			SCREAMING_SNAKE_CASE__							(    UpperCamelCase__:							datasets.Dataset   ,				UpperCamelCase__:							Tuple=10      ):
		for shard_id in range(UpperCamelCase__      ):
				SCREAMING_SNAKE_CASE__								= dataset.shard(UpperCamelCase__   ,				UpperCamelCase__      )






def 			SCREAMING_SNAKE_CASE__							(    ):
		SCREAMING_SNAKE_CASE__								= {"""num examples""": SPEED_TEST_N_EXAMPLES}
		SCREAMING_SNAKE_CASE__								= (select, sort, shuffle, train_test_split, shard)
		with tempfile.TemporaryDirectory() as tmp_dir:
				print("""generating dataset"""      )
				SCREAMING_SNAKE_CASE__								= datasets.Features({"""text""": datasets.Value("""string"""      ), """numbers""": datasets.Value("""float32"""      )}      )
				SCREAMING_SNAKE_CASE__								= generate_example_dataset(
				    os.path.join(UpperCamelCase__   ,				"""dataset.arrow"""      )   ,				UpperCamelCase__   ,				num_examples=UpperCamelCase__      )
				print("""Functions"""      )
				for func in functions:
						print(func.__name__      )
						SCREAMING_SNAKE_CASE__								= func(UpperCamelCase__      )

		with open(UpperCamelCase__   ,				"""wb"""      ) as f:
				f.write(json.dumps(UpperCamelCase__      ).encode("""utf-8"""      )      )


if __name__ == "__main__":  # useful to run the profiler
	benchmark_indices_mapping()