




'''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


_lowerCAmelCase				     = 100000000000
_lowerCAmelCase				     = 10000

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

def       __lowerCAmelCase (   snake_case__ ,				snake_case__						):
			__UpperCamelCase				:      List[Any]									=       pa.Table.from_pydict({"col": [0] * chunk_size}						)
			__UpperCamelCase				:      Dict									=       pa.concat_tables([table] * (num_examples // chunk_size)						)
			return datasets.Dataset(snake_case__ ,				fingerprint="table_100B"						)



@dataclass
class  A		:




				'''simple docstring'''





				A				     =    42
				A				     =    42
				A				     =    42
				A				     =    42
				def 	a_	(self      )     ->	List[str]:
							__UpperCamelCase				:      int									=       np.random.default_rng(self.seed      )
							__UpperCamelCase				:      Optional[Any]									=       rng.integers(low=self.low			,  high=self.high			,  size=self.size      ).tolist()
				def __iter__(self      )     ->	Dict:
							return iter(self._sampled_values      )





				def __len__(self      )     ->	Optional[int]:
							return self.size







@get_duration
def       __lowerCAmelCase (   snake_case__						):
			__UpperCamelCase				:      Tuple									=       dataset[0]

@get_duration
def       __lowerCAmelCase (   snake_case__						):
			__UpperCamelCase				:      str									=       dataset[-1]

@get_duration
def       __lowerCAmelCase (   snake_case__						):
			__UpperCamelCase				:      Dict									=       dataset[range(len(snake_case__						) // 2 ,				len(snake_case__						) // 2 + 1_024						)]

@get_duration
def       __lowerCAmelCase (   snake_case__						):
			__UpperCamelCase				:      str									=       dataset[RandIter(0 ,				len(snake_case__						) ,				1_024 ,				seed=42						)]

def       __lowerCAmelCase (   ):
			__UpperCamelCase				:      Dict									=       {"num examples": SPEED_TEST_N_EXAMPLES}
			__UpperCamelCase				:      Union[str, Any]									=       (get_first_row, get_last_row, get_batch_of_aaaa_rows, get_batch_of_aaaa_random_rows)
			print("generating dataset"						)
			__UpperCamelCase				:      List[Any]									=       generate_100B_dataset(num_examples=snake_case__ ,				chunk_size=snake_case__						)
			print("Functions"						)
			for func in functions:
						print(func.__name__						)
						__UpperCamelCase				:      str									=       func(snake_case__						)

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


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









'''simple docstring'''






from doctest import testmod
from math import sqrt

def       __lowerCAmelCase (   snake_case__						):
			__UpperCamelCase				:      list[int]									=       []
			if num < 1:
						return facs
			facs.append(1						)
			if num == 1:
						return facs
			facs.append(snake_case__						)
			for i in range(2 ,				int(sqrt(snake_case__						)						) + 1						):
						if num % i == 0:  # If i is a factor of num
									facs.append(snake_case__						)
									__UpperCamelCase				:      List[str]									=       num // i  # num//i is the other factor of num
									if d != i:  # If d and i are distinct
												facs.append(snake_case__						)  # we have found another factor
			facs.sort()
			return facs


if __name__ == "__main__":
				testmod(name='''factors_of_a_number''', verbose=True)



