

import timeit

import numpy as np

import datasets
from datasets.arrow_writer import ArrowWriter
from datasets.features.features import _ArrayXD
def     UpperCAmelCase_       (						_A    ):





     '''simple docstring'''




     def wrapper(*_A				,		**_A    ):
          SCREAMING_SNAKE_CASE__   =   timeit.default_timer()
          SCREAMING_SNAKE_CASE__   =   func(*_A				,		**_A    )
          SCREAMING_SNAKE_CASE__   =   timeit.default_timer() - starttime
          return delta

     SCREAMING_SNAKE_CASE__   =   func.__name__

     return wrapper
def     UpperCAmelCase_       (						_A				,		_A=1_00				,		_A=None    ):





     '''simple docstring'''




     SCREAMING_SNAKE_CASE__   =   []
     SCREAMING_SNAKE_CASE__   =   seq_shapes or {}
     for i in range(_A    ):
          SCREAMING_SNAKE_CASE__   =   {}
          for col_id, (k, v) in enumerate(features.items()    ):
               if isinstance(_A				,		_ArrayXD    ):
                    SCREAMING_SNAKE_CASE__   =   np.random.rand(*v.shape    ).astype(v.dtype    )
               elif isinstance(_A				,		datasets.Value    ):
                    if v.dtype == "string":
                         SCREAMING_SNAKE_CASE__   =   '''The small grey turtle was surprisingly fast when challenged.'''
                    else:
                         SCREAMING_SNAKE_CASE__   =   np.random.randint(10				,		size=1    ).astype(v.dtype    ).item()
               elif isinstance(_A				,		datasets.Sequence    ):
                    while isinstance(_A				,		datasets.Sequence    ):
                         SCREAMING_SNAKE_CASE__   =   v.feature
                    SCREAMING_SNAKE_CASE__   =   seq_shapes[k]
                    SCREAMING_SNAKE_CASE__   =   np.random.rand(*_A    ).astype(v.dtype    )
               SCREAMING_SNAKE_CASE__   =   data

          dummy_data.append((i, example)    )

     return dummy_data







def     UpperCAmelCase_       (						_A				,		_A				,		_A=1_00				,		_A=None    ):





     '''simple docstring'''




     SCREAMING_SNAKE_CASE__   =   generate_examples(_A				,		num_examples=_A				,		seq_shapes=_A    )

     with ArrowWriter(features=_A				,		path=_A    ) as writer:
          for key, record in dummy_data:
               SCREAMING_SNAKE_CASE__   =   features.encode_example(_A    )
               writer.write(_A    )

          SCREAMING_SNAKE_CASE__,SCREAMING_SNAKE_CASE__   =   writer.finalize()

     if not num_final_examples == num_examples:
          raise ValueError(
              F'''Error writing the dataset, wrote {num_final_examples} examples but should have written {num_examples}.'''    )

     SCREAMING_SNAKE_CASE__   =   datasets.Dataset.from_file(filename=_A				,		info=datasets.DatasetInfo(features=_A    )    )

     return dataset





def     UpperCAmelCase_       (						_A    ):





     '''simple docstring'''




     if divisor % 5 == 0 or divisor % 2 == 0:
          return 0
     SCREAMING_SNAKE_CASE__   =   1
     SCREAMING_SNAKE_CASE__   =   1
     while repunit:
          SCREAMING_SNAKE_CASE__   =   (10 * repunit + 1) % divisor
          repunit_index += 1
     return repunit_index
def     UpperCAmelCase_       (						_A = 1_00_00_00    ):





     '''simple docstring'''




     SCREAMING_SNAKE_CASE__   =   limit - 1
     if divisor % 2 == 0:
          divisor += 1
     while least_divisible_repunit(_A    ) <= limit:
          divisor += 2
     return divisor


if __name__ == "__main__":
       print(F"{solution() = }")


