

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        UpperCAmelCase__		(       datasets.BuilderConfig       ):






  """simple docstring"""


  a           =					None






class        UpperCAmelCase__		(       datasets.ArrowBasedBuilder       ):






  """simple docstring"""


  a           =					PandasConfig






  def       lowercase_		(							self						:		Optional[int]					)		->							str:
       return datasets.DatasetInfo(features=self.config.features					)






  def       lowercase_		(							self						:		int	,   __lowerCamelCase						:		Optional[Any]					)		->							List[Any]:
       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}'''					)
       SCREAMING_SNAKE_CASE__    =    dl_manager.download_and_extract(self.config.data_files					)
       if isinstance(__a	,   (str, list, tuple)					):
            SCREAMING_SNAKE_CASE__    =    data_files
            if isinstance(__a	,   __a					):
                 SCREAMING_SNAKE_CASE__    =    [files]
            # Use `dl_manager.iter_files` to skip hidden files in an extracted archive
            SCREAMING_SNAKE_CASE__    =    [dl_manager.iter_files(__a					) for file in files]
            return [datasets.SplitGenerator(name=datasets.Split.TRAIN	,   gen_kwargs={'''files''': files}					)]
       SCREAMING_SNAKE_CASE__    =    []
       for split_name, files in data_files.items():
            if isinstance(__a	,   __a					):
                 SCREAMING_SNAKE_CASE__    =    [files]
            # Use `dl_manager.iter_files` to skip hidden files in an extracted archive
            SCREAMING_SNAKE_CASE__    =    [dl_manager.iter_files(__a					) for file in files]
            splits.append(datasets.SplitGenerator(name=__a	,   gen_kwargs={'''files''': files}					)					)
       return splits






  def       lowercase_		(							self						:		int	,   __lowerCamelCase						:		pa.Table					)		->							Tuple:
       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
            SCREAMING_SNAKE_CASE__    =    table_cast(__a	,   self.config.features.arrow_schema					)
       return pa_table







  def       lowercase_		(							self						:		str	,   __lowerCamelCase						:		str					)		->							str:
       for i, file in enumerate(itertools.chain.from_iterable(__a					)					):
            with open(__a	,   '''rb'''					) as f:
                 SCREAMING_SNAKE_CASE__    =    pa.Table.from_pandas(pd.read_pickle(__a					)					)
                 yield i, self._cast_table(__a					)









'''simple docstring'''







def  _lowerCamelCase				( lowercase						:      int						)	->	bool:
				_a								= n ** (1 / 3)
				return (val * val * val) == n


if __name__ == "__main__":
					print(perfect_cube(27))
					print(perfect_cube(4))
