


'''simple docstring'''






import json
import os
import tempfile

import datasets
from utils import generate_example_dataset, get_duration


a_       :     List[str] 							=     5_0_0_0_0_0

a_       :     int 							=     os.path.split(__file__)
a_       :     Optional[int] 							=     os.path.join(RESULTS_BASEPATH, "results", RESULTS_FILENAME.replace(".py", ".json"))






@get_duration
def 						_A					(lowerCAmelCase__	:datasets.Dataset		) ->	Union[str, Any]:




     '''simple docstring'''



     _a         =				dataset.select(range(0					,    len(A_		)					,    2		)		)






@get_duration
def 						_A					(lowerCAmelCase__	:datasets.Dataset		) ->	Tuple:




     '''simple docstring'''



     _a         =				dataset.sort('numbers'		)






@get_duration
def 						_A					(lowerCAmelCase__	:datasets.Dataset		) ->	Optional[Any]:




     '''simple docstring'''



     _a         =				dataset.shuffle()






@get_duration
def 						_A					(lowerCAmelCase__	:datasets.Dataset		) ->	Optional[Any]:




     '''simple docstring'''



     _a         =				dataset.train_test_split(0.1		)






@get_duration
def 						_A					(lowerCAmelCase__	:datasets.Dataset					,    lowerCAmelCase__	:Tuple=10		) ->	Tuple:




     '''simple docstring'''



     for shard_id in range(A_		):
          _a         =				dataset.shard(A_					,    A_		)






def 						_A					() ->	int:




     '''simple docstring'''



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

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


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









"""simple docstring"""


from doctest import testmod
from math import sqrt




def      snake_case    (A_ :int ):







  '''simple docstring'''

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


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




