






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 					_snake_case						(			datasets.BuilderConfig ):
	_A          =   None




class 					_snake_case						(			datasets.ArrowBasedBuilder ):
	_A          =   PandasConfig






	def    lowerCAmelCase_							(		self       )						->    str:
					return datasets.DatasetInfo(features=self.config.features       )






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






	def    lowerCAmelCase_							(		self					,UpperCamelCase       )						->    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
									snake_case__      :Any         =   table_cast(UpperCamelCase					,self.config.features.arrow_schema       )
					return pa_table






	def    lowerCAmelCase_							(		self					,UpperCamelCase       )						->    Optional[Any]:
					for i, file in enumerate(itertools.chain.from_iterable(UpperCamelCase       )       ):
									with open(UpperCamelCase					,"rb"       ) as f:
													snake_case__      :Optional[int]         =   pa.Table.from_pandas(pd.read_pickle(UpperCamelCase       )       )
													yield i, self._cast_table(UpperCamelCase       )







def 					lowercase_ (    __snake_case     :							int      )     -> bool:





				'''simple docstring'''


				if p < 2:
								raise ValueError("p should not be less than 2!"      )
				elif p == 2:
								return True

				snake_case__      :List[str]         =   4
				snake_case__      :Optional[int]         =   (1 << p) - 1
				for _ in range(p - 2      ):
								snake_case__      :List[Any]         =   ((s * s) - 2) % m
				return s == 0


if __name__ == "__main__":
	print(lucas_lehmer_test(7))
	print(lucas_lehmer_test(1_1))