

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







   '''simple docstring'''




   lowerCamelCase__				=      None





class 			_SCREAMING_SNAKE_CASE (   datasets.ArrowBasedBuilder		):







   '''simple docstring'''




   lowerCamelCase__				=      PandasConfig





   def      _snake_case		(       self					:			Tuple			):
       return datasets.DatasetInfo(features=self.config.features			)





   def      _snake_case		(       self					:			int     , __lowerCamelCase					:			str			):
       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(__lowerCamelCase     , (str, list, tuple)			):
           SCREAMING_SNAKE_CASE										=   data_files
           if isinstance(__lowerCamelCase     , __lowerCamelCase			):
               SCREAMING_SNAKE_CASE										=   [files]
           # Use `dl_manager.iter_files` to skip hidden files in an extracted archive
           SCREAMING_SNAKE_CASE										=   [dl_manager.iter_files(__lowerCamelCase			) 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(__lowerCamelCase     , __lowerCamelCase			):
               SCREAMING_SNAKE_CASE										=   [files]
           # Use `dl_manager.iter_files` to skip hidden files in an extracted archive
           SCREAMING_SNAKE_CASE										=   [dl_manager.iter_files(__lowerCamelCase			) for file in files]
           splits.append(datasets.SplitGenerator(name=__lowerCamelCase     , gen_kwargs={"files": files}			)			)
       return splits





   def      _snake_case		(       self					:			Optional[Any]     , __lowerCamelCase					:			pa.Table			):
       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(__lowerCamelCase     , self.config.features.arrow_schema			)
       return pa_table





   def      _snake_case		(       self					:			Union[str, Any]     , __lowerCamelCase					:			Tuple			):
       for i, file in enumerate(itertools.chain.from_iterable(__lowerCamelCase			)			):
           with open(__lowerCamelCase     , "rb"			) as f:
               SCREAMING_SNAKE_CASE										=   pa.Table.from_pandas(pd.read_pickle(__lowerCamelCase			)			)
               yield i, self._cast_table(__lowerCamelCase			)





'''simple docstring'''


def 						lowerCamelCase__   (				a							):
						assert (
						    isinstance(a    ,	a							) and number_of_steps > 0
						), f'number_of_steps needs to be positive integer, your input {number_of_steps}'
						if number_of_steps == 1:
												return 1
						__snake_case ,       __snake_case						 =   1, 1
						for _ in range(number_of_steps - 1							):
												__snake_case ,       __snake_case						 =   current + previous, current
						return current


if __name__ == "__main__":
	import doctest

	doctest.testmod()

