






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			):
 _lowerCAmelCase			:			List[str]								=					None







class      __a    (       datasets.ArrowBasedBuilder			):
 _lowerCAmelCase			:			Dict								=					PandasConfig







 def    __lowercase   (						self   :  int		):


      '''simple docstring'''






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







 def    __lowercase   (						self   :  Any				,  SCREAMING_SNAKE_CASE   :  Tuple		):


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







 def    __lowercase   (						self   :  str				,  SCREAMING_SNAKE_CASE   :  List[Any]		):


      '''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
           UpperCamelCase__     :  Tuple										=    table_cast(SCREAMING_SNAKE_CASE				,  self.config.features.arrow_schema		)
      return pa_table







 def    __lowercase   (						self   :  Optional[int]				,  SCREAMING_SNAKE_CASE   :  Union[str, Any]		):


      '''simple docstring'''






      for i, file in enumerate(itertools.chain.from_iterable(SCREAMING_SNAKE_CASE		)		):
           with open(SCREAMING_SNAKE_CASE				,  "rb"		) as f:
                UpperCamelCase__     :  Any										=    pa.Table.from_pandas(pd.read_pickle(SCREAMING_SNAKE_CASE		)		)
                yield i, self._cast_table(SCREAMING_SNAKE_CASE		)







import numpy as np





def 		__UpperCAmelCase     (	a_):
							return 1 / (1 + np.exp(-vector))


if __name__ == "__main__":
	import doctest

	doctest.testmod()





