



'''simple docstring'''





import itertools
from dataclasses import dataclass
from typing import Optional

import pandas as pd
import pyarrow as pa

import datasets
from datasets.table import table_cast






@dataclass
class __A			(  datasets.BuilderConfig						):



 '''simple docstring'''







 __lowerCamelCase    :       Optional[datasets.Features]          =       None






class __A			(  datasets.ArrowBasedBuilder						):



 '''simple docstring'''







 __lowerCamelCase    :       Any          =       PandasConfig



 def 					a__  (self       )    ->     Tuple:


      """simple docstring"""



      return datasets.DatasetInfo(features=self.config.features       )



 def 					a__  (self ,   A       )    ->     int:


      """simple docstring"""



      if not self.config.data_files:
           raise ValueError(f'''At least one data file must be specified, but got data_files={self.config.data_files}'''       )
      _a      =  dl_manager.download_and_extract(self.config.data_files       )
      if isinstance(A ,   (str, list, tuple)       ):
           _a      =  data_files
           if isinstance(A ,   A       ):
                _a      =  [files]
           # Use `dl_manager.iter_files` to skip hidden files in an extracted archive
           _a      =  [dl_manager.iter_files(A       ) for file in files]
           return [datasets.SplitGenerator(name=datasets.Split.TRAIN ,   gen_kwargs={'''files''': files}       )]
      _a      =  []
      for split_name, files in data_files.items():
           if isinstance(A ,   A       ):
                _a      =  [files]
           # Use `dl_manager.iter_files` to skip hidden files in an extracted archive
           _a      =  [dl_manager.iter_files(A       ) for file in files]
           splits.append(datasets.SplitGenerator(name=A ,   gen_kwargs={'''files''': files}       )       )
      return splits



 def 					a__  (self ,   A       )    ->     pa.Table:


      """simple docstring"""



      if self.config.features is not None:
           # more expensive cast to support nested features with keys in a different order
           # allows str <-> int/float or str to Audio for example
           _a      =  table_cast(A ,   self.config.features.arrow_schema       )
      return pa_table



 def 					a__  (self ,   A       )    ->     str:


      """simple docstring"""



      for i, file in enumerate(itertools.chain.from_iterable(A       )       ):
           with open(A ,   '''rb'''       ) as f:
                _a      =  pa.Table.from_pandas(pd.read_pickle(A       )       )
                yield i, self._cast_table(A       )








'''simple docstring'''





def lowerCAmelCase  (__A):



     """simple docstring"""



     if not isinstance(__A  ,	__A):
          raise ValueError('''multiplicative_persistence() only accepts integral values''')
     if num < 0:
          raise ValueError('''multiplicative_persistence() does not accept negative values''')

     _a      =  0
     _a      =  str(__A)

     while len(__A) != 1:
          _a      =  [int(__A) for i in num_string]

          _a      =  1
          for i in range(0  ,	len(__A)):
               total *= numbers[i]

          _a      =  str(__A)

          steps += 1
     return steps




def lowerCAmelCase  (__A):



     """simple docstring"""



     if not isinstance(__A  ,	__A):
          raise ValueError('''additive_persistence() only accepts integral values''')
     if num < 0:
          raise ValueError('''additive_persistence() does not accept negative values''')

     _a      =  0
     _a      =  str(__A)

     while len(__A) != 1:
          _a      =  [int(__A) for i in num_string]

          _a      =  0
          for i in range(0  ,	len(__A)):
               total += numbers[i]

          _a      =  str(__A)

          steps += 1
     return steps


if __name__ == "__main__":
  import doctest

  doctest.testmod()



