




import json
import os
import tempfile

import datasets
from utils import generate_example_dataset, get_duration


a_ 		=  50_0000

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




@get_duration
def        __SCREAMING_SNAKE_CASE (	lowercase_   )							->						List[str]:

    """simple docstring"""


    __UpperCamelCase			=    dataset.select(range(0       ,  len(lowercase_   )       ,  2   )   )




@get_duration
def        __SCREAMING_SNAKE_CASE (	lowercase_   )							->						Optional[Any]:

    """simple docstring"""


    __UpperCamelCase			=    dataset.sort('''numbers'''   )




@get_duration
def        __SCREAMING_SNAKE_CASE (	lowercase_   )							->						Optional[Any]:

    """simple docstring"""


    __UpperCamelCase			=    dataset.shuffle()




@get_duration
def        __SCREAMING_SNAKE_CASE (	lowercase_   )							->						str:

    """simple docstring"""


    __UpperCamelCase			=    dataset.train_test_split(0.1   )




@get_duration
def        __SCREAMING_SNAKE_CASE (	lowercase_       ,  lowercase_=10   )							->						Any:

    """simple docstring"""


    for shard_id in range(lowercase_   ):
        __UpperCamelCase			=    dataset.shard(lowercase_       ,  lowercase_   )




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

    """simple docstring"""


    __UpperCamelCase			=    {'''num examples''': SPEED_TEST_N_EXAMPLES}
    __UpperCamelCase			=    (select, sort, shuffle, train_test_split, shard)
    with tempfile.TemporaryDirectory() as tmp_dir:
        print('''generating dataset'''   )
        __UpperCamelCase			=    datasets.Features({'''text''': datasets.Value('''string'''   ), '''numbers''': datasets.Value('''float32'''   )}   )
        __UpperCamelCase			=    generate_example_dataset(
            os.path.join(lowercase_       ,  '''dataset.arrow'''   )       ,  lowercase_       ,  num_examples=lowercase_   )
        print('''Functions'''   )
        for func in functions:
            print(func.__name__   )
            __UpperCamelCase			=    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_indices_mapping()










import math

def 		_UpperCAmelCase							(     SCREAMING_SNAKE_CASE__     :   int							):
     __UpperCamelCase       				=math.log(2     ,	10							) * number
     __UpperCamelCase       				=round((log_number - int(SCREAMING_SNAKE_CASE__							))     ,	15							)

     return difference

def 		_UpperCAmelCase							(     SCREAMING_SNAKE_CASE__     :   int = 67_89_10							):
     __UpperCamelCase       				=90
     __UpperCamelCase       				=0

     __UpperCamelCase       				=math.log(1.23     ,	10							)
     __UpperCamelCase       				=math.log(1.24     ,	10							)
     __UpperCamelCase       				=0

     while position < number:
          __UpperCamelCase       				=log_difference(SCREAMING_SNAKE_CASE__							)

          if difference >= upper_limit:
               power_iterator += 93

          elif difference < lower_limit:
               power_iterator += 1_96

          else:
               __UpperCamelCase       				=power_iterator
               power_iterator += 1_96
               position += 1

     return previous_power


if __name__ == "__main__":
   import doctest

   doctest.testmod()

   print(f"""{solution() = }""")





