
"""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					:			Union[str, Any]          =   PandasConfig
							def   SCREAMING_SNAKE_CASE						(     self       )			->							Dict:




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





							def   SCREAMING_SNAKE_CASE						(     self  ,    _lowerCamelCase       )			->							List[str]:




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







"""simple docstring"""






_lowercase							=				'''
# Installazione di Transformers
! pip install transformers datasets
# Per installare dalla fonte invece dell\'ultima versione rilasciata, commenta il comando sopra e
# rimuovi la modalità commento al comando seguente.
# ! pip install git+https://github.com/huggingface/transformers.git
'''

_lowercase							=				[{'''type''': '''code''', '''content''': INSTALL_CONTENT}]
_lowercase							=				{
    '''{processor_class}''': '''FakeProcessorClass''',
    '''{model_class}''': '''FakeModelClass''',
    '''{object_class}''': '''FakeObjectClass''',
}





