
"""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						):
    a   :					Optional[datasets.Features]			     =					None







class 		a_    (			datasets.ArrowBasedBuilder						):
    a   :					int			     =					PandasConfig







    def   _snake_case       (      self      :							Tuple  )		->Dict:






        '''simple docstring'''






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







    def   _snake_case       (      self      :							int  ,       __UpperCamelCase      :							Any  )		->Dict:






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







    def   _snake_case       (      self      :							Tuple  ,       __UpperCamelCase      :							pa.Table  )		->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
            _UpperCAmelCase        = table_cast(__UpperCamelCase  ,       self.config.features.arrow_schema  )
        return pa_table







    def   _snake_case       (      self      :							str  ,       __UpperCamelCase      :							str  )		->Dict:






        '''simple docstring'''






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

"""simple docstring"""



import importlib
import os
from dataclasses import dataclass
from enum import Enum
from typing import Any, Dict, Optional, Union

import torch

from ..utils import BaseOutput


a       :						int       		=		'''scheduler_config.json'''




class 		a_    (			_UpperCAmelCase						):
    a   :					List[Any]			     =					1
    a   :					Tuple			     =					2
    a   :					Dict			     =					3
    a   :					str			     =					4
    a   :					Optional[int]			     =					5
    a   :					Any			     =					6
    a   :					int			     =					7
    a   :					Any			     =					8
    a   :					List[Any]			     =					9
    a   :					Any			     =					10
    a   :					List[str]			     =					11
    a   :					Optional[int]			     =					12
    a   :					Any			     =					13
    a   :					Dict			     =					14







@dataclass
class 		a_    (			_UpperCAmelCase						):
    a   :					torch.FloatTensor







class 		a_    :
    a   :					Dict			     =					SCHEDULER_CONFIG_NAME
    a   :					List[str]			     =					[]
    a   :					Optional[int]			     =					True







    @classmethod
    def   _snake_case       (      cls      :							List[str]  ,       __UpperCamelCase      :							Dict[str, Any] = None  ,       __UpperCamelCase      :							Optional[str] = None  ,       __UpperCamelCase      :							List[str]=False  ,       **__UpperCamelCase      :							int  ,       )		->Dict:






        '''simple docstring'''






        _UpperCAmelCase     ,_UpperCAmelCase     ,_UpperCAmelCase        = cls.load_config(
            pretrained_model_name_or_path=__UpperCamelCase  ,       subfolder=__UpperCamelCase  ,       return_unused_kwargs=__UpperCamelCase  ,       return_commit_hash=__UpperCamelCase  ,       **__UpperCamelCase  ,       )
        return cls.from_config(__UpperCamelCase  ,       return_unused_kwargs=__UpperCamelCase  ,       **__UpperCamelCase  )







    def   _snake_case       (      self      :							Tuple  ,       __UpperCamelCase      :							Union[str, os.PathLike]  ,       __UpperCamelCase      :							bool = False  ,       **__UpperCamelCase      :							List[str]  )		->Any:






        '''simple docstring'''






        self.save_config(save_directory=__UpperCamelCase  ,       push_to_hub=__UpperCamelCase  ,       **__UpperCamelCase  )







    @property
    def   _snake_case       (      self      :							Optional[int]  )		->List[Any]:






        '''simple docstring'''






        return self._get_compatibles()







    @classmethod
    def   _snake_case       (      cls      :							List[str]  )		->Dict:






        '''simple docstring'''






        _UpperCAmelCase        = list(set([cls.__name__] + cls._compatibles  )  )
        _UpperCAmelCase        = importlib.import_module(__name__.split("""."""  )[0]  )
        _UpperCAmelCase        = [
            getattr(__UpperCamelCase  ,       __UpperCamelCase  ) for c in compatible_classes_str if hasattr(__UpperCamelCase  ,       __UpperCamelCase  )
        ]
        return compatible_classes