
'''simple docstring'''


import json
import os
from dataclasses import dataclass

import numpy as np
import pyarrow as pa

import datasets
from utils import get_duration


__lowercase							:				Dict					=       100000000000
__lowercase							:				Optional[Any]					=       10000

__lowercase			,						__lowercase							:				List[Any]					=       os.path.split(__file__)
__lowercase							:				List[str]					=       os.path.join(RESULTS_BASEPATH, '''results''', RESULTS_FILENAME.replace('''.py''', '''.json'''))




def lowercase_		(				_lowercase     ,    _lowercase			)       ->							datasets.Dataset:
					'''simple docstring'''

					lowerCamelCase_   : List[Any]       =						pa.Table.from_pydict({'''col''': [0] * chunk_size}			)
					lowerCamelCase_   : Dict       =						pa.concat_tables([table] * (num_examples // chunk_size)			)
					return datasets.Dataset(_lowercase     ,    fingerprint='''table_100B'''			)

@dataclass
class 		__lowercase			:
			lowerCamelCase     :						int
			lowerCamelCase     :						int
			lowerCamelCase     :						int
			lowerCamelCase     :						int

			def     UpperCAmelCase__	(self ):
								lowerCamelCase_   : Dict       =						np.random.default_rng(self.seed )
								lowerCamelCase_   : List[Any]       =						rng.integers(low=self.low     ,				high=self.high     ,				size=self.size ).tolist()

			def __iter__(self ):
								return iter(self._sampled_values )






			def __len__(self ):
								return self.size




@get_duration
def lowercase_		(				_lowercase			)       ->							List[str]:
					'''simple docstring'''

					lowerCamelCase_   : List[Any]       =						dataset[0]




@get_duration
def lowercase_		(				_lowercase			)       ->							Dict:
					'''simple docstring'''

					lowerCamelCase_   : Dict       =						dataset[-1]




@get_duration
def lowercase_		(				_lowercase			)       ->							Any:
					'''simple docstring'''

					lowerCamelCase_   : Union[str, Any]       =						dataset[range(len(_lowercase			) // 2     ,    len(_lowercase			) // 2 + 1_024			)]




@get_duration
def lowercase_		(				_lowercase			)       ->							Optional[Any]:
					'''simple docstring'''

					lowerCamelCase_   : int       =						dataset[RandIter(0     ,    len(_lowercase			)     ,    1_024     ,    seed=42			)]




def lowercase_		(				)       ->							Tuple:
					'''simple docstring'''

					lowerCamelCase_   : str       =						{'num examples': SPEED_TEST_N_EXAMPLES}
					lowerCamelCase_   : Tuple       =						(get_first_row, get_last_row, get_batch_of_aaaa_rows, get_batch_of_aaaa_random_rows)
					print('''generating dataset'''			)
					lowerCamelCase_   : str       =						generate_100B_dataset(num_examples=_lowercase     ,    chunk_size=_lowercase			)
					print('''Functions'''			)
					for func in functions:
										print(func.__name__			)
										lowerCamelCase_   : Dict       =						func(_lowercase			)

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


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




'''simple docstring'''


def lowercase_		(				_lowercase			)       ->							int:
					'''simple docstring'''

					if not isinstance(_lowercase     ,    _lowercase			):
										raise TypeError('''recursive_lucas_number accepts only integer arguments.'''			)
					if n_th_number == 0:
										return 2
					if n_th_number == 1:
										return 1

					return recursive_lucas_number(n_th_number - 1			) + recursive_lucas_number(
					    n_th_number - 2			)




def lowercase_		(				_lowercase			)       ->							int:
					'''simple docstring'''

					if not isinstance(_lowercase     ,    _lowercase			):
										raise TypeError('''dynamic_lucas_number accepts only integer arguments.'''			)
					lowerCamelCase_, lowerCamelCase_   : List[Any]       =						2, 1
					for _ in range(_lowercase			):
										lowerCamelCase_, lowerCamelCase_   : Dict       =						b, a + b
					return a


if __name__ == "__main__":
					from doctest import testmod

					testmod()
					__lowercase							:				Any					=       int(input('''Enter the number of terms in lucas series:\n''').strip())
					print('''Using recursive function to calculate lucas series:''')
					print(''' '''.join(str(recursive_lucas_number(i)) for i in range(n)))
					print('''\nUsing dynamic function to calculate lucas series:''')
					print(''' '''.join(str(dynamic_lucas_number(i)) for i in range(n)))


