

"""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 							SCREAMING_SNAKE_CASE   (						datasets.BuilderConfig			):






					"""simple docstring"""



					lowercase__												=			None







class 							SCREAMING_SNAKE_CASE   (						datasets.ArrowBasedBuilder			):






					"""simple docstring"""



					lowercase__												=			PandasConfig







					def 			__lowerCAmelCase					(			self     :							int						):
						return datasets.DatasetInfo(features=self.config.features						)







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







					def 			__lowerCAmelCase					(			self     :							Optional[int]  ,lowercase_     :							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
							lowerCAmelCase__      :		List[Any]    							=      table_cast(lowercase_  ,self.config.features.arrow_schema						)
						return pa_table







					def 			__lowerCAmelCase					(			self     :							Tuple  ,lowercase_     :							int						):
						for i, file in enumerate(itertools.chain.from_iterable(lowercase_						)						):
							with open(lowercase_  ,'''rb'''						) as f:
								lowerCAmelCase__      :		Any    							=      pa.Table.from_pandas(pd.read_pickle(lowercase_						)						)
								yield i, self._cast_table(lowercase_						)







"""simple docstring"""





def     __SCREAMING_SNAKE_CASE    ( A_					):
	lowerCAmelCase__      :		Any    							=      int(A_					)
	if decimal in (0, 1):  # Exit cases for the recursion
		return str(A_					)
	lowerCAmelCase__							,lowerCAmelCase__      :		Any    							=      divmod(A_		,	2					)
	return binary_recursive(A_					) + str(A_					)

def     __SCREAMING_SNAKE_CASE    ( A_					):
	lowerCAmelCase__      :		Union[str, Any]    							=      str(A_					).strip()
	if not number:
		raise ValueError('''No input value was provided'''					)
	lowerCAmelCase__      :		Any    							=      '''-''' if number.startswith('''-'''					) else ''''''
	lowerCAmelCase__      :		Dict    							=      number.lstrip('''-'''					)
	if not number.isnumeric():
		raise ValueError('''Input value is not an integer'''					)
	return f'{negative}0b{binary_recursive(int(A_					)					)}'


if __name__ == "__main__":
							from doctest import testmod

							testmod()




