



"""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'''





	SCREAMING_SNAKE_CASE          =	None






class 			A__   (  datasets.ArrowBasedBuilder							):




	'''simple docstring'''





	SCREAMING_SNAKE_CASE          =	PandasConfig

	def 							_SCREAMING_SNAKE_CASE   (     self:		Union[str, Any])				->       str:

				"""simple docstring"""

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

	def 							_SCREAMING_SNAKE_CASE   (     self:		Tuple       ,			_SCREAMING_SNAKE_CASE:		Optional[int])				->       Optional[Any]:

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







	def 							_SCREAMING_SNAKE_CASE   (     self:		str       ,			_SCREAMING_SNAKE_CASE:		Union[str, Any])				->       Optional[int]:

				"""simple docstring"""

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




"""simple docstring"""






import re


def 			_lowercase				(  __snake_case	)						->   str:

			if len(re.findall("[ATCG]"					,__snake_case	)	) != len(__snake_case	):
						raise ValueError("Invalid Strand"	)

			return dna.translate(dna.maketrans("ATCG"					,"TAGC"	)	)


if __name__ == "__main__":
	import doctest

	doctest.testmod()